summaryrefslogtreecommitdiffstats
path: root/lib/network/drakconnect.pm
blob: 88b78485b0c8c7e625e6701830317da111121208 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package network::drakconnect;

use lib qw(/usr/lib/libDrakX);   # helps perl_checker
use common;
use network::network;

sub apply {
    my ($in, $net, $modules_conf) = @_;
    network::network::configure_network($net, $in, $modules_conf);
}

sub get_intf_ip {
    my ($net, $interface) = @_;
    my ($ip, $state, $mask);
    if (-x "/sbin/ifconfig") {
	local $_ = `LC_ALL=C LANGUAGE=C /sbin/ifconfig $interface`;
	$ip = /inet addr:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/mso ? $1 : N("No IP");
	$mask = /Mask:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/mso ? $1 : N("No Mask");
	$state = /inet/ ? N("up") : N("down");
    } else {
	$ip = $net->{ifcfg}{$interface}{IPADDR};
	$state = "n/a";
    }
    ($ip, $state, $mask);
}

1;