mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 13:27:53 +00:00
commit
6dfe83b8f7
@ -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,
|
* There is a tunnel endpoint IP address change for this VNI, delete
|
||||||
* need to re-advertise routes with the new nexthop.
|
* 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,
|
static int handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn,
|
||||||
struct in_addr originator_ip)
|
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. */
|
/* Update the tunnel IP and re-advertise all routes for this VNI. */
|
||||||
vpn->originator_ip = originator_ip;
|
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_table *table = NULL;
|
||||||
struct bgp_node *rn = NULL;
|
struct bgp_node *rn = NULL;
|
||||||
|
struct bgp_info *ri;
|
||||||
|
|
||||||
/* Bail out early if we don't have to advertise type-5 routes. */
|
/* Bail out early if we don't have to advertise type-5 routes. */
|
||||||
if (!advertise_type5_routes(bgp_vrf, afi))
|
if (!advertise_type5_routes(bgp_vrf, afi))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
table = bgp_vrf->rib[afi][safi];
|
table = bgp_vrf->rib[afi][safi];
|
||||||
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
|
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
|
||||||
bgp_evpn_withdraw_type5_route(bgp_vrf, &rn->p, afi, safi);
|
/* 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))
|
if (!advertise_type5_routes(bgp_vrf, afi))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* only advertise subnet routes as type-5 */
|
|
||||||
if (is_host_route(p))
|
|
||||||
return;
|
|
||||||
|
|
||||||
build_type5_prefix_from_ip_prefix(&evp, p);
|
build_type5_prefix_from_ip_prefix(&evp, p);
|
||||||
ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr);
|
ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr);
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -3305,11 +3313,12 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf,
|
|||||||
table = bgp_vrf->rib[afi][safi];
|
table = bgp_vrf->rib[afi][safi];
|
||||||
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
|
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
|
||||||
/* Need to identify the "selected" route entry to use its
|
/* 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.
|
* TODO: Support for AddPath for EVPN.
|
||||||
*/
|
*/
|
||||||
for (ri = rn->info; ri; ri = ri->next) {
|
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 */
|
/* apply the route-map */
|
||||||
if (bgp_vrf->adv_cmd_rmap[afi][safi].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)
|
if (ret == RMAP_DENYMATCH)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bgp_evpn_advertise_type5_route(bgp_vrf, &rn->p,
|
bgp_evpn_advertise_type5_route(bgp_vrf, &rn->p,
|
||||||
ri->attr,
|
ri->attr,
|
||||||
afi, safi);
|
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
|
* Handle add (or update) of a local VNI. The VNI changes we care
|
||||||
* about is change to local-tunnel-ip.
|
* about are for the local-tunnel-ip and the (tenant) VRF.
|
||||||
*/
|
*/
|
||||||
int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
|
int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
|
||||||
struct in_addr originator_ip,
|
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);
|
vpn = bgp_evpn_lookup_vni(bgp, vni);
|
||||||
if (vpn) {
|
if (vpn) {
|
||||||
|
|
||||||
/* update tenant_vrf_id if required */
|
|
||||||
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)
|
if (is_vni_live(vpn)
|
||||||
&& IPV4_ADDR_SAME(&vpn->originator_ip, &originator_ip))
|
&& 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
|
/* Probably some other param has changed that we don't
|
||||||
* care about. */
|
* care about. */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Local tunnel endpoint IP address has changed */
|
/* 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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);
|
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. */
|
/* Create or update as appropriate. */
|
||||||
|
@ -2228,10 +2228,13 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
|
|||||||
|
|
||||||
/* advertise/withdraw type-5 routes */
|
/* advertise/withdraw type-5 routes */
|
||||||
if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) {
|
if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) {
|
||||||
if (new_select)
|
if (new_select &&
|
||||||
bgp_evpn_advertise_type5_route(
|
(!new_select->extra || !new_select->extra->parent))
|
||||||
bgp, &rn->p, new_select->attr, afi, safi);
|
bgp_evpn_advertise_type5_route(bgp, &rn->p,
|
||||||
else if (old_select)
|
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);
|
bgp_evpn_withdraw_type5_route(bgp, &rn->p, afi, safi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -833,7 +833,7 @@ DEFUN_NOSH (router_bgp,
|
|||||||
|
|
||||||
if (listcount(bm->bgp) > 1) {
|
if (listcount(bm->bgp) > 1) {
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"%% Multiple BGP processes are configured\n");
|
"%% Please specify ASN and VRF\n");
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -909,7 +909,7 @@ DEFUN (no_router_bgp,
|
|||||||
|
|
||||||
if (listcount(bm->bgp) > 1) {
|
if (listcount(bm->bgp) > 1) {
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"%% Multiple BGP processes are configured\n");
|
"%% Please specify ASN and VRF\n");
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,6 +500,9 @@ static int config_write_host(struct vty *vty)
|
|||||||
if (cmd_hostname_get())
|
if (cmd_hostname_get())
|
||||||
vty_out(vty, "hostname %s\n", 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.encrypt) {
|
||||||
if (host.password_encrypt)
|
if (host.password_encrypt)
|
||||||
vty_out(vty, "password 8 %s\n", host.password_encrypt);
|
vty_out(vty, "password 8 %s\n", host.password_encrypt);
|
||||||
|
@ -448,6 +448,11 @@ void vtysh_config_write()
|
|||||||
sprintf(line, "hostname %s", cmd_hostname_get());
|
sprintf(line, "hostname %s", cmd_hostname_get());
|
||||||
vtysh_config_parse_line(NULL, line);
|
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)
|
if (vtysh_write_integrated == WRITE_INTEGRATED_NO)
|
||||||
vtysh_config_parse_line(NULL,
|
vtysh_config_parse_line(NULL,
|
||||||
"no service integrated-vtysh-config");
|
"no service integrated-vtysh-config");
|
||||||
|
@ -1135,7 +1135,8 @@ static void zvni_print_hash(struct hash_backet *backet, void *ctxt[])
|
|||||||
"%-10u %-4s %-21s %-8u %-8u %-15u %-37s\n",
|
"%-10u %-4s %-21s %-8u %-8u %-15u %-37s\n",
|
||||||
zvni->vni, "L2",
|
zvni->vni, "L2",
|
||||||
zvni->vxlan_if ? zvni->vxlan_if->name : "unknown",
|
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));
|
vrf_id_to_name(zvni->vrf_id));
|
||||||
else {
|
else {
|
||||||
char vni_str[VNI_STR_LEN];
|
char vni_str[VNI_STR_LEN];
|
||||||
@ -1858,7 +1859,6 @@ static int zvni_gw_macip_del(struct interface *ifp, zebra_vni_t *zvni,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* only need to delete the entry from bgp if we sent it before */
|
/* only need to delete the entry from bgp if we sent it before */
|
||||||
if (advertise_gw_macip_enabled(zvni)) {
|
|
||||||
if (IS_ZEBRA_DEBUG_VXLAN)
|
if (IS_ZEBRA_DEBUG_VXLAN)
|
||||||
zlog_debug("%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s del to BGP",
|
zlog_debug("%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s del to BGP",
|
||||||
ifp->vrf_id, ifp->name,
|
ifp->vrf_id, ifp->name,
|
||||||
@ -1871,7 +1871,6 @@ static int zvni_gw_macip_del(struct interface *ifp, zebra_vni_t *zvni,
|
|||||||
/* Remove neighbor from BGP. */
|
/* Remove neighbor from BGP. */
|
||||||
zvni_neigh_send_del_to_client(zvni->vni, &n->ip, &n->emac,
|
zvni_neigh_send_del_to_client(zvni->vni, &n->ip, &n->emac,
|
||||||
ZEBRA_MACIP_TYPE_GW);
|
ZEBRA_MACIP_TYPE_GW);
|
||||||
}
|
|
||||||
|
|
||||||
/* Delete this neighbor entry. */
|
/* Delete this neighbor entry. */
|
||||||
zvni_neigh_del(zvni, n);
|
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);
|
zebra_vxlan_process_l3vni_oper_down(zl3vni);
|
||||||
zl3vni->svi_if = NULL;
|
zl3vni->svi_if = NULL;
|
||||||
zl3vni->svi_if = zl3vni_map_to_svi_if(zl3vni);
|
zl3vni->svi_if = zl3vni_map_to_svi_if(zl3vni);
|
||||||
|
zl3vni->local_vtep_ip = vxl->vtep_ip;
|
||||||
if (is_l3vni_oper_up(zl3vni))
|
if (is_l3vni_oper_up(zl3vni))
|
||||||
zebra_vxlan_process_l3vni_oper_up(
|
zebra_vxlan_process_l3vni_oper_up(
|
||||||
zl3vni);
|
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 we have a valid new master, process l3-vni oper up */
|
||||||
if (chgflags & ZEBRA_VXLIF_MASTER_CHANGE) {
|
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);
|
zebra_vxlan_process_l3vni_oper_up(zl3vni);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -6704,6 +6721,10 @@ int zebra_vxlan_advertise_gw_macip(struct zserv *client, u_short length,
|
|||||||
struct interface *vlan_if = NULL;
|
struct interface *vlan_if = NULL;
|
||||||
struct interface *vrr_if = NULL;
|
struct interface *vrr_if = NULL;
|
||||||
|
|
||||||
|
zvni = zvni_lookup(vni);
|
||||||
|
if (!zvni)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (IS_ZEBRA_DEBUG_VXLAN)
|
if (IS_ZEBRA_DEBUG_VXLAN)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"EVPN gateway macip Adv %s on VNI %d , currently %s",
|
"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"
|
? "enabled"
|
||||||
: "disabled");
|
: "disabled");
|
||||||
|
|
||||||
zvni = zvni_lookup(vni);
|
|
||||||
if (!zvni)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (zvni->advertise_gw_macip == advertise)
|
if (zvni->advertise_gw_macip == advertise)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user