From: Brian Haley <brian.haley@hp.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>,
ysugiura@miraclelinux.com, netdev@vger.kernel.org
Subject: Re: [IPV6]: ROUTE:read ifname in rt6_info_route()
Date: Thu, 16 Apr 2009 12:17:28 -0400 [thread overview]
Message-ID: <49E75A18.7020002@hp.com> (raw)
In-Reply-To: <20090416083031.1cc24489@nehalam>
Stephen Hemminger wrote:
> On Thu, 16 Apr 2009 04:38:00 -0700 (PDT)
> David Miller <davem@davemloft.net> wrote:
>
>> From: Yuta sugiura <ysugiura@miraclelinux.com>
>> Date: Thu, 16 Apr 2009 20:05:05 +0900
>>
>>> Hi,
>>> I have a suggestion about /proc/net/IPv6_route format.
>>> In rt6_info_route(), interface name is treated as a maximum 8
>>> characters.
>>> But the type of (struct rt6_inf *)->u.dst.dev->name is char[IFNAMESIZ=
>>> 16]
>>> so, I think that it should change "%8s" to "%16s".
>> Isn't there a way to pass the field length as a paramenter
>> to formatting functions? Then we can just pass in
>> IFNAMESIZE as that parameter.
>
> seq_printf(m, " %08x %08x %08x %08x %*s\n"
> rt->rt6i_metric, atomic_read(&rt->u.dst.__refcnt),
> rt->u.dst.__use, rt->rt6i_flags,
> IFNAMESIZE,
> rt->rt6i_dev ? rt->rt6i_dev->name : "")
Does the kernel actually truncate an interface name more than 8 chars long in
the original version? I did a quick test in userspace and found that
printf("%*s\n", 1, "foo");
prints:
foo
I think the width specifier is used for *minimum* width, not maximum.
-Brian
next prev parent reply other threads:[~2009-04-16 16:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-16 11:05 [IPV6]: ROUTE:read ifname in rt6_info_route() Yuta sugiura
2009-04-16 11:38 ` David Miller
2009-04-16 15:30 ` Stephen Hemminger
2009-04-16 16:17 ` Brian Haley [this message]
2009-04-16 16:47 ` Andreas Schwab
2009-04-16 17:27 ` Stephen Hemminger
2009-04-17 3:44 ` Yuta sugiura
2009-04-17 10:24 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49E75A18.7020002@hp.com \
--to=brian.haley@hp.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
--cc=ysugiura@miraclelinux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.