[ethtool] 08/16: ethtool: use netlink socket when AF_INET not available
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Thu Jun 30 15:24:57 UTC 2016
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch master
in repository ethtool.
commit 225fdc697f4e16f4ad2870d6cc86d22c12f73a3d
Author: David Decotigny <decot at googlers.com>
Date: Sun Jun 26 10:52:59 2016 +0200
ethtool: use netlink socket when AF_INET not available
To benefit from this, kernel commit 025c68186e07 ("netlink: add support
for NIC driver ioctls") is needed.
Signed-off-by: David Decotigny <ddecotig at gmail.com>
[bwh: Remove feature test for <linux/netlink.h>, and add conditional
definition of NETLINK_GENERIC]
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
ethtool.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/ethtool.c b/ethtool.c
index a9dee95..093adf7 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -43,6 +43,7 @@
#include <arpa/inet.h>
#include <linux/sockios.h>
+#include <linux/netlink.h>
#ifndef MAX_ADDR_LEN
#define MAX_ADDR_LEN 32
@@ -68,6 +69,10 @@ enum {
};
#endif
+#ifndef NETLINK_GENERIC
+#define NETLINK_GENERIC 16
+#endif
+
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
static void exit_bad_args(void) __attribute__((noreturn));
@@ -4667,6 +4672,8 @@ opt_found:
/* Open control socket. */
ctx.fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (ctx.fd < 0)
+ ctx.fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (ctx.fd < 0) {
perror("Cannot get control socket");
return 70;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/ethtool.git
More information about the Kernel-svn-changes
mailing list