summaryrefslogtreecommitdiffstats
path: root/perl-install/network/tools.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-06-09 13:59:03 +0000
committerOlivier Blin <oblin@mandriva.org>2005-06-09 13:59:03 +0000
commit240d4c17d2696c23d23ef45cab63c847ffe4068b (patch)
tree514470e518732fc35487bcd6471bb3c736378033 /perl-install/network/tools.pm
parent6871614562699e7a121bb050fde450155650a770 (diff)
downloaddrakx-240d4c17d2696c23d23ef45cab63c847ffe4068b.tar
drakx-240d4c17d2696c23d23ef45cab63c847ffe4068b.tar.gz
drakx-240d4c17d2696c23d23ef45cab63c847ffe4068b.tar.bz2
drakx-240d4c17d2696c23d23ef45cab63c847ffe4068b.tar.xz
drakx-240d4c17d2696c23d23ef45cab63c847ffe4068b.zip
add get_interface_ip_address (with bits from drakpxelinux)
Diffstat (limited to 'perl-install/network/tools.pm')
-rw-r--r--perl-install/network/tools.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index 220105a53..45c4eb4e6 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -224,4 +224,10 @@ sub get_default_metric {
$idx * 10;
}
+sub get_interface_ip_address {
+ my ($net, $interface) = @_;
+ `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+([\d.]+)/m && $1 ||
+ $net->{ifcfg}{$interface}{IPADDR};
+}
+
1;