summaryrefslogtreecommitdiffstats
path: root/perl-install/network/tools.pm
diff options
context:
space:
mode:
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;