* Re: [PATCH] devinet: sysctl setup off by one [not found] <20080523153559.156a1fb5@speedy> @ 2008-05-26 5:51 ` David Miller 2008-05-26 7:39 ` Pavel Emelyanov 1 sibling, 0 replies; 3+ messages in thread From: David Miller @ 2008-05-26 5:51 UTC (permalink / raw) To: stephen.hemminger; +Cc: xemul, netdev From: Stephen Hemminger <stephen.hemminger@vyatta.com> Date: Fri, 23 May 2008 15:35:59 -0700 > It look like the code to setup /proc/sys/net/ipv4/conf/XXX has an > off by one bug that causes the last entry (arp_accept) not to be > adjusted properly. This causes changes to the value to occur in the > default namespace not the clone? Don't use network namespaces > myself, but this looks like a bug. > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Yikes, that is a very strange expression to be there by accident. Pavel, can you take a look at this? Thanks. ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] devinet: sysctl setup off by one [not found] <20080523153559.156a1fb5@speedy> 2008-05-26 5:51 ` [PATCH] devinet: sysctl setup off by one David Miller @ 2008-05-26 7:39 ` Pavel Emelyanov 2008-05-27 18:39 ` Stephen Hemminger 1 sibling, 1 reply; 3+ messages in thread From: Pavel Emelyanov @ 2008-05-26 7:39 UTC (permalink / raw) To: Stephen Hemminger; +Cc: David S. Miller, netdev Stephen Hemminger wrote: > It look like the code to setup /proc/sys/net/ipv4/conf/XXX has an off by one bug > that causes the last entry (arp_accept) not to be adjusted properly. This causes > changes to the value to occur in the default namespace not the clone? Don't use > network namespaces myself, but this looks like a bug. > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> > > --- a/net/ipv4/devinet.c 2008-05-23 15:23:19.000000000 -0700 > +++ b/net/ipv4/devinet.c 2008-05-23 15:29:17.000000000 -0700 > @@ -1466,7 +1466,7 @@ static int __devinet_sysctl_register(str > if (!t) > goto out; > > - for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { > + for (i = 0; i < ARRAY_SIZE(t->devinet_vars); i++) { > t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; > t->devinet_vars[i].extra1 = p; > t->devinet_vars[i].extra2 = net; > This off-by-one is required, since the very last element of this array is used as a sentinel, that shows sysctl engine when to stop processing the table. Look, the sizeof(t->devinet_vars) is __NET_IPV4_CONF_MAX == 22, thus entries 0, 1, ... 20 are tables and the 21-st is this sentinel, so the initialization of this last entry, whose index is (this_sizeof() - 1), is not required. Thanks, Pavel ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] devinet: sysctl setup off by one 2008-05-26 7:39 ` Pavel Emelyanov @ 2008-05-27 18:39 ` Stephen Hemminger 0 siblings, 0 replies; 3+ messages in thread From: Stephen Hemminger @ 2008-05-27 18:39 UTC (permalink / raw) To: Pavel Emelyanov; +Cc: David S. Miller, netdev On Mon, 26 May 2008 11:39:21 +0400 Pavel Emelyanov <xemul@openvz.org> wrote: > Stephen Hemminger wrote: > > It look like the code to setup /proc/sys/net/ipv4/conf/XXX has an off by one bug > > that causes the last entry (arp_accept) not to be adjusted properly. This causes > > changes to the value to occur in the default namespace not the clone? Don't use > > network namespaces myself, but this looks like a bug. > > > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> > > > > --- a/net/ipv4/devinet.c 2008-05-23 15:23:19.000000000 -0700 > > +++ b/net/ipv4/devinet.c 2008-05-23 15:29:17.000000000 -0700 > > @@ -1466,7 +1466,7 @@ static int __devinet_sysctl_register(str > > if (!t) > > goto out; > > > > - for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { > > + for (i = 0; i < ARRAY_SIZE(t->devinet_vars); i++) { > > t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; > > t->devinet_vars[i].extra1 = p; > > t->devinet_vars[i].extra2 = net; > > > > This off-by-one is required, since the very last element of this array > is used as a sentinel, that shows sysctl engine when to stop processing > the table. > > Look, the sizeof(t->devinet_vars) is __NET_IPV4_CONF_MAX == 22, thus > entries 0, 1, ... 20 are tables and the 21-st is this sentinel, so the > initialization of this last entry, whose index is (this_sizeof() - 1), > is not required. > > Thanks, > Pavel okay, so that means there is one extra entry in the vars than needed? which is harmless. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-27 18:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20080523153559.156a1fb5@speedy>
2008-05-26 5:51 ` [PATCH] devinet: sysctl setup off by one David Miller
2008-05-26 7:39 ` Pavel Emelyanov
2008-05-27 18:39 ` Stephen Hemminger
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).