summaryrefslogtreecommitdiffstats
path: root/perl-install/c
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-01-07 16:47:07 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-01-07 16:47:07 +0000
commitd27835dbdf4ec277591ffa68e4233f869f3f6a9f (patch)
tree233915b572c6664aa06c1c45c72baafebe30b184 /perl-install/c
parentba08600e6168462fd13994ebcd18a7dc015dd9e7 (diff)
downloaddrakx-d27835dbdf4ec277591ffa68e4233f869f3f6a9f.tar
drakx-d27835dbdf4ec277591ffa68e4233f869f3f6a9f.tar.gz
drakx-d27835dbdf4ec277591ffa68e4233f869f3f6a9f.tar.bz2
drakx-d27835dbdf4ec277591ffa68e4233f869f3f6a9f.tar.xz
drakx-d27835dbdf4ec277591ffa68e4233f869f3f6a9f.zip
fixes merged from head into updates
Diffstat (limited to 'perl-install/c')
-rw-r--r--perl-install/c/stuff.xs.pl31
1 files changed, 31 insertions, 0 deletions
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl
index fb9f86074..ab5bf35c7 100644
--- a/perl-install/c/stuff.xs.pl
+++ b/perl-install/c/stuff.xs.pl
@@ -10,6 +10,7 @@ print '
#include <ctype.h>
#include <stdlib.h>
+#include <stdio.h>
#include <unistd.h>
#include <syslog.h>
#include <fcntl.h>
@@ -32,6 +33,16 @@ print '
#include <linux/blkpg.h>
#include <net/if.h>
#include <net/route.h>
+#include <netinet/in.h>
+#include <linux/sockios.h>
+
+// for ethtool structs:
+typedef unsigned long long u64;
+typedef __uint32_t u32;
+typedef __uint16_t u16;
+typedef __uint8_t u8;
+
+#include <linux/ethtool.h>
/* for is_ext3 */
#include <ext2fs/ext2_fs.h>
@@ -404,6 +415,26 @@ hasNetDevice(device)
OUTPUT:
RETVAL
+char*
+getNetDriver(char* device)
+ CODE:
+ struct ifreq ifr;
+ struct ethtool_drvinfo drvinfo;
+ int s = socket(AF_INET, SOCK_DGRAM, 0);
+
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)-1);
+
+ drvinfo.cmd = ETHTOOL_GDRVINFO;
+ ifr.ifr_data = (caddr_t) &drvinfo;
+
+ if (ioctl(s, SIOCETHTOOL, &ifr) != -1)
+ RETVAL = strdup(drvinfo.driver);
+ else { perror("SIOCETHTOOL"); RETVAL = strdup(""); }
+ OUTPUT:
+ RETVAL
+
+
int
addDefaultRoute(gateway)
char *gateway