summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2008-07-23 12:06:06 +0000
committerMohit Mehta <mohit.mehta@vyatta.com>2008-07-23 12:06:06 +0000
commit4b246014e42b2ab0ea0736b4bb422132de3fa458 (patch)
treefda506b35e5173bfe9c6d7ea1e748709d3f63ac7 /scripts
parente95fb343a63b8cb6c1dc10fe30b5b1c3cafecc2a (diff)
downloadvyatta-cfg-4b246014e42b2ab0ea0736b4bb422132de3fa458.tar.gz
vyatta-cfg-4b246014e42b2ab0ea0736b4bb422132de3fa458.zip
Fix Bug 3318 ENHANCEMENT REQUEST: Option to NOT Accept DHCP MTU Offers Below Specified Value
- only request for dhcp-option interface-mtu from a dhcp-server for an ethernet interface using dhcp to get IP - do not request for interface-mtu for other interfaces that use dhcp i.e. ethernet vifs and bridges - request for interface-mtu from dhcp-server for ethernet interfaces, only if ethernet mtu not set in CLI
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vyatta-interfaces.pl20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 18fbf61..676e196 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,11 +206,15 @@ 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);