[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1466931470.2504.27.camel@decadent.org.uk>
Date: Sun, 26 Jun 2016 10:57:50 +0200
From: Ben Hutchings <ben@...adent.org.uk>
To: David Decotigny <ddecotig@...il.com>, netdev@...r.kernel.org
Cc: Jeff Garzik <jgarzik@...ox.com>, David Miller <davem@...hat.com>,
Vidya Sagar Ravipati <vidya@...ulusnetworks.com>,
Joe Perches <joe@...ches.com>,
David Decotigny <decot@...glers.com>
Subject: Re: [ethtool PATCH v7 2/2] ethtool: use netlink socket when AF_INET
not available
On Fri, 2016-03-25 at 09:21 -0700, David Decotigny wrote:
> From: David Decotigny <decot@...glers.com>
>
> To benefit from this, kernel commit 025c68186e07 ("netlink: add support
> for NIC driver ioctls") is needed.
>
>
> Signed-off-by: David Decotigny <decot@...glers.com>
> ---
> configure.ac | 2 +-
> ethtool.c | 7 +++++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 3105415..47d2a0f 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -15,7 +15,7 @@ AM_PROG_CC_C_O
> dnl Checks for libraries.
>
> dnl Checks for header files.
> -AC_CHECK_HEADERS(sys/ioctl.h)
> +AC_CHECK_HEADERS(sys/ioctl.h linux/netlink.h)
This doesn't make a lot of sense. That header has been around since
Linux 2.1. But it didn't define NETLINK_GENERIC then.
(The test for <sys/ioctl.h> doesn't make sense either, as we include it
unconditionally!)
> dnl Checks for typedefs, structures, and compiler characteristics.
> AC_MSG_CHECKING([whether defines big-endian types])
> diff --git a/ethtool.c b/ethtool.c
> index cb3d971..314b1b8 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -42,6 +42,9 @@
> #include
>
> #include
> +#ifdef HAVE_LINUX_NETLINK_H
> +# include
> +#endif
>
So what I've committed instead makes this unconditional, but adds a
conditional definition of NETLINK_GENERIC.
Ben.
>
> #ifndef MAX_ADDR_LEN
> #define MAX_ADDR_LEN 32
> @@ -4645,6 +4648,10 @@ opt_found:
>
> /* Open control socket. */
> ctx.fd = socket(AF_INET, SOCK_DGRAM, 0);
> +#ifdef HAVE_LINUX_NETLINK_H
> + if (ctx.fd < 0)
> + ctx.fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
> +#endif
> if (ctx.fd < 0) {
> perror("Cannot get control socket");
> return 70;
--
Ben Hutchings
compatible: Gracefully accepts erroneous data from any source
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists