summaryrefslogtreecommitdiffstats
path: root/lib/network/connection/ethernet.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/network/connection/ethernet.pm')
-rw-r--r--lib/network/connection/ethernet.pm51
1 files changed, 5 insertions, 46 deletions
diff --git a/lib/network/connection/ethernet.pm b/lib/network/connection/ethernet.pm
index a4023a1..0450149 100644
--- a/lib/network/connection/ethernet.pm
+++ b/lib/network/connection/ethernet.pm
@@ -112,8 +112,8 @@ sub guess_protocol {
sub guess_address_settings {
my ($self) = @_;
$self->{address}{dhcp_client} ||= find { -x "$::prefix/sbin/$_" } @dhcp_clients;
- $self->{address}{peerdns} = 1 if !defined $self->{address}{peerdns};
- $self->{address}{peeryp} = 1 if !defined $self->{address}{peeryp};
+ $self->{address}{peerdns} //= 1;
+ $self->{address}{peeryp} //= 1;
$self->supplement_address_settings;
}
@@ -204,7 +204,7 @@ sub check_address_settings {
sub guess_hostname_settings {
my ($self) = @_;
- $self->{address}{needhostname} = 0 if !defined $self->{address}{needhostname};
+ $self->{address}{needhostname} //= 0;
if (!defined $self->{address}{hostname}) {
require network::network;
my $network = network::network::read_conf($::prefix . $network::network::network_file);
@@ -233,7 +233,7 @@ sub guess_control_settings {
$self->network::connection::guess_control_settings($self);
- $self->{control}{onboot} = 1 if !defined $self->{control}{onboot};
+ $self->{control}{onboot} //= 1;
$self->{control}{use_ifplugd} = !is_ifplugd_blacklisted($self->get_driver)
if !defined $self->{control}{use_ifplugd};
}
@@ -274,7 +274,7 @@ sub build_ifcfg_settings {
DHCP_HOSTNAME => $self->{address}{dhcp_hostname},
DHCP_TIMEOUT => $self->{address}{dhcp_timeout},
MII_NOT_SUPPORTED => bool2yesno(!$self->{control}{use_ifplugd}),
- IPV6INIT => bool2yesno($self->{control}{ipv6_tunnel}),
+ IPV6INIT => 'yes',
IPV6TO4INIT => bool2yesno($self->{control}{ipv6_tunnel}),
DNS1 => $self->{address}{dns1},
DNS2 => $self->{address}{dns2},
@@ -294,8 +294,6 @@ sub write_settings {
}
}
$self->SUPER::write_settings($o_net, $o_modules_conf);
- # update udev configuration
- update_udev_net_config();
}
sub get_status_message {
@@ -491,43 +489,6 @@ sub get_eth_card_mac_address {
`$::prefix/sbin/ip -o link show $intf 2>/dev/null` =~ m|.*link/(\S+)\s((?:[0-9a-f]{2}:?)+)\s|;
}
-#- write interfaces MAC address in iftab
-sub update_iftab() {
- #- skip aliases and vlan interfaces
- foreach my $intf (grep { network::tools::is_real_interface($_) } detect_devices::get_lan_interfaces()) {
- my ($link_type, $mac_address) = get_eth_card_mac_address($intf) or next;
- #- do not write zeroed MAC addresses in iftab, it confuses ifrename
- $mac_address =~ /^[0:]+$/ and next;
- # ifrename supports alsa IEEE1394, EUI64 and IRDA
- member($link_type, 'ether', 'ieee1394', 'irda', '[27]') or next;
- substInFile {
- s/^$intf\s+.*\n//;
- s/^.*\s+$mac_address\n//;
- $_ .= qq($intf mac $mac_address\n) if eof;
- } "$::prefix/etc/iftab";
- }
-}
-
-sub update_udev_net_config() {
- my $net_name_helper = "/lib/udev/write_net_rules";
- my $udev_net_config = "$::prefix/etc/udev/rules.d/70-persistent-net.rules";
- my @old_config = cat_($udev_net_config);
- #- skip aliases and vlan interfaces
- foreach my $intf (grep { network::tools::is_real_interface($_) } detect_devices::get_lan_interfaces()) {
- (undef, my $mac_address) = get_eth_card_mac_address($intf) or next;
- #- do not write zeroed MAC addresses
- $mac_address =~ /^[0:]+$/ and next;
- #- skip already configured addresses
- any { !/^\s*#/ && /"$mac_address"/ } @old_config and next;
- my $type = cat_("/sys/class/net/$intf/type") =~ /^\d+$/;
- local $ENV{MATCHIFTYPE} = $type if $type;
- local $ENV{INTERFACE} = $intf;
- local $ENV{MATCHADDR} = $mac_address;
- local $ENV{COMMENT} = "Drakx-net rule for $intf ($mac_address)";
- run_program::rooted($::prefix, $net_name_helper, '>', '/dev/null', $mac_address);
- }
-}
-
# automatic net aliases configuration
sub configure_eth_aliases {
my ($modules_conf) = @_;
@@ -535,8 +496,6 @@ sub configure_eth_aliases {
$modules_conf->set_alias($card->[0], $card->[1]);
}
$::isStandalone and $modules_conf->write;
- update_iftab();
- update_udev_net_config();
}
sub get_link_detection_delay {