diff options
-rw-r--r-- | scripts/vyatta-interfaces.pl | 20 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/mtu/node.def | 4 |
2 files changed, 18 insertions, 6 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); diff --git a/templates/interfaces/ethernet/node.tag/mtu/node.def b/templates/interfaces/ethernet/node.tag/mtu/node.def index 07c102a..74c238a 100644 --- a/templates/interfaces/ethernet/node.tag/mtu/node.def +++ b/templates/interfaces/ethernet/node.tag/mtu/node.def @@ -1,5 +1,5 @@ type: u32 help: Set the Maximum Transmission Unit (MTU) for this interface syntax:expression: $VAR(@) >= 68 && $VAR(@) <= 9000; "MTU must be between 68 and 9000" -update:expression: "sudo ip link set $VAR(../@) mtu $VAR(@)"; "Error setting MTU on dev $VAR(../@)" -delete:expression: "sudo ip link set $VAR(../@) mtu 1500"; "Error deleting MTU on dev $VAR(../@)" +update:expression: "sudo ip link set $VAR(../@) mtu $VAR(@) && echo $VAR(@) > /tmp/dhclient_mtu_check_$VAR(../@)"; "Error setting MTU on dev $VAR(../@)" +delete:expression: "sudo ip link set $VAR(../@) mtu 1500 && rm -f /tmp/dhclient_mtu_check_$VAR(../@)"; "Error deleting MTU on dev $VAR(../@)" |