]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: add kernel neigh update api
authorChirag Shah <chirag@cumulusnetworks.com>
Mon, 28 Jan 2019 23:32:45 +0000 (15:32 -0800)
committerChirag Shah <chirag@cumulusnetworks.com>
Tue, 29 Jan 2019 16:02:29 +0000 (08:02 -0800)
The kernel neigh update api helps update neighbor entry,
using changing state and flags parameters.

Ticket:CM-22864
Reviewed By:
Testing Done:

Signed-off-by:Chirag Shah <chirag@cumulusnetworks.com>

zebra/rt.h
zebra/rt_netlink.c

index 0b14a3ef36e6d82bada50e7f145b45632e0de713..6d12d8ea2eb360f5efe42348d3cda0a531a5bd52 100644 (file)
@@ -67,6 +67,8 @@ extern int kernel_del_mac(struct interface *ifp, vlanid_t vid,
 extern int kernel_add_neigh(struct interface *ifp, struct ipaddr *ip,
                            struct ethaddr *mac, uint8_t flags);
 extern int kernel_del_neigh(struct interface *ifp, struct ipaddr *ip);
+extern int kernel_upd_neigh(struct interface *ifp, struct ipaddr *ip,
+                           struct ethaddr *mac, uint8_t flags, uint16_t state);
 
 /*
  * Southbound Initialization routines to get initial starting
index ce2d25862d0695d3f23b9be6475a36639100fd5c..fce09ba92d079eded2276ef254a98f6540ab4221 100644 (file)
@@ -2713,12 +2713,12 @@ static int netlink_neigh_update2(struct interface *ifp, struct ipaddr *ip,
                addattr_l(&req.n, sizeof(req), NDA_LLADDR, mac, 6);
 
        if (IS_ZEBRA_DEBUG_KERNEL)
-               zlog_debug("Tx %s family %s IF %s(%u) Neigh %s MAC %s flags 0x%x",
+               zlog_debug("Tx %s family %s IF %s(%u) Neigh %s MAC %s flags 0x%x state 0x%x",
                           nl_msg_type_to_str(cmd),
                           nl_family_to_str(req.ndm.ndm_family), ifp->name,
                           ifp->ifindex, ipaddr2str(ip, buf, sizeof(buf)),
                           mac ? prefix_mac2str(mac, buf2, sizeof(buf2))
-                              : "null", flags);
+                              : "null", flags, state);
 
        return netlink_talk(netlink_talk_filter, &req.n, &zns->netlink_cmd, zns,
                            0);
@@ -2749,6 +2749,13 @@ int kernel_del_neigh(struct interface *ifp, struct ipaddr *ip)
        return netlink_neigh_update2(ifp, ip, NULL, 0, 0, RTM_DELNEIGH);
 }
 
+int kernel_upd_neigh(struct interface *ifp, struct ipaddr *ip,
+                    struct ethaddr *mac, uint8_t flags, uint16_t state)
+{
+       return netlink_neigh_update2(ifp, ip, mac, flags,
+                                    state, RTM_NEWNEIGH);
+}
+
 /*
  * MPLS label forwarding table change via netlink interface, using dataplane
  * context information.