Re: [ethtool PATCH v4 11/11] ethtool.c: support absence of v4 sockets

2016-03-15 Thread Ben Hutchings
On Tue, 2016-03-15 at 16:19 -0700, David Decotigny wrote:
> will send a v5 shortly without this patch: question below.
> 
> about this patch: this is in prevision of a world where INET can be
> compiled out. So it is not something that matters today with current
> kernels.

OK.

> Now, as you mentioned in another patch, the only socket that survives
> various reasonable CONFIG_* gymnastics is netlink. So even though
> non-IPv4 kernels with IP support is not feasible today, I believe
> there is some logic to using netlink sockets for ethtool purposes,
> instead of IPv4 or IPv6 sockets. Shall I propose a patch to add
> ethtool support on AF_NETLINK sockets, and update the tool to try
> AF_INET first for backward compatibility reasons, then fallback to
> AF_NETLINK?

Yes, please do that.

Ben.

-- 
Ben Hutchings
Hoare's Law of Large Problems:
Inside every large problem is a small problem struggling to get out.

signature.asc
Description: This is a digitally signed message part


Re: [ethtool PATCH v4 11/11] ethtool.c: support absence of v4 sockets

2016-03-15 Thread David Decotigny
will send a v5 shortly without this patch: question below.

about this patch: this is in prevision of a world where INET can be
compiled out. So it is not something that matters today with current
kernels.

Now, as you mentioned in another patch, the only socket that survives
various reasonable CONFIG_* gymnastics is netlink. So even though
non-IPv4 kernels with IP support is not feasible today, I believe
there is some logic to using netlink sockets for ethtool purposes,
instead of IPv4 or IPv6 sockets. Shall I propose a patch to add
ethtool support on AF_NETLINK sockets, and update the tool to try
AF_INET first for backward compatibility reasons, then fallback to
AF_NETLINK?

On Sun, Mar 13, 2016 at 10:24 AM, Ben Hutchings  wrote:
> On Fri, 2016-03-11 at 09:58 -0800, David Decotigny wrote:
>> From: David Decotigny 
>>
>>
>> Signed-off-by: David Decotigny 
>> ---
>>  ethtool.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/ethtool.c b/ethtool.c
>> index 761252f..f9336e3 100644
>> --- a/ethtool.c
>> +++ b/ethtool.c
>> @@ -4615,6 +4615,9 @@ opt_found:
>>   /* Open control socket. */
>>   ctx.fd = socket(AF_INET, SOCK_DGRAM, 0);
>>   if (ctx.fd < 0) {
>> + ctx.fd = socket(AF_UNIX, SOCK_DGRAM, 0);
>> + }
>
> You still haven't answered whether this is a real problem on Linux.
>
> Ben.
>
>> + if (ctx.fd < 0) {
>>   perror("Cannot get control socket");
>>   return 70;
>>   }
> --
> Ben Hutchings
> If at first you don't succeed, you're doing about average.


Re: [ethtool PATCH v4 11/11] ethtool.c: support absence of v4 sockets

2016-03-13 Thread Ben Hutchings
On Fri, 2016-03-11 at 09:58 -0800, David Decotigny wrote:
> From: David Decotigny 
> 
> 
> Signed-off-by: David Decotigny 
> ---
>  ethtool.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/ethtool.c b/ethtool.c
> index 761252f..f9336e3 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -4615,6 +4615,9 @@ opt_found:
>   /* Open control socket. */
>   ctx.fd = socket(AF_INET, SOCK_DGRAM, 0);
>   if (ctx.fd < 0) {
> + ctx.fd = socket(AF_UNIX, SOCK_DGRAM, 0);
> + }

You still haven't answered whether this is a real problem on Linux.

Ben.

> + if (ctx.fd < 0) {
>   perror("Cannot get control socket");
>   return 70;
>   }
-- 
Ben Hutchings
If at first you don't succeed, you're doing about average.

signature.asc
Description: This is a digitally signed message part


[ethtool PATCH v4 11/11] ethtool.c: support absence of v4 sockets

2016-03-11 Thread David Decotigny
From: David Decotigny 


Signed-off-by: David Decotigny 
---
 ethtool.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ethtool.c b/ethtool.c
index 761252f..f9336e3 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -4615,6 +4615,9 @@ opt_found:
/* Open control socket. */
ctx.fd = socket(AF_INET, SOCK_DGRAM, 0);
if (ctx.fd < 0) {
+   ctx.fd = socket(AF_UNIX, SOCK_DGRAM, 0);
+   }
+   if (ctx.fd < 0) {
perror("Cannot get control socket");
return 70;
}
-- 
2.7.0.rc3.207.g0ac5344



[ethtool PATCH v4 11/11] ethtool.c: support absence of v4 sockets

2016-03-07 Thread David Decotigny
From: David Decotigny 


Signed-off-by: David Decotigny 
---
 ethtool.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ethtool.c b/ethtool.c
index 761252f..f9336e3 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -4615,6 +4615,9 @@ opt_found:
/* Open control socket. */
ctx.fd = socket(AF_INET, SOCK_DGRAM, 0);
if (ctx.fd < 0) {
+   ctx.fd = socket(AF_UNIX, SOCK_DGRAM, 0);
+   }
+   if (ctx.fd < 0) {
perror("Cannot get control socket");
return 70;
}
-- 
2.7.0.rc3.207.g0ac5344