]> git.baikalelectronics.ru Git - kernel.git/commitdiff
neighbour: allow admin to set NTF_ROUTER
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Sun, 23 Sep 2018 04:26:19 +0000 (21:26 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Sep 2018 19:21:32 +0000 (12:21 -0700)
This patch allows admin setting of NTF_ROUTER flag
on a neighbour entry. This enables external control
plane (like bgp evpn) to manage neigh entries with
NTF_ROUTER flag.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/neighbour.c

index 91592fceeaad7225ed695aebef01fbc1fa4e284b..0e1cad89184f67436522cd1a5b9443c9aa53090f 100644 (file)
@@ -1712,7 +1712,8 @@ out:
 static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh,
                     struct netlink_ext_ack *extack)
 {
-       int flags = NEIGH_UPDATE_F_ADMIN | NEIGH_UPDATE_F_OVERRIDE;
+       int flags = NEIGH_UPDATE_F_ADMIN | NEIGH_UPDATE_F_OVERRIDE |
+               NEIGH_UPDATE_F_OVERRIDE_ISROUTER;
        struct net *net = sock_net(skb->sk);
        struct ndmsg *ndm;
        struct nlattr *tb[NDA_MAX+1];
@@ -1787,12 +1788,16 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh,
                }
 
                if (!(nlh->nlmsg_flags & NLM_F_REPLACE))
-                       flags &= ~NEIGH_UPDATE_F_OVERRIDE;
+                       flags &= ~(NEIGH_UPDATE_F_OVERRIDE |
+                                  NEIGH_UPDATE_F_OVERRIDE_ISROUTER);
        }
 
        if (ndm->ndm_flags & NTF_EXT_LEARNED)
                flags |= NEIGH_UPDATE_F_EXT_LEARNED;
 
+       if (ndm->ndm_flags & NTF_ROUTER)
+               flags |= NEIGH_UPDATE_F_ISROUTER;
+
        if (ndm->ndm_flags & NTF_USE) {
                neigh_event_send(neigh, NULL);
                err = 0;