diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-03-31 17:45:38 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-03-31 17:45:38 +0000 |
commit | b54be22369a6c7891f128452e84d96a0180b6e9e (patch) | |
tree | 3885bac32f1cd11cad3925572364fc7c5a32c84e /perl-install/c/stuff.xs.pl | |
parent | 9c59084f982e1042105e9859348439c89e948e61 (diff) | |
download | drakx-b54be22369a6c7891f128452e84d96a0180b6e9e.tar drakx-b54be22369a6c7891f128452e84d96a0180b6e9e.tar.gz drakx-b54be22369a6c7891f128452e84d96a0180b6e9e.tar.bz2 drakx-b54be22369a6c7891f128452e84d96a0180b6e9e.tar.xz drakx-b54be22369a6c7891f128452e84d96a0180b6e9e.zip |
add enable_net_device
Diffstat (limited to 'perl-install/c/stuff.xs.pl')
-rw-r--r-- | perl-install/c/stuff.xs.pl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index 3abcd7690..ec4b72569 100644 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -471,6 +471,25 @@ isNetDeviceWirelessAware(device) RETVAL +int enable_net_device(device) + char * device + CODE: + struct ifreq ifr; + int err; + int s = socket(AF_INET, SOCK_DGRAM, 0); + + strncpy(ifr.ifr_name, device, IFNAMSIZ); + err = ioctl(s, SIOCGIFFLAGS, &ifr); + if (!err && !(ifr.ifr_flags & IFF_UP)) { + ifr.ifr_flags |= IFF_UP; + err = ioctl(s, SIOCSIFFLAGS, &ifr); + } + if (err) + perror("SIOCSIFFLAGS"); + RETVAL = err; + OUTPUT: + RETVAL + void get_netdevices() PPCODE: |