From 2bbf1fcae1afb5b9df2864a9863f26912ce01006 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Thu, 24 May 2012 21:35:48 -0700 Subject: [PATCH] Debian net module fixes from Caspar Smit --- net/debian-linux-lib.pl | 23 ++++++++++------------- net/edit_bifc.cgi | 2 +- net/linux-lib.pl | 1 + 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/net/debian-linux-lib.pl b/net/debian-linux-lib.pl index 4ccfb82f7..1938b6446 100755 --- a/net/debian-linux-lib.pl +++ b/net/debian-linux-lib.pl @@ -173,6 +173,9 @@ elsif ($cfg->{'address'}) { ($ip4 & int($nm4))&0xff; push(@options, ['network', $network]); } + if ($cfg->{'mtu'}) { + push(@options, ['mtu', $cfg->{'mtu'}]); + } } else { $method = 'manual'; @@ -206,15 +209,15 @@ elsif ($cfg->{'bond'} == 1) { } # Set specific lines for vlan tagging -if(($cfg->{'vlan'} == 1) && ($gconfig{'os_version'} >= 5)) { - push(@options, ['vlan_raw_device '.$cfg->{'physical'}]); - } -elsif($cfg->{'vlan'} == 1){ +if(($cfg->{'vlan'} == 1) && ($gconfig{'os_version'} < 5)) { push(@options, ['pre-up', 'vconfig add '.$cfg->{'physical'}.' '. $cfg->{'vlanid'}]); push(@options, ['post-down', 'vconfig rem '.$cfg->{'physical'}.' '. $cfg->{'vlanid'}]); } +if(($cfg->{'vlan'} == 1) && ($cfg->{'mtu'})) { + push(@options, ['pre-up', '/sbin/ifconfig '.$cfg->{'physical'}.' mtu '.$cfg->{'mtu'}]); + } # Find the existing interface section my @ifaces = get_interface_defs(); @@ -254,10 +257,7 @@ if (!$found) { &new_interface_def($cfg->{'fullname'}, 'inet', $method, \@options); } - if ($cfg->{'bond'} == 1 && $gconfig{'os_version'} >= 5) { - # Not sure why nothing needs to be done here? - } - elsif ($cfg->{'bond'} == 1) { + if ($cfg->{'bond'} == 1 && $gconfig{'os_version'} < 5) { &new_module_def($cfg->{'fullname'}, $cfg->{'mode'}, $cfg->{'miimon'}, $cfg->{'downdelay'}, $cfg->{'updelay'}); @@ -273,10 +273,7 @@ else { &modify_interface_def($cfg->{'fullname'}, 'inet', $method, \@options, 0); } - if ($cfg->{'bond'} == 1 && $gconfig{'os_version'} >= 5) { - # Not sure why nothing needs to be done here? - } - elsif ($cfg->{'bond'} == 1) { + if ($cfg->{'bond'} == 1 && $gconfig{'os_version'} < 5) { &modify_module_def($cfg->{'fullname'}, 0, $cfg->{'mode'}, $cfg->{'miimon'}, $cfg->{'downdelay'}, $cfg->{'updelay'}); @@ -491,7 +488,7 @@ if ($gconfig{'os_version'} >= 3 || scalar(@autos)) { # Can some boot-time interface parameter be edited? sub can_edit { -return $_[0] ne "mtu"; +return $_[0]; } # valid_boot_address(address) diff --git a/net/edit_bifc.cgi b/net/edit_bifc.cgi index 00f576d0c..10ee32c89 100755 --- a/net/edit_bifc.cgi +++ b/net/edit_bifc.cgi @@ -253,7 +253,7 @@ if(($in{'vlan'}) or (&iface_type($b->{'name'}) =~ /^(.*) (VLAN)$/)) { $vlanid = $2; # Phyical device - @phys = grep { $_->{'virtual'} eq '' } &active_interfaces(); + @phys = grep { (($_->{'virtual'} eq '') && ($_->{'vlanid'} eq '')) } &active_interfaces(1); print &ui_table_row($text{'vlan_physical'}, $in{'new'} ? &ui_select("physical", $physical, [ map { $_->{'fullname'} } @phys ]) diff --git a/net/linux-lib.pl b/net/linux-lib.pl index ebe53fee6..6df930a1f 100755 --- a/net/linux-lib.pl +++ b/net/linux-lib.pl @@ -22,6 +22,7 @@ foreach $l (@lines) { $l =~ /^([^:\s]+)/; $ifc{'name'} = $1; $l =~ /^(\S+)/; $ifc{'fullname'} = $1; if ($l =~ /^(\S+):(\d+)/) { $ifc{'virtual'} = $2; } + if ($l =~ /^(\S+)\.(\d+)/) { $ifc{'vlanid'} = $2; } if ($l =~ /inet addr:(\S+)/) { $ifc{'address'} = $1; } elsif (!$empty) { next; } if ($l =~ /Mask:(\S+)/) { $ifc{'netmask'} = $1; }