diff mbox series

[net,1/1] neigh: send protocol value in neighbor create notification

Message ID 1588383258-11049-1-git-send-email-mrv@mojatatu.com
State Accepted
Delegated to: David Miller
Headers show
Series [net,1/1] neigh: send protocol value in neighbor create notification | expand

Commit Message

Roman Mashak May 2, 2020, 1:34 a.m. UTC
When a new neighbor entry has been added, event is generated but it does not
include protocol, because its value is assigned after the event notification
routine has run, so move protocol assignment code earlier.

Fixes: df9b0e30d44c ("neighbor: Add protocol attribute")
Cc: David Ahern <dsahern@gmail.com>
Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 net/core/neighbour.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

David Ahern May 5, 2020, 5 p.m. UTC | #1
On 5/1/20 7:34 PM, Roman Mashak wrote:
> When a new neighbor entry has been added, event is generated but it does not
> include protocol, because its value is assigned after the event notification
> routine has run, so move protocol assignment code earlier.
> 
> Fixes: df9b0e30d44c ("neighbor: Add protocol attribute")
> Cc: David Ahern <dsahern@gmail.com>
> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
> ---
>  net/core/neighbour.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 



Reviewed-by: David Ahern <dsahern@gmail.com>
David Miller May 5, 2020, 8:40 p.m. UTC | #2
From: David Ahern <dsahern@gmail.com>
Date: Tue, 5 May 2020 11:00:47 -0600

> On 5/1/20 7:34 PM, Roman Mashak wrote:
>> When a new neighbor entry has been added, event is generated but it does not
>> include protocol, because its value is assigned after the event notification
>> routine has run, so move protocol assignment code earlier.
>> 
>> Fixes: df9b0e30d44c ("neighbor: Add protocol attribute")
>> Cc: David Ahern <dsahern@gmail.com>
>> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
>> ---
>>  net/core/neighbour.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> Reviewed-by: David Ahern <dsahern@gmail.com>

Applied and queued up for -stable, thanks everyone.
diff mbox series

Patch

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 39d37d0ef575..116139233d57 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1956,6 +1956,9 @@  static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh,
 				   NEIGH_UPDATE_F_OVERRIDE_ISROUTER);
 	}
 
+	if (protocol)
+		neigh->protocol = protocol;
+
 	if (ndm->ndm_flags & NTF_EXT_LEARNED)
 		flags |= NEIGH_UPDATE_F_EXT_LEARNED;
 
@@ -1969,9 +1972,6 @@  static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh,
 		err = __neigh_update(neigh, lladdr, ndm->ndm_state, flags,
 				     NETLINK_CB(skb).portid, extack);
 
-	if (protocol)
-		neigh->protocol = protocol;
-
 	neigh_release(neigh);
 
 out: