Merge pull request #1301 from donaldsharp/zebra_vxlan

Zebra vxlan
This commit is contained in:
Renato Westphal 2017-10-10 09:00:44 -03:00 committed by GitHub
commit e56ab0e971
4 changed files with 399 additions and 448 deletions

View File

@ -1739,7 +1739,6 @@ static int netlink_macfdb_change(struct sockaddr_nl *snl, struct nlmsghdr *h,
struct ndmsg *ndm;
struct interface *ifp;
struct zebra_if *zif;
struct zebra_vrf *zvrf;
struct rtattr *tb[NDA_MAX + 1];
struct interface *br_if;
struct ethaddr mac;
@ -1753,20 +1752,14 @@ static int netlink_macfdb_change(struct sockaddr_nl *snl, struct nlmsghdr *h,
ndm = NLMSG_DATA(h);
/* We only process macfdb notifications if EVPN is enabled */
if (!is_evpn_enabled())
return 0;
/* The interface should exist. */
ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT),
ndm->ndm_ifindex);
if (!ifp)
return 0;
/* Locate VRF corresponding to interface. We only process MAC
* notifications
* if EVPN is enabled on this VRF.
*/
zvrf = vrf_info_lookup(ifp->vrf_id);
if (!zvrf || !EVPN_ENABLED(zvrf))
return 0;
if (!ifp->info)
if (!ifp || !ifp->info)
return 0;
/* The interface should be something we're interested in. */
@ -2056,7 +2049,6 @@ static int netlink_ipneigh_change(struct sockaddr_nl *snl, struct nlmsghdr *h,
struct ndmsg *ndm;
struct interface *ifp;
struct zebra_if *zif;
struct zebra_vrf *zvrf;
struct rtattr *tb[NDA_MAX + 1];
struct interface *link_if;
struct ethaddr mac;
@ -2068,20 +2060,14 @@ static int netlink_ipneigh_change(struct sockaddr_nl *snl, struct nlmsghdr *h,
ndm = NLMSG_DATA(h);
/* We only process neigh notifications if EVPN is enabled */
if (!is_evpn_enabled())
return 0;
/* The interface should exist. */
ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT),
ndm->ndm_ifindex);
if (!ifp)
return 0;
/* Locate VRF corresponding to interface. We only process neigh
* notifications
* if EVPN is enabled on this VRF.
*/
zvrf = vrf_info_lookup(ifp->vrf_id);
if (!zvrf || !EVPN_ENABLED(zvrf))
return 0;
if (!ifp->info)
if (!ifp || !ifp->info)
return 0;
/* Drop "permanent" entries. */

View File

@ -102,13 +102,15 @@ struct zebra_vrf {
* VNI hash table (for EVPN). Only in default instance.
*/
struct hash *vni_table;
/*
* Whether EVPN is enabled or not.
* Whether EVPN is enabled or not. Only in default instance.
*/
int advertise_all_vni;
/*
* Whether we are advertising g/w macip in EVPN or not.
* Only in default instance.
*/
int advertise_gw_macip;

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,14 @@
/* Is EVPN enabled? */
#define EVPN_ENABLED(zvrf) (zvrf)->advertise_all_vni
static inline int
is_evpn_enabled()
{
struct zebra_vrf *zvrf = NULL;
zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
return zvrf ? zvrf->advertise_all_vni : 0;
}
/* VxLAN interface change flags of interest. */
#define ZEBRA_VXLIF_LOCAL_IP_CHANGE 0x1