forked from Mirror/frr
zebra: debug flags for MAC-IP sync
Filters for zebra debug logs. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
This commit is contained in:
parent
5e4d4c8aa4
commit
f188e68e5c
|
@ -116,6 +116,12 @@ DEFUN_NOSH (show_debugging_zebra,
|
||||||
if (IS_ZEBRA_DEBUG_EVPN_MH_NH)
|
if (IS_ZEBRA_DEBUG_EVPN_MH_NH)
|
||||||
vty_out(vty, " Zebra EVPN-MH nexthop debugging is on\n");
|
vty_out(vty, " Zebra EVPN-MH nexthop debugging is on\n");
|
||||||
|
|
||||||
|
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC)
|
||||||
|
vty_out(vty, " Zebra EVPN-MH MAC debugging is on\n");
|
||||||
|
|
||||||
|
if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH)
|
||||||
|
vty_out(vty, " Zebra EVPN-MH Neigh debugging is on\n");
|
||||||
|
|
||||||
hook_call(zebra_debug_show_debugging, vty);
|
hook_call(zebra_debug_show_debugging, vty);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -329,13 +335,15 @@ DEFPY (debug_zebra_mlag,
|
||||||
|
|
||||||
DEFPY (debug_zebra_evpn_mh,
|
DEFPY (debug_zebra_evpn_mh,
|
||||||
debug_zebra_evpn_mh_cmd,
|
debug_zebra_evpn_mh_cmd,
|
||||||
"[no$no] debug zebra evpn mh <es$es|nh$nh>",
|
"[no$no] debug zebra evpn mh <es$es|mac$mac|neigh$neigh|nh$nh>",
|
||||||
NO_STR
|
NO_STR
|
||||||
DEBUG_STR
|
DEBUG_STR
|
||||||
"Zebra configuration\n"
|
"Zebra configuration\n"
|
||||||
"EVPN\n"
|
"EVPN\n"
|
||||||
"Multihoming\n"
|
"Multihoming\n"
|
||||||
"Ethernet Segment Debugging\n"
|
"Ethernet Segment Debugging\n"
|
||||||
|
"MAC Debugging\n"
|
||||||
|
"Neigh Debugging\n"
|
||||||
"Nexthop Debugging\n")
|
"Nexthop Debugging\n")
|
||||||
{
|
{
|
||||||
if (es) {
|
if (es) {
|
||||||
|
@ -345,6 +353,23 @@ DEFPY (debug_zebra_evpn_mh,
|
||||||
SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_ES);
|
SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_ES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mac) {
|
||||||
|
if (no)
|
||||||
|
UNSET_FLAG(zebra_debug_evpn_mh,
|
||||||
|
ZEBRA_DEBUG_EVPN_MH_MAC);
|
||||||
|
else
|
||||||
|
SET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_MAC);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (neigh) {
|
||||||
|
if (no)
|
||||||
|
UNSET_FLAG(zebra_debug_evpn_mh,
|
||||||
|
ZEBRA_DEBUG_EVPN_MH_NEIGH);
|
||||||
|
else
|
||||||
|
SET_FLAG(zebra_debug_evpn_mh,
|
||||||
|
ZEBRA_DEBUG_EVPN_MH_NEIGH);
|
||||||
|
}
|
||||||
|
|
||||||
if (nh) {
|
if (nh) {
|
||||||
if (no)
|
if (no)
|
||||||
UNSET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_NH);
|
UNSET_FLAG(zebra_debug_evpn_mh, ZEBRA_DEBUG_EVPN_MH_NH);
|
||||||
|
@ -596,6 +621,14 @@ static int config_write_debug(struct vty *vty)
|
||||||
vty_out(vty, "debug zebra evpn mh nh\n");
|
vty_out(vty, "debug zebra evpn mh nh\n");
|
||||||
write++;
|
write++;
|
||||||
}
|
}
|
||||||
|
if (IS_ZEBRA_DEBUG_EVPN_MH_MAC) {
|
||||||
|
vty_out(vty, "debug zebra evpn mh mac\n");
|
||||||
|
write++;
|
||||||
|
}
|
||||||
|
if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) {
|
||||||
|
vty_out(vty, "debug zebra evpn mh neigh\n");
|
||||||
|
write++;
|
||||||
|
}
|
||||||
if (IS_ZEBRA_DEBUG_PW) {
|
if (IS_ZEBRA_DEBUG_PW) {
|
||||||
vty_out(vty, "debug zebra pseudowires\n");
|
vty_out(vty, "debug zebra pseudowires\n");
|
||||||
write++;
|
write++;
|
||||||
|
|
|
@ -64,6 +64,8 @@ extern "C" {
|
||||||
|
|
||||||
#define ZEBRA_DEBUG_EVPN_MH_ES 0x01
|
#define ZEBRA_DEBUG_EVPN_MH_ES 0x01
|
||||||
#define ZEBRA_DEBUG_EVPN_MH_NH 0x02
|
#define ZEBRA_DEBUG_EVPN_MH_NH 0x02
|
||||||
|
#define ZEBRA_DEBUG_EVPN_MH_MAC 0x04
|
||||||
|
#define ZEBRA_DEBUG_EVPN_MH_NEIGH 0x08
|
||||||
|
|
||||||
/* Debug related macro. */
|
/* Debug related macro. */
|
||||||
#define IS_ZEBRA_DEBUG_EVENT (zebra_debug_event & ZEBRA_DEBUG_EVENT)
|
#define IS_ZEBRA_DEBUG_EVENT (zebra_debug_event & ZEBRA_DEBUG_EVENT)
|
||||||
|
@ -103,8 +105,14 @@ extern "C" {
|
||||||
#define IS_ZEBRA_DEBUG_NHG_DETAIL \
|
#define IS_ZEBRA_DEBUG_NHG_DETAIL \
|
||||||
(zebra_debug_nexthop & ZEBRA_DEBUG_NHG_DETAILED)
|
(zebra_debug_nexthop & ZEBRA_DEBUG_NHG_DETAILED)
|
||||||
|
|
||||||
#define IS_ZEBRA_DEBUG_EVPN_MH_ES (zebra_debug_evpn_mh & ZEBRA_DEBUG_EVPN_MH_ES)
|
#define IS_ZEBRA_DEBUG_EVPN_MH_ES \
|
||||||
#define IS_ZEBRA_DEBUG_EVPN_MH_NH (zebra_debug_evpn_mh & ZEBRA_DEBUG_EVPN_MH_NH)
|
(zebra_debug_evpn_mh & ZEBRA_DEBUG_EVPN_MH_ES)
|
||||||
|
#define IS_ZEBRA_DEBUG_EVPN_MH_NH \
|
||||||
|
(zebra_debug_evpn_mh & ZEBRA_DEBUG_EVPN_MH_NH)
|
||||||
|
#define IS_ZEBRA_DEBUG_EVPN_MH_MAC \
|
||||||
|
(zebra_debug_evpn_mh & ZEBRA_DEBUG_EVPN_MH_MAC)
|
||||||
|
#define IS_ZEBRA_DEBUG_EVPN_MH_NEIGH \
|
||||||
|
(zebra_debug_evpn_mh & ZEBRA_DEBUG_EVPN_MH_NEIGH)
|
||||||
|
|
||||||
extern unsigned long zebra_debug_event;
|
extern unsigned long zebra_debug_event;
|
||||||
extern unsigned long zebra_debug_packet;
|
extern unsigned long zebra_debug_packet;
|
||||||
|
|
|
@ -1015,7 +1015,8 @@ static void fpm_enqueue_rmac_table(struct hash_bucket *backet, void *arg)
|
||||||
dplane_ctx_set_op(fra->ctx, DPLANE_OP_MAC_INSTALL);
|
dplane_ctx_set_op(fra->ctx, DPLANE_OP_MAC_INSTALL);
|
||||||
dplane_mac_init(fra->ctx, fra->zl3vni->vxlan_if,
|
dplane_mac_init(fra->ctx, fra->zl3vni->vxlan_if,
|
||||||
zif->brslave_info.br_if, vid,
|
zif->brslave_info.br_if, vid,
|
||||||
&zrmac->macaddr, zrmac->fwd_info.r_vtep_ip, sticky);
|
&zrmac->macaddr, zrmac->fwd_info.r_vtep_ip, sticky,
|
||||||
|
0 /*nhg*/, 0 /*update_flags*/);
|
||||||
if (fpm_nl_enqueue(fra->fnc, fra->ctx) == -1) {
|
if (fpm_nl_enqueue(fra->fnc, fra->ctx) == -1) {
|
||||||
thread_add_timer(zrouter.master, fpm_rmac_send,
|
thread_add_timer(zrouter.master, fpm_rmac_send,
|
||||||
fra->fnc, 1, &fra->fnc->t_rmacwalk);
|
fra->fnc, 1, &fra->fnc->t_rmacwalk);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#ifdef HAVE_NETLINK
|
#ifdef HAVE_NETLINK
|
||||||
|
|
||||||
#include <net/if_arp.h>
|
#include <net/if_arp.h>
|
||||||
|
#include <linux/if_bridge.h>
|
||||||
#include <linux/lwtunnel.h>
|
#include <linux/lwtunnel.h>
|
||||||
#include <linux/mpls_iptunnel.h>
|
#include <linux/mpls_iptunnel.h>
|
||||||
#include <linux/neighbour.h>
|
#include <linux/neighbour.h>
|
||||||
|
@ -2687,6 +2688,7 @@ static ssize_t netlink_neigh_update_msg_encode(
|
||||||
const struct zebra_dplane_ctx *ctx, int cmd, const struct ethaddr *mac,
|
const struct zebra_dplane_ctx *ctx, int cmd, const struct ethaddr *mac,
|
||||||
const struct ipaddr *ip, bool replace_obj, uint8_t family, uint8_t type,
|
const struct ipaddr *ip, bool replace_obj, uint8_t family, uint8_t type,
|
||||||
uint8_t flags, uint16_t state, uint32_t nhg_id,
|
uint8_t flags, uint16_t state, uint32_t nhg_id,
|
||||||
|
bool nfy, uint8_t nfy_flags,
|
||||||
void *data, size_t datalen)
|
void *data, size_t datalen)
|
||||||
{
|
{
|
||||||
uint8_t protocol = RTPROT_ZEBRA;
|
uint8_t protocol = RTPROT_ZEBRA;
|
||||||
|
@ -2730,6 +2732,11 @@ static ssize_t netlink_neigh_update_msg_encode(
|
||||||
if (!nl_attr_put32(&req->n, datalen, NDA_NH_ID, nhg_id))
|
if (!nl_attr_put32(&req->n, datalen, NDA_NH_ID, nhg_id))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (nfy) {
|
||||||
|
if (!nl_attr_put32(&req->n, datalen, NDA_NOTIFY,
|
||||||
|
&nfy_flags, sizeof(nfy_flags)))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ipa_len = IS_IPADDR_V4(ip) ? IPV4_MAX_BYTELEN : IPV6_MAX_BYTELEN;
|
ipa_len = IS_IPADDR_V4(ip) ? IPV4_MAX_BYTELEN : IPV6_MAX_BYTELEN;
|
||||||
if (!nl_attr_put(&req->n, datalen, NDA_DST, &ip->ip.addr, ipa_len))
|
if (!nl_attr_put(&req->n, datalen, NDA_DST, &ip->ip.addr, ipa_len))
|
||||||
|
@ -2764,7 +2771,8 @@ static int netlink_vxlan_flood_update_ctx(const struct zebra_dplane_ctx *ctx,
|
||||||
if (netlink_neigh_update_msg_encode(
|
if (netlink_neigh_update_msg_encode(
|
||||||
ctx, cmd, &dst_mac, dplane_ctx_neigh_get_ipaddr(ctx), false,
|
ctx, cmd, &dst_mac, dplane_ctx_neigh_get_ipaddr(ctx), false,
|
||||||
PF_BRIDGE, 0, NTF_SELF, (NUD_NOARP | NUD_PERMANENT),
|
PF_BRIDGE, 0, NTF_SELF, (NUD_NOARP | NUD_PERMANENT),
|
||||||
0 /*nhg*/, nl_pkt, sizeof(nl_pkt))
|
0 /*nhg*/, false /*nfy*/, 0 /*nfy_flags*/,
|
||||||
|
nl_pkt, sizeof(nl_pkt))
|
||||||
<= 0)
|
<= 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -2793,6 +2801,9 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
|
||||||
char vid_buf[20];
|
char vid_buf[20];
|
||||||
char dst_buf[30];
|
char dst_buf[30];
|
||||||
bool sticky;
|
bool sticky;
|
||||||
|
bool local_inactive = false;
|
||||||
|
bool dp_static = false;
|
||||||
|
uint32_t nhg_id = 0;
|
||||||
|
|
||||||
ndm = NLMSG_DATA(h);
|
ndm = NLMSG_DATA(h);
|
||||||
|
|
||||||
|
@ -2840,13 +2851,29 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
|
||||||
inet_ntoa(vtep_ip));
|
inet_ntoa(vtep_ip));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tb[NDA_NH_ID])
|
||||||
|
nhg_id = *(uint32_t *)RTA_DATA(tb[NDA_NH_ID]);
|
||||||
|
|
||||||
|
if (ndm->ndm_state & NUD_STALE)
|
||||||
|
local_inactive = true;
|
||||||
|
|
||||||
|
if (tb[NDA_NOTIFY]) {
|
||||||
|
uint8_t nfy_flags;
|
||||||
|
|
||||||
|
dp_static = true;
|
||||||
|
nfy_flags = *(uint8_t *)RTA_DATA(tb[NDA_NOTIFY]);
|
||||||
|
/* local activity has not been detected on the entry */
|
||||||
|
if (nfy_flags & (1 << BR_FDB_NFY_INACTIVE))
|
||||||
|
local_inactive = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (IS_ZEBRA_DEBUG_KERNEL)
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
zlog_debug("Rx %s AF_BRIDGE IF %u%s st 0x%x fl 0x%x MAC %s%s",
|
zlog_debug("Rx %s AF_BRIDGE IF %u%s st 0x%x fl 0x%x MAC %s%s nhg %d",
|
||||||
nl_msg_type_to_str(h->nlmsg_type),
|
nl_msg_type_to_str(h->nlmsg_type),
|
||||||
ndm->ndm_ifindex, vid_present ? vid_buf : "",
|
ndm->ndm_ifindex, vid_present ? vid_buf : "",
|
||||||
ndm->ndm_state, ndm->ndm_flags,
|
ndm->ndm_state, ndm->ndm_flags,
|
||||||
prefix_mac2str(&mac, buf, sizeof(buf)),
|
prefix_mac2str(&mac, buf, sizeof(buf)),
|
||||||
dst_present ? dst_buf : "");
|
dst_present ? dst_buf : "", nhg_id);
|
||||||
|
|
||||||
/* The interface should exist. */
|
/* The interface should exist. */
|
||||||
ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id),
|
ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id),
|
||||||
|
@ -2869,7 +2896,7 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sticky = !!(ndm->ndm_state & NUD_NOARP);
|
sticky = !!(ndm->ndm_flags & NTF_STICKY);
|
||||||
|
|
||||||
if (filter_vlan && vid != filter_vlan) {
|
if (filter_vlan && vid != filter_vlan) {
|
||||||
if (IS_ZEBRA_DEBUG_KERNEL)
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
|
@ -2897,7 +2924,7 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
|
||||||
vid);
|
vid);
|
||||||
|
|
||||||
return zebra_vxlan_local_mac_add_update(ifp, br_if, &mac, vid,
|
return zebra_vxlan_local_mac_add_update(ifp, br_if, &mac, vid,
|
||||||
sticky);
|
sticky, local_inactive, dp_static);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a delete notification.
|
/* This is a delete notification.
|
||||||
|
@ -2910,6 +2937,9 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
|
||||||
* Note: We will get notifications from both bridge driver and VxLAN
|
* Note: We will get notifications from both bridge driver and VxLAN
|
||||||
* driver.
|
* driver.
|
||||||
*/
|
*/
|
||||||
|
if (nhg_id)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (dst_present) {
|
if (dst_present) {
|
||||||
u_char zero_mac[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
|
u_char zero_mac[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
|
||||||
|
|
||||||
|
@ -3108,17 +3138,40 @@ netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx, uint8_t *data,
|
||||||
uint8_t flags;
|
uint8_t flags;
|
||||||
uint16_t state;
|
uint16_t state;
|
||||||
uint32_t nhg_id;
|
uint32_t nhg_id;
|
||||||
|
uint32_t update_flags;
|
||||||
|
bool nfy = false;
|
||||||
|
uint8_t nfy_flags = 0;
|
||||||
|
|
||||||
cmd = dplane_ctx_get_op(ctx) == DPLANE_OP_MAC_INSTALL
|
cmd = dplane_ctx_get_op(ctx) == DPLANE_OP_MAC_INSTALL
|
||||||
? RTM_NEWNEIGH : RTM_DELNEIGH;
|
? RTM_NEWNEIGH : RTM_DELNEIGH;
|
||||||
|
|
||||||
flags = (NTF_SELF | NTF_MASTER);
|
flags = NTF_MASTER;
|
||||||
state = NUD_REACHABLE;
|
state = NUD_REACHABLE;
|
||||||
|
|
||||||
if (dplane_ctx_mac_is_sticky(ctx))
|
update_flags = dplane_ctx_mac_get_update_flags(ctx);
|
||||||
state |= NUD_NOARP;
|
if (update_flags & DPLANE_MAC_REMOTE) {
|
||||||
else
|
flags |= NTF_SELF;
|
||||||
flags |= NTF_EXT_LEARNED;
|
if (dplane_ctx_mac_is_sticky(ctx))
|
||||||
|
flags |= NTF_STICKY;
|
||||||
|
else
|
||||||
|
flags |= NTF_EXT_LEARNED;
|
||||||
|
/* if it was static-local previously we need to clear the
|
||||||
|
* notify flags on replace with remote
|
||||||
|
*/
|
||||||
|
if (update_flags & DPLANE_MAC_WAS_STATIC)
|
||||||
|
nfy = true;
|
||||||
|
} else {
|
||||||
|
/* local mac */
|
||||||
|
if (update_flags & DPLANE_MAC_SET_STATIC) {
|
||||||
|
nfy_flags |= (1 << BR_FDB_NFY_STATIC);
|
||||||
|
state |= NUD_NOARP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (update_flags & DPLANE_MAC_SET_INACTIVE)
|
||||||
|
nfy_flags |= (1 << BR_FDB_NFY_INACTIVE);
|
||||||
|
|
||||||
|
nfy = true;
|
||||||
|
}
|
||||||
|
|
||||||
nhg_id = dplane_ctx_mac_get_nhg_id(ctx);
|
nhg_id = dplane_ctx_mac_get_nhg_id(ctx);
|
||||||
vtep_ip.ipaddr_v4 = *(dplane_ctx_mac_get_vtep_ip(ctx));
|
vtep_ip.ipaddr_v4 = *(dplane_ctx_mac_get_vtep_ip(ctx));
|
||||||
|
@ -3136,19 +3189,30 @@ netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx, uint8_t *data,
|
||||||
else
|
else
|
||||||
vid_buf[0] = '\0';
|
vid_buf[0] = '\0';
|
||||||
|
|
||||||
zlog_debug("Tx %s family %s IF %s(%u)%s %sMAC %s dst %s nhg %u",
|
zlog_debug("Tx %s family %s IF %s(%u)%s %sMAC %s dst %s nhg %u%s%s%s%s%s",
|
||||||
nl_msg_type_to_str(cmd), nl_family_to_str(AF_BRIDGE),
|
nl_msg_type_to_str(cmd), nl_family_to_str(AF_BRIDGE),
|
||||||
dplane_ctx_get_ifname(ctx),
|
dplane_ctx_get_ifname(ctx),
|
||||||
dplane_ctx_get_ifindex(ctx), vid_buf,
|
dplane_ctx_get_ifindex(ctx), vid_buf,
|
||||||
dplane_ctx_mac_is_sticky(ctx) ? "sticky " : "",
|
dplane_ctx_mac_is_sticky(ctx) ? "sticky " : "",
|
||||||
prefix_mac2str(mac, buf, sizeof(buf)),
|
prefix_mac2str(mac, buf, sizeof(buf)),
|
||||||
ipaddr2str(&vtep_ip, ipbuf, sizeof(ipbuf)),
|
ipaddr2str(&vtep_ip, ipbuf, sizeof(ipbuf)),
|
||||||
nhg_id);
|
nhg_id,
|
||||||
|
(update_flags &
|
||||||
|
DPLANE_MAC_REMOTE) ? " rem" : "",
|
||||||
|
(update_flags &
|
||||||
|
DPLANE_MAC_WAS_STATIC) ? " clr_sync" : "",
|
||||||
|
(update_flags &
|
||||||
|
DPLANE_MAC_SET_STATIC) ? " static" : "",
|
||||||
|
(update_flags &
|
||||||
|
DPLANE_MAC_SET_INACTIVE) ? " inactive" : "",
|
||||||
|
(nfy &
|
||||||
|
DPLANE_MAC_SET_INACTIVE) ? " nfy" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
total = netlink_neigh_update_msg_encode(
|
total = netlink_neigh_update_msg_encode(
|
||||||
ctx, cmd, dplane_ctx_mac_get_addr(ctx), &vtep_ip, true,
|
ctx, cmd, dplane_ctx_mac_get_addr(ctx), &vtep_ip, true,
|
||||||
AF_BRIDGE, 0, flags, state, nhg_id, data, datalen);
|
AF_BRIDGE, 0, flags, state, nhg_id, nfy, nfy_flags,
|
||||||
|
data, datalen);
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
@ -3182,6 +3246,8 @@ static void netlink_handle_5549(struct ndmsg *ndm, struct zebra_if *zif,
|
||||||
#define NUD_VALID \
|
#define NUD_VALID \
|
||||||
(NUD_PERMANENT | NUD_NOARP | NUD_REACHABLE | NUD_PROBE | NUD_STALE \
|
(NUD_PERMANENT | NUD_NOARP | NUD_REACHABLE | NUD_PROBE | NUD_STALE \
|
||||||
| NUD_DELAY)
|
| NUD_DELAY)
|
||||||
|
#define NUD_LOCAL_ACTIVE \
|
||||||
|
(NUD_PERMANENT | NUD_NOARP | NUD_REACHABLE)
|
||||||
|
|
||||||
static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
|
static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
|
||||||
{
|
{
|
||||||
|
@ -3198,6 +3264,7 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
|
||||||
int mac_present = 0;
|
int mac_present = 0;
|
||||||
bool is_ext;
|
bool is_ext;
|
||||||
bool is_router;
|
bool is_router;
|
||||||
|
bool local_inactive;
|
||||||
|
|
||||||
ndm = NLMSG_DATA(h);
|
ndm = NLMSG_DATA(h);
|
||||||
|
|
||||||
|
@ -3307,10 +3374,17 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
|
||||||
* result
|
* result
|
||||||
* in re-adding the neighbor if it is a valid "remote" neighbor.
|
* in re-adding the neighbor if it is a valid "remote" neighbor.
|
||||||
*/
|
*/
|
||||||
if (ndm->ndm_state & NUD_VALID)
|
if (ndm->ndm_state & NUD_VALID) {
|
||||||
|
local_inactive = !(ndm->ndm_state & NUD_LOCAL_ACTIVE);
|
||||||
|
|
||||||
|
/* XXX - populate dp-static based on the sync flags
|
||||||
|
* in the kernel
|
||||||
|
*/
|
||||||
return zebra_vxlan_handle_kernel_neigh_update(
|
return zebra_vxlan_handle_kernel_neigh_update(
|
||||||
ifp, link_if, &ip, &mac, ndm->ndm_state,
|
ifp, link_if, &ip, &mac, ndm->ndm_state,
|
||||||
is_ext, is_router);
|
is_ext, is_router, local_inactive,
|
||||||
|
false /* dp_static */);
|
||||||
|
}
|
||||||
|
|
||||||
return zebra_vxlan_handle_kernel_neigh_del(ifp, link_if, &ip);
|
return zebra_vxlan_handle_kernel_neigh_del(ifp, link_if, &ip);
|
||||||
}
|
}
|
||||||
|
@ -3565,8 +3639,9 @@ static int netlink_neigh_update_ctx(const struct zebra_dplane_ctx *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netlink_neigh_update_msg_encode(ctx, cmd, mac, ip, true, family,
|
if (netlink_neigh_update_msg_encode(ctx, cmd, mac, ip, true, family,
|
||||||
RTN_UNICAST, flags, state, nl_pkt,
|
RTN_UNICAST, flags, state,
|
||||||
sizeof(nl_pkt))
|
0 /*nhg*/, false /*nfy*/, 0 /*nfy_flags*/,
|
||||||
|
nl_pkt, sizeof(nl_pkt))
|
||||||
<= 0)
|
<= 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,7 @@ struct dplane_mac_info {
|
||||||
struct in_addr vtep_ip;
|
struct in_addr vtep_ip;
|
||||||
bool is_sticky;
|
bool is_sticky;
|
||||||
uint32_t nhg_id;
|
uint32_t nhg_id;
|
||||||
|
uint32_t update_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -191,6 +192,7 @@ struct dplane_neigh_info {
|
||||||
struct ethaddr mac;
|
struct ethaddr mac;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
uint16_t state;
|
uint16_t state;
|
||||||
|
uint32_t update_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -442,13 +444,14 @@ static enum zebra_dplane_result mac_update_common(
|
||||||
enum dplane_op_e op, const struct interface *ifp,
|
enum dplane_op_e op, const struct interface *ifp,
|
||||||
const struct interface *br_ifp,
|
const struct interface *br_ifp,
|
||||||
vlanid_t vid, const struct ethaddr *mac,
|
vlanid_t vid, const struct ethaddr *mac,
|
||||||
struct in_addr vtep_ip, bool sticky, uint32_t nhg_id);
|
struct in_addr vtep_ip, bool sticky, uint32_t nhg_id,
|
||||||
|
uint32_t update_flags);
|
||||||
static enum zebra_dplane_result neigh_update_internal(
|
static enum zebra_dplane_result neigh_update_internal(
|
||||||
enum dplane_op_e op,
|
enum dplane_op_e op,
|
||||||
const struct interface *ifp,
|
const struct interface *ifp,
|
||||||
const struct ethaddr *mac,
|
const struct ethaddr *mac,
|
||||||
const struct ipaddr *ip,
|
const struct ipaddr *ip,
|
||||||
uint32_t flags, uint16_t state);
|
uint32_t flags, uint16_t state, uint32_t update_flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public APIs
|
* Public APIs
|
||||||
|
@ -1559,6 +1562,12 @@ uint32_t dplane_ctx_mac_get_nhg_id(const struct zebra_dplane_ctx *ctx)
|
||||||
return ctx->u.macinfo.nhg_id;
|
return ctx->u.macinfo.nhg_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t dplane_ctx_mac_get_update_flags(const struct zebra_dplane_ctx *ctx)
|
||||||
|
{
|
||||||
|
DPLANE_CTX_VALID(ctx);
|
||||||
|
return ctx->u.macinfo.update_flags;
|
||||||
|
}
|
||||||
|
|
||||||
const struct ethaddr *dplane_ctx_mac_get_addr(
|
const struct ethaddr *dplane_ctx_mac_get_addr(
|
||||||
const struct zebra_dplane_ctx *ctx)
|
const struct zebra_dplane_ctx *ctx)
|
||||||
{
|
{
|
||||||
|
@ -1606,6 +1615,12 @@ uint16_t dplane_ctx_neigh_get_state(const struct zebra_dplane_ctx *ctx)
|
||||||
return ctx->u.neigh.state;
|
return ctx->u.neigh.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t dplane_ctx_neigh_get_update_flags(const struct zebra_dplane_ctx *ctx)
|
||||||
|
{
|
||||||
|
DPLANE_CTX_VALID(ctx);
|
||||||
|
return ctx->u.neigh.update_flags;
|
||||||
|
}
|
||||||
|
|
||||||
/* Accessors for PBR rule information */
|
/* Accessors for PBR rule information */
|
||||||
int dplane_ctx_rule_get_sock(const struct zebra_dplane_ctx *ctx)
|
int dplane_ctx_rule_get_sock(const struct zebra_dplane_ctx *ctx)
|
||||||
{
|
{
|
||||||
|
@ -2902,36 +2917,75 @@ static enum zebra_dplane_result intf_addr_update_internal(
|
||||||
/*
|
/*
|
||||||
* Enqueue vxlan/evpn mac add (or update).
|
* Enqueue vxlan/evpn mac add (or update).
|
||||||
*/
|
*/
|
||||||
enum zebra_dplane_result dplane_mac_add(const struct interface *ifp,
|
enum zebra_dplane_result dplane_rem_mac_add(const struct interface *ifp,
|
||||||
const struct interface *bridge_ifp,
|
const struct interface *bridge_ifp,
|
||||||
vlanid_t vid,
|
vlanid_t vid,
|
||||||
const struct ethaddr *mac,
|
const struct ethaddr *mac,
|
||||||
struct in_addr vtep_ip,
|
struct in_addr vtep_ip,
|
||||||
bool sticky,
|
bool sticky,
|
||||||
uint32_t nhg_id)
|
uint32_t nhg_id,
|
||||||
|
bool was_static)
|
||||||
{
|
{
|
||||||
enum zebra_dplane_result result;
|
enum zebra_dplane_result result;
|
||||||
|
uint32_t update_flags = 0;
|
||||||
|
|
||||||
|
update_flags |= DPLANE_MAC_REMOTE;
|
||||||
|
if (was_static)
|
||||||
|
update_flags |= DPLANE_MAC_WAS_STATIC;
|
||||||
|
|
||||||
/* Use common helper api */
|
/* Use common helper api */
|
||||||
result = mac_update_common(DPLANE_OP_MAC_INSTALL, ifp, bridge_ifp,
|
result = mac_update_common(DPLANE_OP_MAC_INSTALL, ifp, bridge_ifp,
|
||||||
vid, mac, vtep_ip, sticky, nhg_id);
|
vid, mac, vtep_ip, sticky, nhg_id, update_flags);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enqueue vxlan/evpn mac delete.
|
* Enqueue vxlan/evpn mac delete.
|
||||||
*/
|
*/
|
||||||
enum zebra_dplane_result dplane_mac_del(const struct interface *ifp,
|
enum zebra_dplane_result dplane_rem_mac_del(const struct interface *ifp,
|
||||||
const struct interface *bridge_ifp,
|
const struct interface *bridge_ifp,
|
||||||
vlanid_t vid,
|
vlanid_t vid,
|
||||||
const struct ethaddr *mac,
|
const struct ethaddr *mac,
|
||||||
struct in_addr vtep_ip)
|
struct in_addr vtep_ip)
|
||||||
{
|
{
|
||||||
enum zebra_dplane_result result;
|
enum zebra_dplane_result result;
|
||||||
|
uint32_t update_flags = 0;
|
||||||
|
|
||||||
|
update_flags |= DPLANE_MAC_REMOTE;
|
||||||
|
|
||||||
/* Use common helper api */
|
/* Use common helper api */
|
||||||
result = mac_update_common(DPLANE_OP_MAC_DELETE, ifp, bridge_ifp,
|
result = mac_update_common(DPLANE_OP_MAC_DELETE, ifp, bridge_ifp,
|
||||||
vid, mac, vtep_ip, false, 0);
|
vid, mac, vtep_ip, false, 0, update_flags);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enqueue local mac add (or update).
|
||||||
|
*/
|
||||||
|
enum zebra_dplane_result dplane_local_mac_add(const struct interface *ifp,
|
||||||
|
const struct interface *bridge_ifp,
|
||||||
|
vlanid_t vid,
|
||||||
|
const struct ethaddr *mac,
|
||||||
|
bool sticky,
|
||||||
|
uint32_t set_static,
|
||||||
|
uint32_t set_inactive)
|
||||||
|
{
|
||||||
|
enum zebra_dplane_result result;
|
||||||
|
uint32_t update_flags = 0;
|
||||||
|
struct in_addr vtep_ip;
|
||||||
|
|
||||||
|
if (set_static)
|
||||||
|
update_flags |= DPLANE_MAC_SET_STATIC;
|
||||||
|
|
||||||
|
if (set_inactive)
|
||||||
|
update_flags |= DPLANE_MAC_SET_INACTIVE;
|
||||||
|
|
||||||
|
vtep_ip.s_addr = 0;
|
||||||
|
|
||||||
|
/* Use common helper api */
|
||||||
|
result = mac_update_common(DPLANE_OP_MAC_INSTALL, ifp, bridge_ifp,
|
||||||
|
vid, mac, vtep_ip, sticky, 0,
|
||||||
|
update_flags);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2946,7 +3000,8 @@ void dplane_mac_init(struct zebra_dplane_ctx *ctx,
|
||||||
const struct ethaddr *mac,
|
const struct ethaddr *mac,
|
||||||
struct in_addr vtep_ip,
|
struct in_addr vtep_ip,
|
||||||
bool sticky,
|
bool sticky,
|
||||||
uint32_t nhg_id)
|
uint32_t nhg_id,
|
||||||
|
uint32_t update_flags)
|
||||||
{
|
{
|
||||||
struct zebra_ns *zns;
|
struct zebra_ns *zns;
|
||||||
|
|
||||||
|
@ -2968,6 +3023,7 @@ void dplane_mac_init(struct zebra_dplane_ctx *ctx,
|
||||||
ctx->u.macinfo.vid = vid;
|
ctx->u.macinfo.vid = vid;
|
||||||
ctx->u.macinfo.is_sticky = sticky;
|
ctx->u.macinfo.is_sticky = sticky;
|
||||||
ctx->u.macinfo.nhg_id = nhg_id;
|
ctx->u.macinfo.nhg_id = nhg_id;
|
||||||
|
ctx->u.macinfo.update_flags = update_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2981,7 +3037,8 @@ mac_update_common(enum dplane_op_e op,
|
||||||
const struct ethaddr *mac,
|
const struct ethaddr *mac,
|
||||||
struct in_addr vtep_ip,
|
struct in_addr vtep_ip,
|
||||||
bool sticky,
|
bool sticky,
|
||||||
uint32_t nhg_id)
|
uint32_t nhg_id,
|
||||||
|
uint32_t update_flags)
|
||||||
{
|
{
|
||||||
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
|
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -3001,7 +3058,8 @@ mac_update_common(enum dplane_op_e op,
|
||||||
ctx->zd_op = op;
|
ctx->zd_op = op;
|
||||||
|
|
||||||
/* Common init for the ctx */
|
/* Common init for the ctx */
|
||||||
dplane_mac_init(ctx, ifp, br_ifp, vid, mac, vtep_ip, sticky, nhg_id);
|
dplane_mac_init(ctx, ifp, br_ifp, vid, mac, vtep_ip, sticky,
|
||||||
|
nhg_id, update_flags);
|
||||||
|
|
||||||
/* Enqueue for processing on the dplane pthread */
|
/* Enqueue for processing on the dplane pthread */
|
||||||
ret = dplane_update_enqueue(ctx);
|
ret = dplane_update_enqueue(ctx);
|
||||||
|
@ -3025,15 +3083,56 @@ mac_update_common(enum dplane_op_e op,
|
||||||
/*
|
/*
|
||||||
* Enqueue evpn neighbor add for the dataplane.
|
* Enqueue evpn neighbor add for the dataplane.
|
||||||
*/
|
*/
|
||||||
enum zebra_dplane_result dplane_neigh_add(const struct interface *ifp,
|
enum zebra_dplane_result dplane_rem_neigh_add(const struct interface *ifp,
|
||||||
const struct ipaddr *ip,
|
const struct ipaddr *ip,
|
||||||
const struct ethaddr *mac,
|
const struct ethaddr *mac,
|
||||||
uint32_t flags)
|
uint32_t flags, bool was_static)
|
||||||
{
|
{
|
||||||
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
|
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
|
||||||
|
uint32_t update_flags = 0;
|
||||||
|
|
||||||
|
update_flags |= DPLANE_NEIGH_REMOTE;
|
||||||
|
|
||||||
|
if (was_static)
|
||||||
|
update_flags |= DPLANE_NEIGH_WAS_STATIC;
|
||||||
|
|
||||||
result = neigh_update_internal(DPLANE_OP_NEIGH_INSTALL,
|
result = neigh_update_internal(DPLANE_OP_NEIGH_INSTALL,
|
||||||
ifp, mac, ip, flags, DPLANE_NUD_NOARP);
|
ifp, mac, ip, flags, DPLANE_NUD_NOARP,
|
||||||
|
update_flags);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enqueue local neighbor add for the dataplane.
|
||||||
|
*/
|
||||||
|
enum zebra_dplane_result dplane_local_neigh_add(const struct interface *ifp,
|
||||||
|
const struct ipaddr *ip,
|
||||||
|
const struct ethaddr *mac,
|
||||||
|
bool set_router, bool set_static,
|
||||||
|
bool set_inactive)
|
||||||
|
{
|
||||||
|
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
|
||||||
|
uint32_t update_flags = 0;
|
||||||
|
uint32_t ntf = 0;
|
||||||
|
uint16_t state;
|
||||||
|
|
||||||
|
if (set_static)
|
||||||
|
update_flags |= DPLANE_NEIGH_SET_STATIC;
|
||||||
|
|
||||||
|
if (set_inactive) {
|
||||||
|
update_flags |= DPLANE_NEIGH_SET_INACTIVE;
|
||||||
|
state = DPLANE_NUD_STALE;
|
||||||
|
} else {
|
||||||
|
state = DPLANE_NUD_REACHABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (set_router)
|
||||||
|
ntf |= DPLANE_NTF_ROUTER;
|
||||||
|
|
||||||
|
result = neigh_update_internal(DPLANE_OP_NEIGH_INSTALL,
|
||||||
|
ifp, mac, ip, ntf,
|
||||||
|
state, update_flags);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3041,14 +3140,18 @@ enum zebra_dplane_result dplane_neigh_add(const struct interface *ifp,
|
||||||
/*
|
/*
|
||||||
* Enqueue evpn neighbor update for the dataplane.
|
* Enqueue evpn neighbor update for the dataplane.
|
||||||
*/
|
*/
|
||||||
enum zebra_dplane_result dplane_neigh_update(const struct interface *ifp,
|
enum zebra_dplane_result dplane_rem_neigh_update(const struct interface *ifp,
|
||||||
const struct ipaddr *ip,
|
const struct ipaddr *ip,
|
||||||
const struct ethaddr *mac)
|
const struct ethaddr *mac)
|
||||||
{
|
{
|
||||||
enum zebra_dplane_result result;
|
enum zebra_dplane_result result;
|
||||||
|
uint32_t update_flags = 0;
|
||||||
|
|
||||||
|
update_flags |= DPLANE_NEIGH_REMOTE;
|
||||||
|
|
||||||
result = neigh_update_internal(DPLANE_OP_NEIGH_UPDATE,
|
result = neigh_update_internal(DPLANE_OP_NEIGH_UPDATE,
|
||||||
ifp, mac, ip, 0, DPLANE_NUD_PROBE);
|
ifp, mac, ip, 0, DPLANE_NUD_PROBE,
|
||||||
|
update_flags);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3056,13 +3159,16 @@ enum zebra_dplane_result dplane_neigh_update(const struct interface *ifp,
|
||||||
/*
|
/*
|
||||||
* Enqueue evpn neighbor delete for the dataplane.
|
* Enqueue evpn neighbor delete for the dataplane.
|
||||||
*/
|
*/
|
||||||
enum zebra_dplane_result dplane_neigh_delete(const struct interface *ifp,
|
enum zebra_dplane_result dplane_rem_neigh_delete(const struct interface *ifp,
|
||||||
const struct ipaddr *ip)
|
const struct ipaddr *ip)
|
||||||
{
|
{
|
||||||
enum zebra_dplane_result result;
|
enum zebra_dplane_result result;
|
||||||
|
uint32_t update_flags = 0;
|
||||||
|
|
||||||
|
update_flags |= DPLANE_NEIGH_REMOTE;
|
||||||
|
|
||||||
result = neigh_update_internal(DPLANE_OP_NEIGH_DELETE,
|
result = neigh_update_internal(DPLANE_OP_NEIGH_DELETE,
|
||||||
ifp, NULL, ip, 0, 0);
|
ifp, NULL, ip, 0, 0, update_flags);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3086,7 +3192,7 @@ enum zebra_dplane_result dplane_vtep_add(const struct interface *ifp,
|
||||||
addr.ipaddr_v4 = *ip;
|
addr.ipaddr_v4 = *ip;
|
||||||
|
|
||||||
result = neigh_update_internal(DPLANE_OP_VTEP_ADD,
|
result = neigh_update_internal(DPLANE_OP_VTEP_ADD,
|
||||||
ifp, &mac, &addr, 0, 0);
|
ifp, &mac, &addr, 0, 0, 0);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3111,7 +3217,7 @@ enum zebra_dplane_result dplane_vtep_delete(const struct interface *ifp,
|
||||||
addr.ipaddr_v4 = *ip;
|
addr.ipaddr_v4 = *ip;
|
||||||
|
|
||||||
result = neigh_update_internal(DPLANE_OP_VTEP_DELETE,
|
result = neigh_update_internal(DPLANE_OP_VTEP_DELETE,
|
||||||
ifp, &mac, &addr, 0, 0);
|
ifp, &mac, &addr, 0, 0, 0);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3124,7 +3230,8 @@ neigh_update_internal(enum dplane_op_e op,
|
||||||
const struct interface *ifp,
|
const struct interface *ifp,
|
||||||
const struct ethaddr *mac,
|
const struct ethaddr *mac,
|
||||||
const struct ipaddr *ip,
|
const struct ipaddr *ip,
|
||||||
uint32_t flags, uint16_t state)
|
uint32_t flags, uint16_t state,
|
||||||
|
uint32_t update_flags)
|
||||||
{
|
{
|
||||||
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
|
enum zebra_dplane_result result = ZEBRA_DPLANE_REQUEST_FAILURE;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -3161,6 +3268,7 @@ neigh_update_internal(enum dplane_op_e op,
|
||||||
ctx->u.neigh.mac = *mac;
|
ctx->u.neigh.mac = *mac;
|
||||||
ctx->u.neigh.flags = flags;
|
ctx->u.neigh.flags = flags;
|
||||||
ctx->u.neigh.state = state;
|
ctx->u.neigh.state = state;
|
||||||
|
ctx->u.neigh.update_flags = update_flags;
|
||||||
|
|
||||||
/* Enqueue for processing on the dplane pthread */
|
/* Enqueue for processing on the dplane pthread */
|
||||||
ret = dplane_update_enqueue(ctx);
|
ret = dplane_update_enqueue(ctx);
|
||||||
|
|
|
@ -168,6 +168,18 @@ enum dplane_op_e {
|
||||||
#define DPLANE_NUD_NOARP 0x04
|
#define DPLANE_NUD_NOARP 0x04
|
||||||
#define DPLANE_NUD_PROBE 0x08
|
#define DPLANE_NUD_PROBE 0x08
|
||||||
|
|
||||||
|
/* MAC update flags - dplane_mac_info.update_flags */
|
||||||
|
#define DPLANE_MAC_REMOTE (1 << 0)
|
||||||
|
#define DPLANE_MAC_WAS_STATIC (1 << 1)
|
||||||
|
#define DPLANE_MAC_SET_STATIC (1 << 2)
|
||||||
|
#define DPLANE_MAC_SET_INACTIVE (1 << 3)
|
||||||
|
|
||||||
|
/* Neigh update flags - dplane_neigh_info.update_flags */
|
||||||
|
#define DPLANE_NEIGH_REMOTE (1 << 0)
|
||||||
|
#define DPLANE_NEIGH_WAS_STATIC (1 << 1)
|
||||||
|
#define DPLANE_NEIGH_SET_STATIC (1 << 2)
|
||||||
|
#define DPLANE_NEIGH_SET_INACTIVE (1 << 3)
|
||||||
|
|
||||||
/* Enable system route notifications */
|
/* Enable system route notifications */
|
||||||
void dplane_enable_sys_route_notifs(void);
|
void dplane_enable_sys_route_notifs(void);
|
||||||
|
|
||||||
|
@ -386,6 +398,7 @@ const char *dplane_ctx_get_intf_label(const struct zebra_dplane_ctx *ctx);
|
||||||
/* Accessors for MAC information */
|
/* Accessors for MAC information */
|
||||||
vlanid_t dplane_ctx_mac_get_vlan(const struct zebra_dplane_ctx *ctx);
|
vlanid_t dplane_ctx_mac_get_vlan(const struct zebra_dplane_ctx *ctx);
|
||||||
bool dplane_ctx_mac_is_sticky(const struct zebra_dplane_ctx *ctx);
|
bool dplane_ctx_mac_is_sticky(const struct zebra_dplane_ctx *ctx);
|
||||||
|
uint32_t dplane_ctx_mac_get_update_flags(const struct zebra_dplane_ctx *ctx);
|
||||||
uint32_t dplane_ctx_mac_get_nhg_id(const struct zebra_dplane_ctx *ctx);
|
uint32_t dplane_ctx_mac_get_nhg_id(const struct zebra_dplane_ctx *ctx);
|
||||||
const struct ethaddr *dplane_ctx_mac_get_addr(
|
const struct ethaddr *dplane_ctx_mac_get_addr(
|
||||||
const struct zebra_dplane_ctx *ctx);
|
const struct zebra_dplane_ctx *ctx);
|
||||||
|
@ -400,6 +413,7 @@ const struct ethaddr *dplane_ctx_neigh_get_mac(
|
||||||
const struct zebra_dplane_ctx *ctx);
|
const struct zebra_dplane_ctx *ctx);
|
||||||
uint32_t dplane_ctx_neigh_get_flags(const struct zebra_dplane_ctx *ctx);
|
uint32_t dplane_ctx_neigh_get_flags(const struct zebra_dplane_ctx *ctx);
|
||||||
uint16_t dplane_ctx_neigh_get_state(const struct zebra_dplane_ctx *ctx);
|
uint16_t dplane_ctx_neigh_get_state(const struct zebra_dplane_ctx *ctx);
|
||||||
|
uint32_t dplane_ctx_neigh_get_update_flags(const struct zebra_dplane_ctx *ctx);
|
||||||
|
|
||||||
/* Accessors for policy based routing rule information */
|
/* Accessors for policy based routing rule information */
|
||||||
int dplane_ctx_rule_get_sock(const struct zebra_dplane_ctx *ctx);
|
int dplane_ctx_rule_get_sock(const struct zebra_dplane_ctx *ctx);
|
||||||
|
@ -498,21 +512,24 @@ enum zebra_dplane_result dplane_intf_addr_unset(const struct interface *ifp,
|
||||||
/*
|
/*
|
||||||
* Enqueue evpn mac operations for the dataplane.
|
* Enqueue evpn mac operations for the dataplane.
|
||||||
*/
|
*/
|
||||||
extern struct zebra_dplane_ctx *mac_update_internal(
|
enum zebra_dplane_result dplane_rem_mac_add(const struct interface *ifp,
|
||||||
enum dplane_op_e op, const struct interface *ifp,
|
|
||||||
const struct interface *br_ifp,
|
|
||||||
vlanid_t vid, const struct ethaddr *mac,
|
|
||||||
struct in_addr vtep_ip, bool sticky);
|
|
||||||
|
|
||||||
enum zebra_dplane_result dplane_mac_add(const struct interface *ifp,
|
|
||||||
const struct interface *bridge_ifp,
|
const struct interface *bridge_ifp,
|
||||||
vlanid_t vid,
|
vlanid_t vid,
|
||||||
const struct ethaddr *mac,
|
const struct ethaddr *mac,
|
||||||
struct in_addr vtep_ip,
|
struct in_addr vtep_ip,
|
||||||
bool sticky,
|
bool sticky,
|
||||||
uint32_t nhg_id);
|
uint32_t nhg_id,
|
||||||
|
bool was_static);
|
||||||
|
|
||||||
enum zebra_dplane_result dplane_mac_del(const struct interface *ifp,
|
enum zebra_dplane_result dplane_local_mac_add(const struct interface *ifp,
|
||||||
|
const struct interface *bridge_ifp,
|
||||||
|
vlanid_t vid,
|
||||||
|
const struct ethaddr *mac,
|
||||||
|
bool sticky,
|
||||||
|
uint32_t set_static,
|
||||||
|
uint32_t set_inactive);
|
||||||
|
|
||||||
|
enum zebra_dplane_result dplane_rem_mac_del(const struct interface *ifp,
|
||||||
const struct interface *bridge_ifp,
|
const struct interface *bridge_ifp,
|
||||||
vlanid_t vid,
|
vlanid_t vid,
|
||||||
const struct ethaddr *mac,
|
const struct ethaddr *mac,
|
||||||
|
@ -525,19 +542,26 @@ void dplane_mac_init(struct zebra_dplane_ctx *ctx,
|
||||||
vlanid_t vid,
|
vlanid_t vid,
|
||||||
const struct ethaddr *mac,
|
const struct ethaddr *mac,
|
||||||
struct in_addr vtep_ip,
|
struct in_addr vtep_ip,
|
||||||
bool sticky);
|
bool sticky,
|
||||||
|
uint32_t nhg_id,
|
||||||
|
uint32_t update_flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enqueue evpn neighbor updates for the dataplane.
|
* Enqueue evpn neighbor updates for the dataplane.
|
||||||
*/
|
*/
|
||||||
enum zebra_dplane_result dplane_neigh_add(const struct interface *ifp,
|
enum zebra_dplane_result dplane_rem_neigh_add(const struct interface *ifp,
|
||||||
const struct ipaddr *ip,
|
const struct ipaddr *ip,
|
||||||
const struct ethaddr *mac,
|
const struct ethaddr *mac,
|
||||||
uint32_t flags);
|
uint32_t flags, bool was_static);
|
||||||
enum zebra_dplane_result dplane_neigh_update(const struct interface *ifp,
|
enum zebra_dplane_result dplane_local_neigh_add(const struct interface *ifp,
|
||||||
|
const struct ipaddr *ip,
|
||||||
|
const struct ethaddr *mac,
|
||||||
|
bool set_router, bool set_static,
|
||||||
|
bool set_inactive);
|
||||||
|
enum zebra_dplane_result dplane_rem_neigh_update(const struct interface *ifp,
|
||||||
const struct ipaddr *ip,
|
const struct ipaddr *ip,
|
||||||
const struct ethaddr *mac);
|
const struct ethaddr *mac);
|
||||||
enum zebra_dplane_result dplane_neigh_delete(const struct interface *ifp,
|
enum zebra_dplane_result dplane_rem_neigh_delete(const struct interface *ifp,
|
||||||
const struct ipaddr *ip);
|
const struct ipaddr *ip);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2549,7 +2549,8 @@ static int zvni_neigh_install(zebra_vni_t *zvni, zebra_neigh_t *n)
|
||||||
flags |= DPLANE_NTF_ROUTER;
|
flags |= DPLANE_NTF_ROUTER;
|
||||||
ZEBRA_NEIGH_SET_ACTIVE(n);
|
ZEBRA_NEIGH_SET_ACTIVE(n);
|
||||||
|
|
||||||
dplane_neigh_add(vlan_if, &n->ip, &n->emac, flags);
|
dplane_rem_neigh_add(vlan_if, &n->ip, &n->emac, flags,
|
||||||
|
false /*was_static*/);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -2584,7 +2585,7 @@ static int zvni_neigh_uninstall(zebra_vni_t *zvni, zebra_neigh_t *n)
|
||||||
ZEBRA_NEIGH_SET_INACTIVE(n);
|
ZEBRA_NEIGH_SET_INACTIVE(n);
|
||||||
n->loc_seq = 0;
|
n->loc_seq = 0;
|
||||||
|
|
||||||
dplane_neigh_delete(vlan_if, &n->ip);
|
dplane_rem_neigh_delete(vlan_if, &n->ip);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2607,7 +2608,7 @@ static int zvni_neigh_probe(zebra_vni_t *zvni, zebra_neigh_t *n)
|
||||||
if (!vlan_if)
|
if (!vlan_if)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
dplane_neigh_update(vlan_if, &n->ip, &n->emac);
|
dplane_rem_neigh_update(vlan_if, &n->ip, &n->emac);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3833,9 +3834,9 @@ static int zvni_mac_install(zebra_vni_t *zvni, zebra_mac_t *mac)
|
||||||
else
|
else
|
||||||
vid = 0;
|
vid = 0;
|
||||||
|
|
||||||
res = dplane_mac_add(zvni->vxlan_if, br_ifp, vid,
|
res = dplane_rem_mac_add(zvni->vxlan_if, br_ifp, vid,
|
||||||
&mac->macaddr, mac->fwd_info.r_vtep_ip, sticky,
|
&mac->macaddr, mac->fwd_info.r_vtep_ip, sticky,
|
||||||
nhg_id);
|
nhg_id, false /*was_static*/);
|
||||||
if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
|
if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
|
@ -3884,7 +3885,7 @@ static int zvni_mac_uninstall(zebra_vni_t *zvni, zebra_mac_t *mac)
|
||||||
ifp = zvni->vxlan_if;
|
ifp = zvni->vxlan_if;
|
||||||
vtep_ip = mac->fwd_info.r_vtep_ip;
|
vtep_ip = mac->fwd_info.r_vtep_ip;
|
||||||
|
|
||||||
res = dplane_mac_del(ifp, br_ifp, vid, &mac->macaddr, vtep_ip);
|
res = dplane_rem_mac_del(ifp, br_ifp, vid, &mac->macaddr, vtep_ip);
|
||||||
if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
|
if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
|
@ -4674,8 +4675,9 @@ static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
|
||||||
else
|
else
|
||||||
vid = 0;
|
vid = 0;
|
||||||
|
|
||||||
res = dplane_mac_add(zl3vni->vxlan_if, br_ifp, vid,
|
res = dplane_rem_mac_add(zl3vni->vxlan_if, br_ifp, vid,
|
||||||
&zrmac->macaddr, zrmac->fwd_info.r_vtep_ip, 0, 0);
|
&zrmac->macaddr, zrmac->fwd_info.r_vtep_ip, 0, 0,
|
||||||
|
false /*was_static*/);
|
||||||
if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
|
if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
|
@ -4724,7 +4726,7 @@ static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
|
||||||
else
|
else
|
||||||
vid = 0;
|
vid = 0;
|
||||||
|
|
||||||
res = dplane_mac_del(zl3vni->vxlan_if, br_ifp, vid,
|
res = dplane_rem_mac_del(zl3vni->vxlan_if, br_ifp, vid,
|
||||||
&zrmac->macaddr, zrmac->fwd_info.r_vtep_ip);
|
&zrmac->macaddr, zrmac->fwd_info.r_vtep_ip);
|
||||||
if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
|
if (res != ZEBRA_DPLANE_REQUEST_FAILURE)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4903,7 +4905,8 @@ static int zl3vni_nh_install(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)
|
||||||
if (n->flags & ZEBRA_NEIGH_ROUTER_FLAG)
|
if (n->flags & ZEBRA_NEIGH_ROUTER_FLAG)
|
||||||
flags |= DPLANE_NTF_ROUTER;
|
flags |= DPLANE_NTF_ROUTER;
|
||||||
|
|
||||||
dplane_neigh_add(zl3vni->svi_if, &n->ip, &n->emac, flags);
|
dplane_rem_neigh_add(zl3vni->svi_if, &n->ip, &n->emac, flags,
|
||||||
|
false /*was_static*/);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -4920,7 +4923,7 @@ static int zl3vni_nh_uninstall(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)
|
||||||
if (!zl3vni->svi_if || !if_is_operative(zl3vni->svi_if))
|
if (!zl3vni->svi_if || !if_is_operative(zl3vni->svi_if))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dplane_neigh_delete(zl3vni->svi_if, &n->ip);
|
dplane_rem_neigh_delete(zl3vni->svi_if, &n->ip);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue