Debian net module fixes from Caspar Smit

This commit is contained in:
Jamie Cameron
2012-05-24 21:35:48 -07:00
parent b5449031b8
commit 2bbf1fcae1
3 changed files with 12 additions and 14 deletions

View File

@@ -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)

View File

@@ -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 ])

View File

@@ -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; }