summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2018-03-06 17:27:10 +0100
committerGitHub <noreply@github.com>2018-03-06 17:27:10 +0100
commit6dfe83b8f763795017e6b9bcbe0757143b56e539 (patch)
tree357d5777dfebe6797549f0a0bd85cfb6d9c1e2f8
parentMerge pull request #1818 from pguibert6WIND/issue_vrfnetns_capabilities (diff)
parentMerge branch 'master' into evpn-bug-fixes (diff)
downloadfrr-6dfe83b8f763795017e6b9bcbe0757143b56e539.tar.xz
frr-6dfe83b8f763795017e6b9bcbe0757143b56e539.zip
Merge pull request #1728 from mkanjari/evpn-bug-fixes
Evpn bug fixes
-rw-r--r--bgpd/bgp_evpn.c67
-rw-r--r--bgpd/bgp_route.c11
-rw-r--r--bgpd/bgp_vty.c4
-rw-r--r--lib/command.c3
-rw-r--r--vtysh/vtysh_config.c5
-rw-r--r--zebra/zebra_vxlan.c57
6 files changed, 95 insertions, 52 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index a8ee14c72..e5863e498 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -1760,8 +1760,10 @@ static int delete_routes_for_vni(struct bgp *bgp, struct bgpevpn *vpn)
}
/*
- * There is a tunnel endpoint IP address change for this VNI,
- * need to re-advertise routes with the new nexthop.
+ * There is a tunnel endpoint IP address change for this VNI, delete
+ * prior type-3 route (if needed) and update.
+ * Note: Route re-advertisement happens elsewhere after other processing
+ * other changes.
*/
static int handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn,
struct in_addr originator_ip)
@@ -1789,7 +1791,7 @@ static int handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn,
/* Update the tunnel IP and re-advertise all routes for this VNI. */
vpn->originator_ip = originator_ip;
- return update_routes_for_vni(bgp, vpn);
+ return 0;
}
/*
@@ -3245,15 +3247,25 @@ void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf,
{
struct bgp_table *table = NULL;
struct bgp_node *rn = NULL;
+ struct bgp_info *ri;
/* Bail out early if we don't have to advertise type-5 routes. */
if (!advertise_type5_routes(bgp_vrf, afi))
return;
table = bgp_vrf->rib[afi][safi];
- for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
- bgp_evpn_withdraw_type5_route(bgp_vrf, &rn->p, afi, safi);
-
+ for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
+ /* Only care about "selected" routes - non-imported. */
+ /* TODO: Support for AddPath for EVPN. */
+ for (ri = rn->info; ri; ri = ri->next) {
+ if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) &&
+ (!ri->extra || !ri->extra->parent)) {
+ bgp_evpn_withdraw_type5_route(bgp_vrf, &rn->p,
+ afi, safi);
+ break;
+ }
+ }
+ }
}
/*
@@ -3274,10 +3286,6 @@ void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p,
if (!advertise_type5_routes(bgp_vrf, afi))
return;
- /* only advertise subnet routes as type-5 */
- if (is_host_route(p))
- return;
-
build_type5_prefix_from_ip_prefix(&evp, p);
ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr);
if (ret)
@@ -3305,11 +3313,12 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf,
table = bgp_vrf->rib[afi][safi];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
/* Need to identify the "selected" route entry to use its
- * attribute.
+ * attribute. Also, we only consider "non-imported" routes.
* TODO: Support for AddPath for EVPN.
*/
for (ri = rn->info; ri; ri = ri->next) {
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) {
+ if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) &&
+ (!ri->extra || !ri->extra->parent)) {
/* apply the route-map */
if (bgp_vrf->adv_cmd_rmap[afi][safi].map) {
@@ -3322,7 +3331,6 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf,
if (ret == RMAP_DENYMATCH)
continue;
}
-
bgp_evpn_advertise_type5_route(bgp_vrf, &rn->p,
ri->attr,
afi, safi);
@@ -4449,8 +4457,8 @@ int bgp_evpn_local_vni_del(struct bgp *bgp, vni_t vni)
}
/*
- * Handle add (or update) of a local VNI. The only VNI change we care
- * about is change to local-tunnel-ip.
+ * Handle add (or update) of a local VNI. The VNI changes we care
+ * about are for the local-tunnel-ip and the (tenant) VRF.
*/
int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
struct in_addr originator_ip,
@@ -4468,24 +4476,31 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
vpn = bgp_evpn_lookup_vni(bgp, vni);
if (vpn) {
- /* update tenant_vrf_id if required */
+ if (is_vni_live(vpn)
+ && IPV4_ADDR_SAME(&vpn->originator_ip, &originator_ip)
+ && vpn->tenant_vrf_id == tenant_vrf_id)
+ /* Probably some other param has changed that we don't
+ * care about. */
+ return 0;
+
+ /* Update tenant_vrf_id if it has changed. */
if (vpn->tenant_vrf_id != tenant_vrf_id) {
bgpevpn_unlink_from_l3vni(vpn);
vpn->tenant_vrf_id = tenant_vrf_id;
bgpevpn_link_to_l3vni(vpn);
-
- /* update all routes with new export RT for VRFs */
- update_routes_for_vni(bgp, vpn);
}
- if (is_vni_live(vpn)
- && IPV4_ADDR_SAME(&vpn->originator_ip, &originator_ip))
- /* Probably some other param has changed that we don't
- * care about. */
- return 0;
+ /* If tunnel endpoint IP has changed, update (and delete prior
+ * type-3 route, if needed.)
+ */
+ if (!IPV4_ADDR_SAME(&vpn->originator_ip, &originator_ip))
+ handle_tunnel_ip_change(bgp, vpn, originator_ip);
- /* Local tunnel endpoint IP address has changed */
- handle_tunnel_ip_change(bgp, vpn, originator_ip);
+ /* Update all routes with new endpoint IP and/or export RT
+ * for VRFs
+ */
+ if (is_vni_live(vpn))
+ update_routes_for_vni(bgp, vpn);
}
/* Create or update as appropriate. */
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 20bf9635a..3dfc446b2 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2228,10 +2228,13 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
/* advertise/withdraw type-5 routes */
if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) {
- if (new_select)
- bgp_evpn_advertise_type5_route(
- bgp, &rn->p, new_select->attr, afi, safi);
- else if (old_select)
+ if (new_select &&
+ (!new_select->extra || !new_select->extra->parent))
+ bgp_evpn_advertise_type5_route(bgp, &rn->p,
+ new_select->attr,
+ afi, safi);
+ else if (old_select &&
+ (!old_select->extra || !old_select->extra->parent))
bgp_evpn_withdraw_type5_route(bgp, &rn->p, afi, safi);
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 15cc5673a..8fa5dc9c6 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -833,7 +833,7 @@ DEFUN_NOSH (router_bgp,
if (listcount(bm->bgp) > 1) {
vty_out(vty,
- "%% Multiple BGP processes are configured\n");
+ "%% Please specify ASN and VRF\n");
return CMD_WARNING_CONFIG_FAILED;
}
}
@@ -909,7 +909,7 @@ DEFUN (no_router_bgp,
if (listcount(bm->bgp) > 1) {
vty_out(vty,
- "%% Multiple BGP processes are configured\n");
+ "%% Please specify ASN and VRF\n");
return CMD_WARNING_CONFIG_FAILED;
}
diff --git a/lib/command.c b/lib/command.c
index 10996d5dd..3fa086bf6 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -500,6 +500,9 @@ static int config_write_host(struct vty *vty)
if (cmd_hostname_get())
vty_out(vty, "hostname %s\n", cmd_hostname_get());
+ if (cmd_domainname_get())
+ vty_out(vty, "domainname %s\n", cmd_domainname_get());
+
if (host.encrypt) {
if (host.password_encrypt)
vty_out(vty, "password 8 %s\n", host.password_encrypt);
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index aa1dd407e..84db436c8 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -448,6 +448,11 @@ void vtysh_config_write()
sprintf(line, "hostname %s", cmd_hostname_get());
vtysh_config_parse_line(NULL, line);
}
+
+ if (cmd_domainname_get()) {
+ sprintf(line, "domainname %s", cmd_domainname_get());
+ vtysh_config_parse_line(NULL, line);
+ }
if (vtysh_write_integrated == WRITE_INTEGRATED_NO)
vtysh_config_parse_line(NULL,
"no service integrated-vtysh-config");
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 20b9e9428..e07dc6059 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -1135,7 +1135,8 @@ static void zvni_print_hash(struct hash_backet *backet, void *ctxt[])
"%-10u %-4s %-21s %-8u %-8u %-15u %-37s\n",
zvni->vni, "L2",
zvni->vxlan_if ? zvni->vxlan_if->name : "unknown",
- num_macs, num_neigh, num_vteps,
+ num_macs, num_neigh,
+ num_vteps,
vrf_id_to_name(zvni->vrf_id));
else {
char vni_str[VNI_STR_LEN];
@@ -1858,20 +1859,18 @@ static int zvni_gw_macip_del(struct interface *ifp, zebra_vni_t *zvni,
return -1;
/* only need to delete the entry from bgp if we sent it before */
- if (advertise_gw_macip_enabled(zvni)) {
- if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s del to BGP",
- ifp->vrf_id, ifp->name,
- ifp->ifindex, zvni->vni,
- prefix_mac2str(&(n->emac),
- NULL,
- ETHER_ADDR_STRLEN),
- ipaddr2str(ip, buf2, sizeof(buf2)));
-
- /* Remove neighbor from BGP. */
- zvni_neigh_send_del_to_client(zvni->vni, &n->ip, &n->emac,
- ZEBRA_MACIP_TYPE_GW);
- }
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug("%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s del to BGP",
+ ifp->vrf_id, ifp->name,
+ ifp->ifindex, zvni->vni,
+ prefix_mac2str(&(n->emac),
+ NULL,
+ ETHER_ADDR_STRLEN),
+ ipaddr2str(ip, buf2, sizeof(buf2)));
+
+ /* Remove neighbor from BGP. */
+ zvni_neigh_send_del_to_client(zvni->vni, &n->ip, &n->emac,
+ ZEBRA_MACIP_TYPE_GW);
/* Delete this neighbor entry. */
zvni_neigh_del(zvni, n);
@@ -6256,15 +6255,33 @@ int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags)
zebra_vxlan_process_l3vni_oper_down(zl3vni);
zl3vni->svi_if = NULL;
zl3vni->svi_if = zl3vni_map_to_svi_if(zl3vni);
+ zl3vni->local_vtep_ip = vxl->vtep_ip;
if (is_l3vni_oper_up(zl3vni))
zebra_vxlan_process_l3vni_oper_up(
zl3vni);
}
}
+ /*
+ * local-ip change - process oper down, associate with new
+ * local-ip and then process oper up again
+ */
+ if (chgflags & ZEBRA_VXLIF_LOCAL_IP_CHANGE) {
+ if (if_is_operative(ifp)) {
+ zebra_vxlan_process_l3vni_oper_down(zl3vni);
+ zl3vni->local_vtep_ip = vxl->vtep_ip;
+ if (is_l3vni_oper_up(zl3vni))
+ zebra_vxlan_process_l3vni_oper_up(
+ zl3vni);
+ }
+ }
+
+ /* Update local tunnel IP. */
+ zl3vni->local_vtep_ip = vxl->vtep_ip;
+
/* if we have a valid new master, process l3-vni oper up */
if (chgflags & ZEBRA_VXLIF_MASTER_CHANGE) {
- if (is_l3vni_oper_up(zl3vni))
+ if (if_is_operative(ifp) && is_l3vni_oper_up(zl3vni))
zebra_vxlan_process_l3vni_oper_up(zl3vni);
}
} else {
@@ -6704,6 +6721,10 @@ int zebra_vxlan_advertise_gw_macip(struct zserv *client, u_short length,
struct interface *vlan_if = NULL;
struct interface *vrr_if = NULL;
+ zvni = zvni_lookup(vni);
+ if (!zvni)
+ return 0;
+
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
"EVPN gateway macip Adv %s on VNI %d , currently %s",
@@ -6712,10 +6733,6 @@ int zebra_vxlan_advertise_gw_macip(struct zserv *client, u_short length,
? "enabled"
: "disabled");
- zvni = zvni_lookup(vni);
- if (!zvni)
- return 0;
-
if (zvni->advertise_gw_macip == advertise)
return 0;