All of lore.kernel.org
 help / color / mirror / Atom feed
* [Suggestion] net-ipv6: format %8s change to %16s in rt6_info_route function of route.c
@ 2012-11-01  6:45 Chen Gang
  2012-11-01  9:01 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Gang @ 2012-11-01  6:45 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org

Hello:

1) For Public Kernel:

   A) in rt6_info_route function of net/ipv6/route.c

   B) the length of rt->rt6i_dev->name is 16 (IFNAMSIZ)

   C) using %16s is better than %8s (it will be more "beautiful")
      (also suggest to delete RT6_INFO_LEN, it is useless for ever)



2) For Red Hat RHEL5:

   A) in rt6_info_route function of net/ipv6/route.c

   B) the length of rt->rt6i_dev->name is 16 (IFNAMSIZ)

   C) for RT6_INFO_LEN is still useful, so it is an correctness issue.

   the relative patch for RHEL5 is below:

-------------------------------------------------------------------------
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 08ab51f..3c90b4c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2285,7 +2285,7 @@ void inet6_rt_notify(int event, struct rt6_info
*rt, struct nlmsghdr *nlh,

 #ifdef CONFIG_PROC_FS

-#define RT6_INFO_LEN (32 + 4 + 32 + 4 + 32 + 40 + 5 + 1)
+#define RT6_INFO_LEN (32 + 4 + 32 + 4 + 32 + 48 + 5 + 1)

 struct rt6_proc_arg
 {
@@ -2343,7 +2343,7 @@ static int rt6_info_route(struct rt6_info *rt,
void *p_arg)
                arg->len += 32;
        }
        arg->len += sprintf(arg->buffer + arg->len,
-                           " %08x %08x %08x %08x %8s\n",
+                           " %08x %08x %08x %08x %16s\n",
                            rt->rt6i_metric,
atomic_read(&rt->u.dst.__refcnt),
                            rt->u.dst.__use, rt->rt6i_flags,
                            rt->rt6i_dev ? rt->rt6i_dev->name : "");

----------------------------------------------------------------------------

-- 
Chen Gang

Asianux Corporation

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

* Re: [Suggestion] net-ipv6: format %8s change to %16s in rt6_info_route function of route.c
  2012-11-01  6:45 [Suggestion] net-ipv6: format %8s change to %16s in rt6_info_route function of route.c Chen Gang
@ 2012-11-01  9:01 ` Eric Dumazet
  2012-11-01 10:23   ` Chen Gang
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2012-11-01  9:01 UTC (permalink / raw)
  To: Chen Gang; +Cc: linux-kernel@vger.kernel.org, netdev

On Thu, 2012-11-01 at 14:45 +0800, Chen Gang wrote:
> Hello:
> 
> 1) For Public Kernel:
> 
>    A) in rt6_info_route function of net/ipv6/route.c
> 
>    B) the length of rt->rt6i_dev->name is 16 (IFNAMSIZ)
> 
>    C) using %16s is better than %8s (it will be more "beautiful")
>       (also suggest to delete RT6_INFO_LEN, it is useless for ever)
> 
> 
> 
> 2) For Red Hat RHEL5:
> 
>    A) in rt6_info_route function of net/ipv6/route.c
> 
>    B) the length of rt->rt6i_dev->name is 16 (IFNAMSIZ)
> 
>    C) for RT6_INFO_LEN is still useful, so it is an correctness issue.
> 
>    the relative patch for RHEL5 is below:

Hi Chen

Thats a good suggestion indeed.

Networking patches should be sent to netdev@vger.kernel.org (added in
CC)

This list only cares about recent generic kernels, not RedHat ones.

If you want to provide a patch, please base it on David Miller net-next
[1] tree, and make it official (read Documentation/SubmittingPatches for
general advices)

By the way, the %8s should be replaced by %s, there is no need to make
/proc/net/ipv6_route 'beautiful'. In the past, it was *needed* because
each line had to be of a given length, but its not anymore the case.

Thanks

[1] :
http://git.kernel.org/?p=linux/kernel/git/davem/net-next.git;a=summary



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

* Re: [Suggestion] net-ipv6: format %8s change to %16s in rt6_info_route function of route.c
  2012-11-01  9:01 ` Eric Dumazet
@ 2012-11-01 10:23   ` Chen Gang
  0 siblings, 0 replies; 3+ messages in thread
From: Chen Gang @ 2012-11-01 10:23 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: linux-kernel@vger.kernel.org, netdev

于 2012年11月01日 17:01, Eric Dumazet 写道:
> Hi Chen
> 
> Thats a good suggestion indeed.
> 

  thank you very much for your confirmation.

> Networking patches should be sent to netdev@vger.kernel.org (added in
> CC)

  I will do it.

> 
> This list only cares about recent generic kernels, not RedHat ones.
> 

  it seems "it is not suitable to send any issues which only relative
with Red Hat to linux-*@vger.kernel.org".



> If you want to provide a patch, please base it on David Miller net-next
> [1] tree, and make it official (read Documentation/SubmittingPatches for
> general advices)
> 

  ok, I will follow, thank you for your information.


> By the way, the %8s should be replaced by %s, there is no need to make
> /proc/net/ipv6_route 'beautiful'. In the past, it was *needed* because
> each line had to be of a given length, but its not anymore the case.
> 
> Thanks
> 

1) I agree with your result.

2) But for the "reason", I have my opinions:
   A) %.8s :  for limitation of output string length.
   B) %8s  :  for width of output string length (but not limit 8).
   C) %8.8s:  both limitation and width.

3) for rt->rt6i_dev->name:
   A) original %8s is not a bug for name len is more than 8 (can still
be outputted correctly)
   B) it is only effect with name len is less than 8 (it will fill some
' ' before the name)
   C) this is the reason why I call it "beautiful", not a bug.


> [1] :
> http://git.kernel.org/?p=linux/kernel/git/davem/net-next.git;a=summary
> 

  I will reference it, thanks.


-- 
Chen Gang

Asianux Corporation

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

end of thread, other threads:[~2012-11-01 10:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-01  6:45 [Suggestion] net-ipv6: format %8s change to %16s in rt6_info_route function of route.c Chen Gang
2012-11-01  9:01 ` Eric Dumazet
2012-11-01 10:23   ` Chen Gang

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.