More work on bridge support
authorJamie Cameron <jcameron@webmin.com>
Tue, 28 Jun 2011 16:59:41 +0000 (12:59 -0400)
committerJamie Cameron <jcameron@webmin.com>
Tue, 28 Jun 2011 16:59:41 +0000 (12:59 -0400)
net/edit_bifc.cgi
net/redhat-linux-lib.pl

index b347ae8..6b1a469 100755 (executable)
@@ -116,6 +116,9 @@ elsif ($b && !$b->{'address'} && !$b->{'dhcp'} && !$b->{'bootp'}) {
        $canno = 1;
        }
 @opts = ( );
+if ($canno) {
+       push(@opts, [ "none", $text{'ifcs_noaddress'} ]);
+       }
 if ($dhcp) {
        push(@opts, [ "dhcp", $text{'ifcs_dhcp'} ]);
        }
@@ -152,9 +155,6 @@ elsif ($b && $b->{'broadcast'}) {
        push(@grid, $text{'ifcs_broad'}, "<tt>$b->{'broadcast'}</tt>");
        }
 push(@opts, [ "address", $text{'ifcs_static2'}, &ui_grid_table(\@grid, 2) ]);
-if ($canno) {
-       push(@opts, [ "none", $text{'ifcs_noaddress'} ]);
-       }
 
 # Show the IP field
 if (@opts > 1) {
@@ -280,7 +280,8 @@ if ($in{'bridge'} || $b && $b->{'bridge'}) {
        @ethboot = map { $_->{'fullname'} }
                       grep { $_->{'fullname'} =~ /^eth(\d+)$/ } @boot;
        print &ui_table_row($text{'bifc_bridgeto'},
-               &ui_select("bridgeto", $b->{'bridgeto'}, \@ethboot));
+               &ui_select("bridgeto", $b->{'bridgeto'}, \@ethboot, 1, 0,
+                          $in{'new'} ? 0 : 1));
        }
 
 print &ui_table_end();
index 764fb7c..d41cb3a 100755 (executable)
@@ -212,6 +212,19 @@ else {
        }
 $conf{'NAME'} = $_[0]->{'desc'};
 &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf);
+
+# If this is a bridge, set BRIDGE in real interface
+# XXX fix old one?
+if ($_[0]->{'bridge'}) {
+       local %bconf;
+       &lock_file("$net_scripts_dir/ifcfg-$_[0]->{'bridgeto'}");
+       &read_env_file("$net_scripts_dir/ifcfg-$_[0]->{'bridgeto'}", \%bconf);
+       $bconf{'BRIDGE'} = $_[0]->{'fullname'};
+       &write_env_file("$net_scripts_dir/ifcfg-$_[0]->{'bridgeto'}", \%bconf);
+       &unlock_file("$net_scripts_dir/ifcfg-$_[0]->{'bridgeto'}");
+       }
+
+# Link to devices directory
 if (-d &translate_filename($devices_dir)) {
        &link_file("$net_scripts_dir/ifcfg-$name",
                   "$devices_dir/ifcfg-$name");