From b54be22369a6c7891f128452e84d96a0180b6e9e Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 31 Mar 2005 17:45:38 +0000 Subject: add enable_net_device --- perl-install/c/stuff.xs.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'perl-install/c') 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: -- cgit v1.2.1