netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: neigh: Fix netevent NETEVENT_DELAY_PROBE_TIME_UPDATE notification
@ 2017-02-15  0:00 Marcus Huewe
  2017-02-15  6:59 ` Ido Schimmel
  0 siblings, 1 reply; 3+ messages in thread
From: Marcus Huewe @ 2017-02-15  0:00 UTC (permalink / raw)
  To: davem; +Cc: netdev

When setting a neigh related sysctl parameter, we always send a
NETEVENT_DELAY_PROBE_TIME_UPDATE netevent. For instance, when
executing

	sysctl net.ipv6.neigh.wlp3s0.retrans_time_ms=2000

a NETEVENT_DELAY_PROBE_TIME_UPDATE netevent is generated.

This is caused by commit 2a4501ae18b5 ("neigh: Send a
notification when DELAY_PROBE_TIME changes"). According to the
commit's description, it was intended to generate such an event
when setting the "delay_first_probe_time" sysctl parameter.

In order to fix this, only generate this event when actually
setting the "delay_first_probe_time" sysctl parameter. This fix
should not have any unintended side-effects, because all but one
registered netevent callbacks check for other netevent event
types (the registered callbacks were obtained by grepping for
"register_netevent_notifier"). The only callback that uses the
NETEVENT_DELAY_PROBE_TIME_UPDATE event is
mlxsw_sp_router_netevent_event() (in
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c): in case
of this event, it only accesses the DELAY_PROBE_TIME of the
passed neigh_parms.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
---
 net/core/neighbour.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 7bb12e07ffef..e7c12caa20c8 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2923,7 +2923,8 @@ static void neigh_proc_update(struct ctl_table *ctl, int write)
 		return;
 
 	set_bit(index, p->data_state);
-	call_netevent_notifiers(NETEVENT_DELAY_PROBE_TIME_UPDATE, p);
+	if (index == NEIGH_VAR_DELAY_PROBE_TIME)
+		call_netevent_notifiers(NETEVENT_DELAY_PROBE_TIME_UPDATE, p);
 	if (!dev) /* NULL dev means this is default value */
 		neigh_copy_dflt_parms(net, p, index);
 }
-- 
2.11.0

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

* Re: [PATCH net] net: neigh: Fix netevent NETEVENT_DELAY_PROBE_TIME_UPDATE notification
  2017-02-15  0:00 [PATCH net] net: neigh: Fix netevent NETEVENT_DELAY_PROBE_TIME_UPDATE notification Marcus Huewe
@ 2017-02-15  6:59 ` Ido Schimmel
  2017-02-15 17:39   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Ido Schimmel @ 2017-02-15  6:59 UTC (permalink / raw)
  To: Marcus Huewe; +Cc: davem, netdev

On Wed, Feb 15, 2017 at 01:00:36AM +0100, Marcus Huewe wrote:
> When setting a neigh related sysctl parameter, we always send a
> NETEVENT_DELAY_PROBE_TIME_UPDATE netevent. For instance, when
> executing
> 
> 	sysctl net.ipv6.neigh.wlp3s0.retrans_time_ms=2000
> 
> a NETEVENT_DELAY_PROBE_TIME_UPDATE netevent is generated.
> 
> This is caused by commit 2a4501ae18b5 ("neigh: Send a
> notification when DELAY_PROBE_TIME changes"). According to the
> commit's description, it was intended to generate such an event
> when setting the "delay_first_probe_time" sysctl parameter.
> 
> In order to fix this, only generate this event when actually
> setting the "delay_first_probe_time" sysctl parameter. This fix
> should not have any unintended side-effects, because all but one
> registered netevent callbacks check for other netevent event
> types (the registered callbacks were obtained by grepping for
> "register_netevent_notifier"). The only callback that uses the
> NETEVENT_DELAY_PROBE_TIME_UPDATE event is
> mlxsw_sp_router_netevent_event() (in
> drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c): in case
> of this event, it only accesses the DELAY_PROBE_TIME of the
> passed neigh_parms.
> 
> Signed-off-by: Marcus Huewe <suse-tux@gmx.de>

Fixes: 2a4501ae18b5 ("neigh: Send a notification when DELAY_PROBE_TIME changes")
Reviewed-by: Ido Schimmel <idosch@mellanox.com>

Next time, please Cc the author of the commit you're referring to in
your patch.

Thanks!

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

* Re: [PATCH net] net: neigh: Fix netevent NETEVENT_DELAY_PROBE_TIME_UPDATE notification
  2017-02-15  6:59 ` Ido Schimmel
@ 2017-02-15 17:39   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2017-02-15 17:39 UTC (permalink / raw)
  To: idosch; +Cc: suse-tux, netdev

From: Ido Schimmel <idosch@idosch.org>
Date: Wed, 15 Feb 2017 08:59:25 +0200

> On Wed, Feb 15, 2017 at 01:00:36AM +0100, Marcus Huewe wrote:
>> When setting a neigh related sysctl parameter, we always send a
>> NETEVENT_DELAY_PROBE_TIME_UPDATE netevent. For instance, when
>> executing
>> 
>> 	sysctl net.ipv6.neigh.wlp3s0.retrans_time_ms=2000
>> 
>> a NETEVENT_DELAY_PROBE_TIME_UPDATE netevent is generated.
>> 
>> This is caused by commit 2a4501ae18b5 ("neigh: Send a
>> notification when DELAY_PROBE_TIME changes"). According to the
>> commit's description, it was intended to generate such an event
>> when setting the "delay_first_probe_time" sysctl parameter.
>> 
>> In order to fix this, only generate this event when actually
>> setting the "delay_first_probe_time" sysctl parameter. This fix
>> should not have any unintended side-effects, because all but one
>> registered netevent callbacks check for other netevent event
>> types (the registered callbacks were obtained by grepping for
>> "register_netevent_notifier"). The only callback that uses the
>> NETEVENT_DELAY_PROBE_TIME_UPDATE event is
>> mlxsw_sp_router_netevent_event() (in
>> drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c): in case
>> of this event, it only accesses the DELAY_PROBE_TIME of the
>> passed neigh_parms.
>> 
>> Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
> 
> Fixes: 2a4501ae18b5 ("neigh: Send a notification when DELAY_PROBE_TIME changes")
> Reviewed-by: Ido Schimmel <idosch@mellanox.com>

Applied and queued up for -stable, thanks everyone.

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

end of thread, other threads:[~2017-02-15 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-15  0:00 [PATCH net] net: neigh: Fix netevent NETEVENT_DELAY_PROBE_TIME_UPDATE notification Marcus Huewe
2017-02-15  6:59 ` Ido Schimmel
2017-02-15 17:39   ` David Miller

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).