zebra: add kernel neigh update api

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>
This commit is contained in:
Chirag Shah 2019-01-28 15:32:45 -08:00
parent 185fd9ca77
commit 6fe2b0e67f
2 changed files with 11 additions and 2 deletions

View 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

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