[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <002b01d24940$9e16e1c0$da44a540$@cmss.chinamobile.com>
Date: Mon, 28 Nov 2016 14:28:18 +0800
From: 张胜举 <zhangshengju@...s.chinamobile.com>
To: "'David Ahern'" <dsa@...ulusnetworks.com>, <netdev@...r.kernel.org>
Subject: RE: [net,v2] neigh: fix the loop index error in neigh dump
> -----Original Message-----
> From: David Ahern [mailto:dsa@...ulusnetworks.com]
> Sent: Monday, November 28, 2016 1:07 PM
> To: 张胜举 <zhangshengju@...s.chinamobile.com>;
> netdev@...r.kernel.org
> Subject: Re: [net,v2] neigh: fix the loop index error in neigh dump
>
> On 11/27/16 9:50 PM, 张胜举 wrote:
> > No, when dump request must be processed by multiple 'recv/recvmsg'
> > system calls, idx stores which dev/neigh the previous call have
> > processed, so that next call will scan from the right place.
>
> I have tested multiple calls and I do not see redundant information or
missing
> information.
>
> >
> > So no matter whether the dev/neigh is filtered, the idx should be
> > increased anyway.
>
> No, it does not. Again, idx is the index in the list of devices/ of
interest. It is
> NOT a device index nor is it the absolute index in the list. It is a
relative index.
> The filter is the same across recvmsg calls so the idx count is absolutely
fine.
>
> Produce a test case that fails.
David, I know your point. And I agree with you that this will not make
redundant or missing link information.
But this will cause the filtered out device be scanned multiple times.
For example, assume that netlink message can only store two devices info.
And eth2-eth5 are filtered out.
For the first loop, idx will point to eth2, but the code already scan to
eth6.
eth0->eth1->eth2(out)->eth3(out)-> eth4(out)->eth5(out)->eth6->eth7
^
The next loop, the code will start to scan from eth2 to eth8, but eth2-eth5
already scanned by previous loop. After this loop, idx will point to eth4.
eth0->eth1->eth2(out)->eth3(out)->eth4(out)->eth5(out)->eth6->eth7->eth8
^
So this will cause the same device to be scanned multiple times.
Almost all other dump functions treat idx as the absolute index in the list,
and will not have the above problem.
We don't treat this a bugfix, but i think we'd better in line with other
dump functions.
Powered by blists - more mailing lists