All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] igmp: fix byte order in /proc/net/igmp output
@ 2016-05-04 12:11 Eugene Crosser
  2016-05-04 13:13 ` Eric Dumazet
  2016-05-04 13:35 ` Evgeny Cherkashin
  0 siblings, 2 replies; 4+ messages in thread
From: Eugene Crosser @ 2016-05-04 12:11 UTC (permalink / raw)
  To: crosser, netdev

/proc/net/igmp is a readonly attribute that shows multicast groups
to which different network interfaces are subscribed. Among other
things, it displays `multiaddr` which is a 32 bit network-byte-order
field, in hexadecimal format. Prior to this patch, the field was
displayed as an integer, resulting in reverse byte order on little
endian architectures. This patch converts it with ntohl() for display
the same way as this is done for the /proc/net/mcfilter attribute.

The patch changes (corrects) user-visible behaviour.

Signed-off-by: Eugene Crosser <Eugene.Crosser@ru.ibm.com>
---
 net/ipv4/igmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index b3086cf..f9d2139 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -2722,7 +2722,7 @@ static int igmp_mc_seq_show(struct seq_file *seq, void *v)
 		delta = im->timer.expires - jiffies;
 		seq_printf(seq,
 			   "\t\t\t\t%08X %5d %d:%08lX\t\t%d\n",
-			   im->multiaddr, im->users,
+			   ntohl(im->multiaddr), im->users,
 			   im->tm_running,
 			   im->tm_running ? jiffies_delta_to_clock_t(delta) : 0,
 			   im->reporter);
-- 
2.6.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] igmp: fix byte order in /proc/net/igmp output
  2016-05-04 12:11 [PATCH net] igmp: fix byte order in /proc/net/igmp output Eugene Crosser
@ 2016-05-04 13:13 ` Eric Dumazet
  2016-05-04 16:48   ` David Miller
  2016-05-04 13:35 ` Evgeny Cherkashin
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2016-05-04 13:13 UTC (permalink / raw)
  To: Eugene Crosser; +Cc: crosser, netdev

On Wed, 2016-05-04 at 14:11 +0200, Eugene Crosser wrote:
> /proc/net/igmp is a readonly attribute that shows multicast groups
> to which different network interfaces are subscribed. Among other
> things, it displays `multiaddr` which is a 32 bit network-byte-order
> field, in hexadecimal format. Prior to this patch, the field was
> displayed as an integer, resulting in reverse byte order on little
> endian architectures. This patch converts it with ntohl() for display
> the same way as this is done for the /proc/net/mcfilter attribute.
> 
> The patch changes (corrects) user-visible behaviour.
> 
> Signed-off-by: Eugene Crosser <Eugene.Crosser@ru.ibm.com>
> ---
>  net/ipv4/igmp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
> index b3086cf..f9d2139 100644
> --- a/net/ipv4/igmp.c
> +++ b/net/ipv4/igmp.c
> @@ -2722,7 +2722,7 @@ static int igmp_mc_seq_show(struct seq_file *seq, void *v)
>  		delta = im->timer.expires - jiffies;
>  		seq_printf(seq,
>  			   "\t\t\t\t%08X %5d %d:%08lX\t\t%d\n",
> -			   im->multiaddr, im->users,
> +			   ntohl(im->multiaddr), im->users,
>  			   im->tm_running,
>  			   im->tm_running ? jiffies_delta_to_clock_t(delta) : 0,
>  			   im->reporter);


I do not believe we can change this. This is unfortunately too late.

/proc/net/tcp has the same 'issue' or if you prefer, well known
behavior.

Such change would break basically all /proc/net/igmp users.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] igmp: fix byte order in /proc/net/igmp output
  2016-05-04 12:11 [PATCH net] igmp: fix byte order in /proc/net/igmp output Eugene Crosser
  2016-05-04 13:13 ` Eric Dumazet
@ 2016-05-04 13:35 ` Evgeny Cherkashin
  1 sibling, 0 replies; 4+ messages in thread
From: Evgeny Cherkashin @ 2016-05-04 13:35 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: crosser, netdev

-----Eric Dumazet <eric.dumazet@gmail.com> wrote: -----

>To: Evgeny Cherkashin/Russia/IBM@IBMRU
>From: Eric Dumazet <eric.dumazet@gmail.com>
>Date: 2016-05-04 16:13
>Cc: crosser@average.org, netdev@vger.kernel.org
>Subject: Re: [PATCH net] igmp: fix byte order in /proc/net/igmp
>output
>
>On Wed, 2016-05-04 at 14:11 +0200, Eugene Crosser wrote:
>> /proc/net/igmp is a readonly attribute that shows multicast groups
>> to which different network interfaces are subscribed. Among other
>> things, it displays `multiaddr` which is a 32 bit
>network-byte-order
>> field, in hexadecimal format. Prior to this patch, the field was
>> displayed as an integer, resulting in reverse byte order on little
>> endian architectures. This patch converts it with ntohl() for
>display
>> the same way as this is done for the /proc/net/mcfilter attribute.
>> 
>> The patch changes (corrects) user-visible behaviour.
>> 
>> Signed-off-by: Eugene Crosser <Eugene.Crosser@ru.ibm.com>
>> ---
>>  net/ipv4/igmp.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
>> index b3086cf..f9d2139 100644
>> --- a/net/ipv4/igmp.c
>> +++ b/net/ipv4/igmp.c
>> @@ -2722,7 +2722,7 @@ static int igmp_mc_seq_show(struct seq_file
>*seq, void *v)
>>  		delta = im->timer.expires - jiffies;
>>  		seq_printf(seq,
>>  			   "\t\t\t\t%08X %5d %d:%08lX\t\t%d\n",
>> -			   im->multiaddr, im->users,
>> +			   ntohl(im->multiaddr), im->users,
>>  			   im->tm_running,
>>  			   im->tm_running ? jiffies_delta_to_clock_t(delta) : 0,
>>  			   im->reporter);
>
>
>I do not believe we can change this. This is unfortunately too late.
>
>/proc/net/tcp has the same 'issue' or if you prefer, well known
>behavior.
>
>Such change would break basically all /proc/net/igmp users.

I understand that. It is unfortunate though that the byte order is not _just_ wrong, it's _different_ on BE and LE machines...
Oh well.

Thanks,

Eugene

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] igmp: fix byte order in /proc/net/igmp output
  2016-05-04 13:13 ` Eric Dumazet
@ 2016-05-04 16:48   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-05-04 16:48 UTC (permalink / raw)
  To: eric.dumazet; +Cc: Eugene.Crosser, crosser, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 04 May 2016 06:13:36 -0700

> On Wed, 2016-05-04 at 14:11 +0200, Eugene Crosser wrote:
>> /proc/net/igmp is a readonly attribute that shows multicast groups
>> to which different network interfaces are subscribed. Among other
>> things, it displays `multiaddr` which is a 32 bit network-byte-order
>> field, in hexadecimal format. Prior to this patch, the field was
>> displayed as an integer, resulting in reverse byte order on little
>> endian architectures. This patch converts it with ntohl() for display
>> the same way as this is done for the /proc/net/mcfilter attribute.
>> 
>> The patch changes (corrects) user-visible behaviour.
>> 
>> Signed-off-by: Eugene Crosser <Eugene.Crosser@ru.ibm.com>
>> ---
>>  net/ipv4/igmp.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
>> index b3086cf..f9d2139 100644
>> --- a/net/ipv4/igmp.c
>> +++ b/net/ipv4/igmp.c
>> @@ -2722,7 +2722,7 @@ static int igmp_mc_seq_show(struct seq_file *seq, void *v)
>>  		delta = im->timer.expires - jiffies;
>>  		seq_printf(seq,
>>  			   "\t\t\t\t%08X %5d %d:%08lX\t\t%d\n",
>> -			   im->multiaddr, im->users,
>> +			   ntohl(im->multiaddr), im->users,
>>  			   im->tm_running,
>>  			   im->tm_running ? jiffies_delta_to_clock_t(delta) : 0,
>>  			   im->reporter);
> 
> 
> I do not believe we can change this. This is unfortunately too late.
> 
> /proc/net/tcp has the same 'issue' or if you prefer, well known
> behavior.
> 
> Such change would break basically all /proc/net/igmp users.

Agreed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-04 16:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-04 12:11 [PATCH net] igmp: fix byte order in /proc/net/igmp output Eugene Crosser
2016-05-04 13:13 ` Eric Dumazet
2016-05-04 16:48   ` David Miller
2016-05-04 13:35 ` Evgeny Cherkashin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.