summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/VyattaMisc.pm27
-rw-r--r--scripts/vyatta-interfaces.pl51
-rwxr-xr-xscripts/vyatta-load-config.pl2
3 files changed, 47 insertions, 33 deletions
diff --git a/scripts/VyattaMisc.pm b/scripts/VyattaMisc.pm
index e6bd9ff..d74b55a 100755
--- a/scripts/VyattaMisc.pm
+++ b/scripts/VyattaMisc.pm
@@ -24,8 +24,8 @@
package VyattaMisc;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(getNetAddIP isIpAddress);
-@EXPORT_OK = qw(getNetAddIP isIpAddress);
+@EXPORT = qw(getNetAddIP isIpAddress is_ip_v4_or_v6);
+@EXPORT_OK = qw(getNetAddIP isIpAddress is_ip_v4_or_v6);
use strict;
@@ -61,6 +61,29 @@ sub getNetAddrIP {
return $naip;
}
+sub is_ip_v4_or_v6 {
+ my $addr = shift;
+
+ my $ip = NetAddr::IP->new($addr);
+ if (defined $ip && $ip->version() == 4) {
+ #
+ # the call to IP->new() will accept 1.1 and consider
+ # it to be 1.1.0.0, so add a check to force all
+ # 4 octets to be defined
+ #
+ if ($addr !~ /\d+\.\d+\.\d+\.\d+/) {
+ return undef;
+ }
+ return 4;
+ }
+ $ip = NetAddr::IP->new6($addr);
+ if (defined $ip && $ip->version() == 6) {
+ return 6;
+ }
+
+ return undef;
+}
+
sub isIpAddress {
my $ip = shift;
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 3794769..0c219c1 100644
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -184,6 +184,14 @@ sub is_domain_name_set {
return $domainname;
}
+sub is_ethernet_mtu_set {
+ my $intf = shift;
+ my $config = new VyattaConfig;
+ $config->setLevel("interfaces ethernet $intf");
+ my $interface_mtu = undef;
+ $interface_mtu = $config->returnValue("mtu");
+ return $interface_mtu;
+}
sub dhcp_update_config {
my ($conf_file, $intf) = @_;
@@ -198,39 +206,20 @@ sub dhcp_update_config {
$output .= "\trequest subnet-mask, broadcast-address, routers, domain-name-servers";
my $domainname = is_domain_name_set();
if (!defined($domainname)) {
- $output .= ", domain-name;\n";
- } else {
- $output .= ";\n";
+ $output .= ", domain-name";
+ }
+ if ($intf =~ m/^eth[0-9]+$/) {
+ my $interface_mtu = is_ethernet_mtu_set($intf);
+ if (!defined($interface_mtu)) {
+ $output .= ", interface-mtu";
+ }
}
-
+ $output .= ";\n";
$output .= "}\n\n";
dhcp_write_file($conf_file, $output);
}
-sub is_ip_v4_or_v6 {
- my $addr = shift;
-
- my $ip = NetAddr::IP->new($addr);
- if (defined $ip && $ip->version() == 4) {
- #
- # the call to IP->new() will accept 1.1 and consider
- # it to be 1.1.0.0, so add a check to force all
- # 4 octets to be defined
- #
- if ($addr !~ /\d+\.\d+\.\d+\.\d+/) {
- return undef;
- }
- return 4;
- }
- $ip = NetAddr::IP->new6($addr);
- if (defined $ip && $ip->version() == 6) {
- return 6;
- }
-
- return undef;
-}
-
sub generate_dhclient_intf_files {
my $intf = shift;
@@ -456,7 +445,7 @@ sub op_dhcp_command {
print "$intf is not using DHCP to get an IP address\n";
exit 1;
}
-
+
my $tmp_dhclient_dir = '/var/run/vyatta/dhclient/';
my $release_file = $tmp_dhclient_dir . 'dhclient_release_' . $intf;
if ($op_command eq "dhcp-release") {
@@ -473,13 +462,13 @@ sub op_dhcp_command {
exit 0;
}
} elsif ($op_command eq "dhcp-renew") {
- print "Renewing DHCP lease on $intf ...\n";
+ print "Renewing DHCP lease on $intf ...\n";
run_dhclient($intf);
system ("rm -f $release_file\;");
exit 0;
}
-
- exit 0;
+
+ exit 0;
}
diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl
index ee4a9c4..dfbf575 100755
--- a/scripts/vyatta-load-config.pl
+++ b/scripts/vyatta-load-config.pl
@@ -28,6 +28,8 @@ use IO::Prompt;
use Sys::Syslog qw(:standard :macros);
use VyattaConfigLoad;
+$SIG{'INT'} = 'IGNORE';
+
my $etcdir = $ENV{vyatta_sysconfdir};
my $sbindir = $ENV{vyatta_sbindir};
my $bootpath = $etcdir . "/config";