diff options
-rw-r--r-- | zebra/if_netlink.c | 35 | ||||
-rw-r--r-- | zebra/interface.c | 2 | ||||
-rw-r--r-- | zebra/rt.h | 2 | ||||
-rw-r--r-- | zebra/rt_netlink.c | 81 | ||||
-rw-r--r-- | zebra/rt_netlink.h | 3 | ||||
-rw-r--r-- | zebra/rtread_netlink.c | 4 | ||||
-rw-r--r-- | zebra/rtread_sysctl.c | 2 | ||||
-rw-r--r-- | zebra/zebra_evpn.c | 11 | ||||
-rw-r--r-- | zebra/zebra_evpn_mh.c | 4 | ||||
-rw-r--r-- | zebra/zebra_l2.h | 26 | ||||
-rw-r--r-- | zebra/zebra_vxlan.c | 56 | ||||
-rw-r--r-- | zebra/zebra_vxlan.h | 10 | ||||
-rw-r--r-- | zebra/zebra_vxlan_private.h | 6 |
13 files changed, 155 insertions, 87 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 6df8a4067..3b4e048af 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -544,7 +544,7 @@ static int netlink_extract_bridge_info(struct rtattr *link_data, memset(bridge_info, 0, sizeof(*bridge_info)); netlink_parse_rtattr_nested(attr, IFLA_BR_MAX, link_data); if (attr[IFLA_BR_VLAN_FILTERING]) - bridge_info->vlan_aware = + bridge_info->bridge.vlan_aware = *(uint8_t *)RTA_DATA(attr[IFLA_BR_VLAN_FILTERING]); return 0; } @@ -612,6 +612,7 @@ static int netlink_extract_gre_info(struct rtattr *link_data, static int netlink_extract_vxlan_info(struct rtattr *link_data, struct zebra_l2info_vxlan *vxl_info) { + uint8_t svd = 0; struct rtattr *attr[IFLA_VXLAN_MAX + 1]; vni_t vni_in_msg; struct in_addr vtep_ip_in_msg; @@ -619,15 +620,31 @@ static int netlink_extract_vxlan_info(struct rtattr *link_data, memset(vxl_info, 0, sizeof(*vxl_info)); netlink_parse_rtattr_nested(attr, IFLA_VXLAN_MAX, link_data); - if (!attr[IFLA_VXLAN_ID]) { + if (attr[IFLA_VXLAN_COLLECT_METADATA]) { + svd = *(uint8_t *)RTA_DATA(attr[IFLA_VXLAN_COLLECT_METADATA]); if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( - "IFLA_VXLAN_ID missing from VXLAN IF message"); - return -1; + "IFLA_VXLAN_COLLECT_METADATA=%u in VXLAN IF message", + svd); + } + + if (!svd) { + /* in case of svd we will not get vni info directly from the + * device */ + if (!attr[IFLA_VXLAN_ID]) { + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug( + "IFLA_VXLAN_ID missing from VXLAN IF message"); + return -1; + } + + vxl_info->vni_info.iftype = ZEBRA_VXLAN_IF_VNI; + vni_in_msg = *(vni_t *)RTA_DATA(attr[IFLA_VXLAN_ID]); + vxl_info->vni_info.vni.vni = vni_in_msg; + } else { + vxl_info->vni_info.iftype = ZEBRA_VXLAN_IF_SVD; } - vni_in_msg = *(vni_t *)RTA_DATA(attr[IFLA_VXLAN_ID]); - vxl_info->vni_info.vni.vni = vni_in_msg; if (!attr[IFLA_VXLAN_LOCAL]) { if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( @@ -639,8 +656,10 @@ static int netlink_extract_vxlan_info(struct rtattr *link_data, } if (attr[IFLA_VXLAN_GROUP]) { - vxl_info->vni_info.vni.mcast_grp = - *(struct in_addr *)RTA_DATA(attr[IFLA_VXLAN_GROUP]); + if (!svd) + vxl_info->vni_info.vni.mcast_grp = + *(struct in_addr *)RTA_DATA( + attr[IFLA_VXLAN_GROUP]); } if (!attr[IFLA_VXLAN_LINK]) { diff --git a/zebra/interface.c b/zebra/interface.c index 81abb13b7..2ec1ac134 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -2437,7 +2437,7 @@ static void if_dump_vty_json(struct vty *vty, struct interface *ifp, bridge_info = &zebra_if->l2info.br; json_object_boolean_add(json_if, "bridgeVlanAware", - bridge_info->vlan_aware); + bridge_info->bridge.vlan_aware); } else if (IS_ZEBRA_IF_VLAN(ifp)) { struct zebra_l2info_vlan *vlan_info; diff --git a/zebra/rt.h b/zebra/rt.h index 6f4dd48a5..8d5f78075 100644 --- a/zebra/rt.h +++ b/zebra/rt.h @@ -103,7 +103,7 @@ extern void kernel_init(struct zebra_ns *zns); extern void kernel_terminate(struct zebra_ns *zns, bool complete); extern void macfdb_read(struct zebra_ns *zns); extern void macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp, - struct interface *br_if); + struct interface *br_if, vlanid_t vid); extern void macfdb_read_specific_mac(struct zebra_ns *zns, struct interface *br_if, const struct ethaddr *mac, vlanid_t vid); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 79d6af60c..21222408b 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -153,6 +153,22 @@ static bool is_proto_nhg(uint32_t id, int type) return false; } +/* Is vni mcast group */ +static bool is_mac_vni_mcast_group(struct ethaddr *mac, vni_t vni, + struct in_addr grp_addr) +{ + if (!vni) + return false; + + if (!is_zero_mac(mac)) + return false; + + if (!IN_MULTICAST(ntohl(grp_addr.s_addr))) + return false; + + return true; +} + /* * The ipv4_ll data structure is used for all 5549 * additions to the kernel. Let's figure out the @@ -3457,7 +3473,9 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id) bool sticky; bool local_inactive = false; bool dp_static = false; + vni_t vni = 0; uint32_t nhg_id = 0; + bool vni_mcast_grp = false; ndm = NLMSG_DATA(h); @@ -3528,12 +3546,16 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id) } } + if (tb[NDA_SRC_VNI]) + vni = *(vni_t *)RTA_DATA(tb[NDA_SRC_VNI]); + if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug("Rx %s AF_BRIDGE IF %u%s st 0x%x fl 0x%x MAC %pEA%s nhg %d", - nl_msg_type_to_str(h->nlmsg_type), - ndm->ndm_ifindex, vid_present ? vid_buf : "", - ndm->ndm_state, ndm->ndm_flags, &mac, - dst_present ? dst_buf : "", nhg_id); + zlog_debug( + "Rx %s AF_BRIDGE IF %u%s st 0x%x fl 0x%x MAC %pEA%s nhg %d vni %d", + nl_msg_type_to_str(h->nlmsg_type), ndm->ndm_ifindex, + vid_present ? vid_buf : "", ndm->ndm_state, + ndm->ndm_flags, &mac, dst_present ? dst_buf : "", + nhg_id, vni); /* The interface should exist. */ ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id), @@ -3556,6 +3578,13 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id) return 0; } + /* For per vni device, vni comes from device itself */ + if (IS_ZEBRA_IF_VXLAN(ifp) && IS_ZEBRA_VXLAN_IF_VNI(zif)) { + struct zebra_vxlan_vni *vnip; + vnip = zebra_vxlan_if_vni_find(zif, 0); + vni = vnip->vni; + } + sticky = !!(ndm->ndm_flags & NTF_STICKY); if (filter_vlan && vid != filter_vlan) { @@ -3565,6 +3594,11 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id) return 0; } + /* + * Check if this is a mcast group update (svd case) + */ + vni_mcast_grp = is_mac_vni_mcast_group(&mac, vni, vtep_ip); + /* If add or update, do accordingly if learnt on a "local" interface; if * the notification is over VxLAN, this has to be related to * multi-homing, @@ -3572,17 +3606,25 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id) */ if (h->nlmsg_type == RTM_NEWNEIGH) { /* Drop "permanent" entries. */ - if (ndm->ndm_state & NUD_PERMANENT) { + if (!vni_mcast_grp && (ndm->ndm_state & NUD_PERMANENT)) { if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( " Dropping entry because of NUD_PERMANENT"); return 0; } - if (IS_ZEBRA_IF_VXLAN(ifp)) - return zebra_vxlan_dp_network_mac_add( - ifp, br_if, &mac, vid, nhg_id, sticky, - !!(ndm->ndm_flags & NTF_EXT_LEARNED)); + if (IS_ZEBRA_IF_VXLAN(ifp)) { + if (!dst_present) + return 0; + + if (vni_mcast_grp) + /* TODO: handle mcast group update for svd */ + + return zebra_vxlan_dp_network_mac_add( + ifp, br_if, &mac, vid, vni, nhg_id, + sticky, + !!(ndm->ndm_flags & NTF_EXT_LEARNED)); + } return zebra_vxlan_local_mac_add_update(ifp, br_if, &mac, vid, sticky, local_inactive, dp_static); @@ -3602,15 +3644,18 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id) return 0; if (dst_present) { - u_char zero_mac[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; + if (vni_mcast_grp) + /* TODO: handle mcast group update for svd */ + + if (is_zero_mac(&mac)) + return zebra_vxlan_check_readd_vtep(ifp, vni, + vtep_ip); - if (!memcmp(zero_mac, mac.octet, ETH_ALEN)) - return zebra_vxlan_check_readd_vtep(ifp, vtep_ip); return 0; } if (IS_ZEBRA_IF_VXLAN(ifp)) - return zebra_vxlan_dp_network_mac_del(ifp, br_if, &mac, vid); + return 0; return zebra_vxlan_local_mac_del(ifp, br_if, &mac, vid); } @@ -3687,11 +3732,9 @@ int netlink_macfdb_read(struct zebra_ns *zns) * specific bridge and matching specific access VLAN (if VLAN-aware bridge). */ int netlink_macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp, - struct interface *br_if) + struct interface *br_if, vlanid_t vid) { struct zebra_if *br_zif; - struct zebra_if *zif; - struct zebra_l2info_vxlan *vxl; struct zebra_dplane_info dp_info; int ret = 0; @@ -3699,10 +3742,8 @@ int netlink_macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp, /* Save VLAN we're filtering on, if needed. */ br_zif = (struct zebra_if *)br_if->info; - zif = (struct zebra_if *)ifp->info; - vxl = &zif->l2info.vxl; if (IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(br_zif)) - filter_vlan = vxl->vni_info.vni.access_vlan; + filter_vlan = vid; /* Get bridge FDB table for specific bridge - we do the VLAN filtering. */ diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h index 8506367ae..f7e777ba8 100644 --- a/zebra/rt_netlink.h +++ b/zebra/rt_netlink.h @@ -92,7 +92,8 @@ extern int netlink_neigh_change(struct nlmsghdr *h, ns_id_t ns_id); extern int netlink_macfdb_read(struct zebra_ns *zns); extern int netlink_macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp, - struct interface *br_if); + struct interface *br_if, + vlanid_t vid); extern int netlink_neigh_read(struct zebra_ns *zns); extern int netlink_neigh_read_for_vlan(struct zebra_ns *zns, struct interface *vlan_if); diff --git a/zebra/rtread_netlink.c b/zebra/rtread_netlink.c index 8990f66ef..578f32127 100644 --- a/zebra/rtread_netlink.c +++ b/zebra/rtread_netlink.c @@ -42,9 +42,9 @@ void macfdb_read(struct zebra_ns *zns) } void macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp, - struct interface *br_if) + struct interface *br_if, vlanid_t vid) { - netlink_macfdb_read_for_bridge(zns, ifp, br_if); + netlink_macfdb_read_for_bridge(zns, ifp, br_if, vid); } void macfdb_read_specific_mac(struct zebra_ns *zns, struct interface *br_if, diff --git a/zebra/rtread_sysctl.c b/zebra/rtread_sysctl.c index 35dde0e68..e80f66579 100644 --- a/zebra/rtread_sysctl.c +++ b/zebra/rtread_sysctl.c @@ -84,7 +84,7 @@ void macfdb_read(struct zebra_ns *zns) } void macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp, - struct interface *br_if) + struct interface *br_if, vlanid_t vid) { } diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c index 42ebedf60..0bf603969 100644 --- a/zebra/zebra_evpn.c +++ b/zebra/zebra_evpn.c @@ -717,7 +717,6 @@ struct zebra_evpn *zebra_evpn_map_vlan(struct interface *ifp, struct interface *br_if, vlanid_t vid) { struct zebra_if *zif; - struct zebra_l2info_bridge *br; struct zebra_evpn **p_zevpn; struct zebra_evpn *zevpn = NULL; struct zebra_from_svi_param in_param; @@ -725,8 +724,7 @@ struct zebra_evpn *zebra_evpn_map_vlan(struct interface *ifp, /* Determine if bridge is VLAN-aware or not */ zif = br_if->info; assert(zif); - br = &zif->l2info.br; - in_param.bridge_vlan_aware = br->vlan_aware; + in_param.bridge_vlan_aware = IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(zif); in_param.vid = vid; in_param.br_if = br_if; in_param.zif = zif; @@ -798,7 +796,6 @@ static int zebra_evpn_from_svi_ns(struct ns *ns, struct zebra_evpn *zebra_evpn_from_svi(struct interface *ifp, struct interface *br_if) { - struct zebra_l2info_bridge *br; struct zebra_evpn *zevpn = NULL; struct zebra_evpn **p_zevpn; struct zebra_if *zif; @@ -814,8 +811,7 @@ struct zebra_evpn *zebra_evpn_from_svi(struct interface *ifp, /* Determine if bridge is VLAN-aware or not */ zif = br_if->info; assert(zif); - br = &zif->l2info.br; - in_param.bridge_vlan_aware = br->vlan_aware; + in_param.bridge_vlan_aware = IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(zif); in_param.vid = 0; if (in_param.bridge_vlan_aware) { @@ -948,7 +944,8 @@ void zebra_evpn_read_mac_neigh(struct zebra_evpn *zevpn, struct interface *ifp) ifp->name, ifp->ifindex, zevpn->vni, zif->brslave_info.bridge_ifindex); - macfdb_read_for_bridge(zns, ifp, zif->brslave_info.br_if); + macfdb_read_for_bridge(zns, ifp, zif->brslave_info.br_if, + vni->access_vlan); vlan_if = zvni_map_to_svi(vni->access_vlan, zif->brslave_info.br_if); if (vlan_if) { /* Add SVI MAC */ diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c index 642169840..9d672ab51 100644 --- a/zebra/zebra_evpn_mh.c +++ b/zebra/zebra_evpn_mh.c @@ -632,7 +632,6 @@ void zebra_evpn_acc_bd_svi_set(struct zebra_if *vlan_zif, struct zebra_if *br_zif, bool is_up) { struct zebra_evpn_access_bd *acc_bd; - struct zebra_l2info_bridge *br; uint16_t vid; struct zebra_if *tmp_br_zif = br_zif; @@ -643,9 +642,8 @@ void zebra_evpn_acc_bd_svi_set(struct zebra_if *vlan_zif, tmp_br_zif = vlan_zif->link->info; } - br = &tmp_br_zif->l2info.br; /* ignore vlan unaware bridges */ - if (!br->vlan_aware) + if (!IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(tmp_br_zif)) return; vid = vlan_zif->l2info.vl.vid; diff --git a/zebra/zebra_l2.h b/zebra/zebra_l2.h index 0df75ac07..01084a09a 100644 --- a/zebra/zebra_l2.h +++ b/zebra/zebra_l2.h @@ -49,9 +49,29 @@ struct zebra_l2info_bond { struct list *mbr_zifs; /* slaves using this bond as a master */ }; +struct zebra_l2_bridge_vlan { + vlanid_t vid; + struct zebra_evpn_access_bd *access_bd; +}; + +struct zebra_l2_bridge_if_ctx { + /* input */ + struct zebra_if *zif; + int (*func)(struct zebra_if *, struct zebra_l2_bridge_vlan *, void *); + + /* input-output */ + void *arg; +}; + +struct zebra_l2_bridge_if { + uint8_t vlan_aware; + struct zebra_if *br_zif; + struct hash *vlan_table; +}; + /* zebra L2 interface information - bridge interface */ struct zebra_l2info_bridge { - uint8_t vlan_aware; /* VLAN-aware bridge? */ + struct zebra_l2_bridge_if bridge; }; /* zebra L2 interface information - VLAN interface */ @@ -138,7 +158,9 @@ union zebra_l2if_info { ((zif)->l2info.vxl.vni_info.iftype == ZEBRA_VXLAN_IF_VNI) #define VLAN_ID_FROM_ZEBRA_IF(zif) (zif)->l2info.vl.vid -#define IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(zif) ((zif)->l2info.br.vlan_aware == 1) +#define BRIDGE_FROM_ZEBRA_IF(zif) (&((zif)->l2info.br.bridge)) +#define IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(zif) \ + ((zif)->l2info.br.bridge.vlan_aware == 1) extern void zebra_l2_map_slave_to_bridge(struct zebra_l2info_brslave *br_slave, struct zebra_ns *zns); diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 3e7f56680..0df43982e 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -110,8 +110,6 @@ static int zl3vni_rmac_uninstall(struct zebra_l3vni *zl3vni, static void *zl3vni_alloc(void *p); static struct zebra_l3vni *zl3vni_add(vni_t vni, vrf_id_t vrf_id); static int zl3vni_del(struct zebra_l3vni *zl3vni); -static void zebra_vxlan_process_l3vni_oper_up(struct zebra_l3vni *zl3vni); -static void zebra_vxlan_process_l3vni_oper_down(struct zebra_l3vni *zl3vni); static void zevpn_build_hash_table(void); static unsigned int zebra_vxlan_sg_hash_key_make(const void *p); @@ -121,10 +119,6 @@ static void zebra_vxlan_sg_do_deref(struct zebra_vrf *zvrf, static struct zebra_vxlan_sg *zebra_vxlan_sg_do_ref(struct zebra_vrf *vrf, struct in_addr sip, struct in_addr mcast_grp); -static void zebra_vxlan_sg_deref(struct in_addr local_vtep_ip, - struct in_addr mcast_grp); -static void zebra_vxlan_sg_ref(struct in_addr local_vtep_ip, - struct in_addr mcast_grp); static void zebra_vxlan_cleanup_sg_table(struct zebra_vrf *zvrf); bool zebra_evpn_do_dup_addr_detect(struct zebra_vrf *zvrf) @@ -889,7 +883,6 @@ struct interface *zvni_map_to_svi(vlanid_t vid, struct interface *br_if) { struct interface *tmp_if = NULL; struct zebra_if *zif; - struct zebra_l2info_bridge *br; struct zebra_from_svi_param in_param; struct interface **p_ifp; /* Defensive check, caller expected to invoke only with valid bridge. */ @@ -899,8 +892,7 @@ struct interface *zvni_map_to_svi(vlanid_t vid, struct interface *br_if) /* Determine if bridge is VLAN-aware or not */ zif = br_if->info; assert(zif); - br = &zif->l2info.br; - in_param.bridge_vlan_aware = br->vlan_aware; + in_param.bridge_vlan_aware = IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(zif); /* Check oper status of the SVI. */ if (!in_param.bridge_vlan_aware) return if_is_operative(br_if) ? br_if : NULL; @@ -1904,7 +1896,6 @@ static struct zebra_l3vni *zl3vni_from_svi(struct interface *ifp, { struct zebra_l3vni *zl3vni = NULL; struct zebra_if *zif = NULL; - struct zebra_l2info_bridge *br = NULL; struct zebra_from_svi_param in_param = {}; struct zebra_l3vni **p_zl3vni; @@ -1919,8 +1910,7 @@ static struct zebra_l3vni *zl3vni_from_svi(struct interface *ifp, /* Determine if bridge is VLAN-aware or not */ zif = br_if->info; assert(zif); - br = &zif->l2info.br; - in_param.bridge_vlan_aware = br->vlan_aware; + in_param.bridge_vlan_aware = IS_ZEBRA_IF_BRIDGE_VLAN_AWARE(zif); if (in_param.bridge_vlan_aware) { struct zebra_l2info_vlan *vl; @@ -2067,7 +2057,7 @@ static int zl3vni_send_del_to_client(struct zebra_l3vni *zl3vni) return zserv_send_message(client, s); } -static void zebra_vxlan_process_l3vni_oper_up(struct zebra_l3vni *zl3vni) +void zebra_vxlan_process_l3vni_oper_up(struct zebra_l3vni *zl3vni) { if (!zl3vni) return; @@ -2076,7 +2066,7 @@ static void zebra_vxlan_process_l3vni_oper_up(struct zebra_l3vni *zl3vni) zl3vni_send_add_to_client(zl3vni); } -static void zebra_vxlan_process_l3vni_oper_down(struct zebra_l3vni *zl3vni) +void zebra_vxlan_process_l3vni_oper_down(struct zebra_l3vni *zl3vni) { if (!zl3vni) return; @@ -3961,20 +3951,17 @@ stream_failure: /* * Handle remote vtep delete by kernel; re-add the vtep if we have it */ -int zebra_vxlan_check_readd_vtep(struct interface *ifp, +int zebra_vxlan_check_readd_vtep(struct interface *ifp, vni_t vni, struct in_addr vtep_ip) { struct zebra_if *zif; struct zebra_vrf *zvrf = NULL; - struct zebra_l2info_vxlan *vxl; - vni_t vni; struct zebra_evpn *zevpn = NULL; struct zebra_vtep *zvtep = NULL; + struct zebra_vxlan_vni *vnip; zif = ifp->info; assert(zif); - vxl = &zif->l2info.vxl; - vni = vxl->vni_info.vni.vni; /* If EVPN is not enabled, nothing to do. */ if (!is_evpn_enabled()) @@ -3985,6 +3972,10 @@ int zebra_vxlan_check_readd_vtep(struct interface *ifp, if (!zvrf) return -1; + vnip = zebra_vxlan_if_vni_find(zif, vni); + if (!vnip) + return 0; + /* Locate hash entry; it is expected to exist. */ zevpn = zebra_evpn_lookup(vni); if (!zevpn) @@ -4012,18 +4003,14 @@ int zebra_vxlan_check_readd_vtep(struct interface *ifp, static int zebra_vxlan_check_del_local_mac(struct interface *ifp, struct interface *br_if, struct ethaddr *macaddr, - vlanid_t vid) + vlanid_t vid, vni_t vni) { struct zebra_if *zif; - struct zebra_l2info_vxlan *vxl; - vni_t vni; struct zebra_evpn *zevpn; struct zebra_mac *mac; zif = ifp->info; assert(zif); - vxl = &zif->l2info.vxl; - vni = vxl->vni_info.vni.vni; /* Check if EVPN is enabled. */ if (!is_evpn_enabled()) @@ -4075,7 +4062,8 @@ static int zebra_vxlan_check_del_local_mac(struct interface *ifp, int zebra_vxlan_dp_network_mac_add(struct interface *ifp, struct interface *br_if, struct ethaddr *macaddr, vlanid_t vid, - uint32_t nhg_id, bool sticky, bool dp_static) + vni_t vni, uint32_t nhg_id, bool sticky, + bool dp_static) { struct zebra_evpn_es *es; struct interface *acc_ifp; @@ -4099,8 +4087,8 @@ int zebra_vxlan_dp_network_mac_add(struct interface *ifp, if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_MAC) zlog_debug("dpAdd remote MAC %pEA VID %u", macaddr, vid); - return zebra_vxlan_check_del_local_mac(ifp, br_if, macaddr, - vid); + return zebra_vxlan_check_del_local_mac(ifp, br_if, macaddr, vid, + vni); } /* If local MAC on a down local ES translate the network-mac-add @@ -4121,19 +4109,16 @@ int zebra_vxlan_dp_network_mac_add(struct interface *ifp, */ int zebra_vxlan_dp_network_mac_del(struct interface *ifp, struct interface *br_if, - struct ethaddr *macaddr, vlanid_t vid) + struct ethaddr *macaddr, vlanid_t vid, + vni_t vni) { struct zebra_if *zif = NULL; - struct zebra_l2info_vxlan *vxl = NULL; - vni_t vni; struct zebra_evpn *zevpn = NULL; struct zebra_l3vni *zl3vni = NULL; struct zebra_mac *mac = NULL; zif = ifp->info; assert(zif); - vxl = &zif->l2info.vxl; - vni = vxl->vni_info.vni.vni; /* Check if EVPN is enabled. */ if (!is_evpn_enabled()) @@ -6157,8 +6142,8 @@ static struct zebra_vxlan_sg *zebra_vxlan_sg_do_ref(struct zebra_vrf *zvrf, return vxlan_sg; } -static void zebra_vxlan_sg_deref(struct in_addr local_vtep_ip, - struct in_addr mcast_grp) +void zebra_vxlan_sg_deref(struct in_addr local_vtep_ip, + struct in_addr mcast_grp) { struct zebra_vrf *zvrf; @@ -6173,8 +6158,7 @@ static void zebra_vxlan_sg_deref(struct in_addr local_vtep_ip, zebra_vxlan_sg_do_deref(zvrf, local_vtep_ip, mcast_grp); } -static void zebra_vxlan_sg_ref(struct in_addr local_vtep_ip, - struct in_addr mcast_grp) +void zebra_vxlan_sg_ref(struct in_addr local_vtep_ip, struct in_addr mcast_grp) { struct zebra_vrf *zvrf; diff --git a/zebra/zebra_vxlan.h b/zebra/zebra_vxlan.h index 657a0f538..ab2b3fd8a 100644 --- a/zebra/zebra_vxlan.h +++ b/zebra/zebra_vxlan.h @@ -214,7 +214,7 @@ extern int zebra_vxlan_local_mac_add_update(struct interface *ifp, extern int zebra_vxlan_local_mac_del(struct interface *ifp, struct interface *br_if, struct ethaddr *mac, vlanid_t vid); -extern int zebra_vxlan_check_readd_vtep(struct interface *ifp, +extern int zebra_vxlan_check_readd_vtep(struct interface *ifp, vni_t vni, struct in_addr vtep_ip); extern int zebra_vxlan_if_up(struct interface *ifp); extern int zebra_vxlan_if_down(struct interface *ifp); @@ -255,12 +255,12 @@ extern int vni_list_cmp(void *p1, void *p2); extern int zebra_vxlan_dp_network_mac_add(struct interface *ifp, struct interface *br_if, struct ethaddr *macaddr, vlanid_t vid, - uint32_t nhg_id, bool sticky, - bool dp_static); + vni_t vni, uint32_t nhg_id, + bool sticky, bool dp_static); extern int zebra_vxlan_dp_network_mac_del(struct interface *ifp, struct interface *br_if, - struct ethaddr *macaddr, - vlanid_t vid); + struct ethaddr *macaddr, vlanid_t vid, + vni_t vni); extern void zebra_vxlan_set_accept_bgp_seq(bool set); extern bool zebra_vxlan_get_accept_bgp_seq(void); diff --git a/zebra/zebra_vxlan_private.h b/zebra/zebra_vxlan_private.h index fb17dac23..9161348b1 100644 --- a/zebra/zebra_vxlan_private.h +++ b/zebra/zebra_vxlan_private.h @@ -260,5 +260,11 @@ extern void zebra_vxlan_sync_mac_dp_install(struct zebra_mac *mac, bool force_clear_static, const char *caller); extern bool zebra_evpn_do_dup_addr_detect(struct zebra_vrf *zvrf); +extern void zebra_vxlan_sg_ref(struct in_addr local_vtep_ip, + struct in_addr mcast_grp); +extern void zebra_vxlan_sg_deref(struct in_addr local_vtep_ip, + struct in_addr mcast_grp); +extern void zebra_vxlan_process_l3vni_oper_up(struct zebra_l3vni *zl3vni); +extern void zebra_vxlan_process_l3vni_oper_down(struct zebra_l3vni *zl3vni); #endif /* _ZEBRA_VXLAN_PRIVATE_H */ |