Bug 8876 (ip_addr_show) - Not all IPs are shown by "ip addr show"
Summary: Not all IPs are shown by "ip addr show"
Status: CLOSED PATCH_ALREADY_AVAILABLE
Alias: ip_addr_show
Product: Networking
Classification: Unclassified
Component: IPV4 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Stephen Hemminger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-10 06:05 UTC by Nick
Modified: 2007-09-24 16:28 UTC (History)
1 user (show)

See Also:
Kernel Version: >=2.6.22 (2.6.23.x too)
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
fixing patch (478 bytes, patch)
2007-08-10 10:42 UTC, Nick
Details | Diff

Description Nick 2007-08-10 06:05:05 UTC
Most recent kernel where this bug did not occur: 2.6.21.x
Distribution: no matter
Hardware Environment: generic i686
Software Environment: GNU
Problem Description:
Not all ips are shown by "ip addr show" command when IPs number assigned to an interface is more than 60-80 (in fact it depends on broadcast/label etc presence on each address).

Steps to reproduce:
It's terribly simple to reproduce:

# for i in $(seq 1 100); do ip ad add 10.0.$i.1/24 dev eth10 ; done
# ip addr show

this will _not_ show all IPs.
Looks like the problem is in netlink/ipv4 message processing.
Comment 1 Nick 2007-08-10 06:07:34 UTC
Sure I tried _all_ iproute2 versions, including one for 2.6.22 kernel.
Comment 2 Stephen Hemminger 2007-08-10 06:23:20 UTC
This probably isn't a kernel bug.

In iproute2 source the response for netlink (lib/netlink.c) is declared
as 16384 bytes. This limits maximum size of responses.  Try making it
bigger.
Comment 3 Nick 2007-08-10 06:37:32 UTC
Hi Stephen,

unfortunately, it is.

I'm debugging the kernel now and see that netlink subsystem fills only 3804 bytes of its _internal_ skb.
I'd be glad to see anything limited to 16k. But even Iproute2 sources are ok.
That 16k buffer is only for 1 cycle reading. But the cycle is being continued while whole kernel response is not read :)
So, 16k is not a problem.

Even more. To show you the real kernel true.
The example I provided shows last IP 10.0.72.1 (or 70, 71 - no matter)

But look here for another example ;)

# for i in $(seq 1 100); do ip ad add 10.0.$i.1/24 broadcast 10.0.$i.255 dev eth0 ; done
# ip addr show

and you will see that it's showing only 63 (possible 64) ips only!!!

Internally, I saw that it's just filling 1 its buffer (those 3804 bytes) and stops. And broadcast info sure takes some space - so, IPs put in the buffer is smaller when broadcast defined (label, I believe, will make the listed IPs number even smaller).
Comment 4 Anonymous Emailer 2007-08-10 09:51:15 UTC
Reply-To: akpm@linux-foundation.org

On Fri, 10 Aug 2007 05:58:25 -0700 (PDT) bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=8876
> 
>            Summary: Not all IPs are shown by "ip addr show"
>            Product: Networking
>            Version: 2.5
>      KernelVersion: >=2.6.22 (2.6.23.x too)
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: high
>           Priority: P1
>          Component: IPV4
>         AssignedTo: shemminger@osdl.org
>         ReportedBy: gentuu@gmail.com
> 
> 
> Most recent kernel where this bug did not occur: 2.6.21.x

a regression.

> Distribution: no matter
> Hardware Environment: generic i686
> Software Environment: GNU
> Problem Description:
> Not all ips are shown by "ip addr show" command when IPs number assigned to
> an
> interface is more than 60-80 (in fact it depends on broadcast/label etc
> presence on each address).
> 
> Steps to reproduce:
> It's terribly simple to reproduce:
> 
> # for i in $(seq 1 100); do ip ad add 10.0.$i.1/24 dev eth10 ; done
> # ip addr show
> 
> this will _not_ show all IPs.
> Looks like the problem is in netlink/ipv4 message processing.
> 
Comment 5 Nick 2007-08-10 10:42:30 UTC
Created attachment 12346 [details]
fixing patch
Comment 6 Nick 2007-08-10 10:43:51 UTC
Just found the problem reason (patch is attached).

Comitters should be careful with goto'es... ;)
Comment 7 Nick 2007-08-13 13:02:22 UTC
Hi,

and what about committing this fix into .23 rc/git branch ?
Comment 8 Stephen Hemminger 2007-08-22 09:34:06 UTC
Please submit patch to netdev@vger.kernel.org with proper Signed-off-by:
Comment 9 Stephen Hemminger 2007-09-14 06:16:16 UTC
Fixed in 2.6.23-rc6
Comment 10 Nick 2007-09-14 06:48:22 UTC
In fact in 2.6.23-rc6-git1 ;)

Note You need to log in before you can comment on or make changes to this bug.