summaryrefslogtreecommitdiff
path: root/network.pl.in
diff options
context:
space:
mode:
authorunammx <unammx>2001-07-25 05:04:10 +0000
committerunammx <unammx>2001-07-25 05:04:10 +0000
commit5e9d457eb092e116d32de7610c97a33353bab0d6 (patch)
treefff794f6e7a918c3ac9459a39a2f0236707879fe /network.pl.in
parent600d12b49de2c788b3e3a62ae7c92d78bf8c58f5 (diff)
Wed Jul 25 03:45:51 2001 Arturo Espinosa Aldama <arturo@ximian.com>
* network.pl.in (xst_network_pump_get_nodns): Only omit updatedns tag if pump doesn't support it, or information will be lost. (xst_network_interface_changed): more intelligent network interface info comparison. (xst_network_rh62_interface_activate): Use this function here, getting rid of weird criterion. (xst_network_suse70_interface_activate): same. * parse.pl.in (xst_parse_interfaces_option_kw_not): Minor bug: undef ne 0.
Diffstat (limited to 'network.pl.in')
-rw-r--r--network.pl.in65
1 files changed, 33 insertions, 32 deletions
diff --git a/network.pl.in b/network.pl.in
index 35a1ee8..3bc51b7 100644
--- a/network.pl.in
+++ b/network.pl.in
@@ -1076,25 +1076,18 @@ sub xst_network_rh62_interface_activate
my ($hash, $old_hash, $enabled, $force) = @_;
my $dev;
- if ($enabled)
- {
- if (!exists $$hash{"file"})
- {
- $dev = $$hash{"dev"};
- }
- else
- {
- $dev = $$hash{"file"} if (!$old_hash || !$$old_hash{"enabled"} || $force);
- }
- }
- else
- {
- $dev = $$hash{"file"} if ($old_hash && $$old_hash{"enabled"} || $force);
- }
-
- if ($dev)
+ if ($force || &xst_network_interface_changed ($hash, $old_hash))
{
- &xst_network_rh62_interface_activate_by_dev ($dev, $enabled);
+ if (exists $$hash{"file"})
+ {
+ $dev = $$hash{"file"};
+ }
+ else
+ {
+ $dev = $$hash{"dev"};
+ }
+
+ &xst_network_rh62_interface_activate_by_dev ($dev, $enabled);
}
}
@@ -1131,20 +1124,10 @@ sub xst_network_suse70_interface_activate_by_dev
sub xst_network_suse70_interface_activate
{
my ($hash, $old_hash, $enabled, $force) = @_;
- my $dev;
- if ($old_hash)
- {
- $dev = $$hash{"dev"} if ($enabled != $$old_hash{"enabled"} || $force);
- }
- else
- {
- $dev = $$hash{"dev"};
- }
-
- if ($dev)
+ if ($force || &xst_network_interface_changed ($hash, $old_hash))
{
- &xst_network_suse70_interface_activate_by_dev ($dev, $enabled);
+ &xst_network_rh62_interface_activate_by_dev ($$hash{"dev"}, $enabled);
}
}
@@ -1225,6 +1208,25 @@ sub xst_network_suse70_interface_delete
&xst_replace_sh ($file, "IFCONFIG_$dev", "");
}
+sub xst_network_interface_changed
+{
+ my ($iface, $iface_old) = @_;
+ my ($attr);
+ my @attrs = qw(bootproto dev address netmask broadcast network gateway update_dns
+ dns1 dns2 mtu mru remote_address login serial_port serial_speed
+ ppp_options set_default_gw persist serial_hwctl phone_number enabled);
+
+ return 1 if (!$iface_old);
+ foreach $attr (@attrs)
+ {
+ next if (!exists $$iface{$attr}) && (!exists $$iface_old{$attr});
+ return 1 if (exists $$iface{$attr}) != (exists $$iface_old{$attr});
+ return 1 if $$iface{$attr} ne $$iface_old{$attr};
+ }
+
+ return 0;
+}
+
sub xst_network_interfaces_down_changed
{
my ($proc_iface_set, $old_hash, $values_hash) = @_;
@@ -1232,7 +1234,7 @@ sub xst_network_interfaces_down_changed
@ifaces = &xst_network_active_interfaces_get ();
foreach $i (@ifaces)
{
- if (!&xst_util_struct_eq ($$values_hash{$i}, $$old_hash{$i}))
+ if (&xst_network_interface_changed ($$values_hash{$i}, $$old_hash{$i}))
{
&$proc_iface_set ($$values_hash{$i}, $$old_hash{$i}, 0, 1);
}
@@ -1621,7 +1623,6 @@ sub xst_network_pump_get_nodns
{
my ($file, $iface, $bootproto) = @_;
- return undef if $bootproto ne "dhcp";
return undef if (!&xst_network_pump_iface_supported ($iface));
return &xst_parse_pump_get_iface_kw_not ($file, $iface, "nodns");