struct connected *c;
struct nbr_connected *nc;
struct listnode *node, *nnode;
- struct bgp *bgp_default = bgp_get_default();
struct bgp *bgp;
bgp = ifp->vrf->info;
hook_call(bgp_vrf_status_changed, bgp, ifp);
bgp_nht_ifp_up(ifp);
- if (bgp_default && if_is_loopback(ifp)) {
- vpn_leak_zebra_vrf_label_update(bgp, AFI_IP);
- vpn_leak_zebra_vrf_label_update(bgp, AFI_IP6);
- vpn_leak_zebra_vrf_sid_update(bgp, AFI_IP);
- vpn_leak_zebra_vrf_sid_update(bgp, AFI_IP6);
- vpn_leak_postchange_all();
- }
-
return 0;
}
struct connected *c;
struct nbr_connected *nc;
struct listnode *node, *nnode;
- struct bgp *bgp_default = bgp_get_default();
struct bgp *bgp;
struct peer *peer;
hook_call(bgp_vrf_status_changed, bgp, ifp);
bgp_nht_ifp_down(ifp);
- if (bgp_default && if_is_loopback(ifp)) {
- vpn_leak_zebra_vrf_label_update(bgp, AFI_IP);
- vpn_leak_zebra_vrf_label_update(bgp, AFI_IP6);
- vpn_leak_zebra_vrf_sid_update(bgp, AFI_IP);
- vpn_leak_zebra_vrf_sid_update(bgp, AFI_IP6);
- vpn_leak_postchange_all();
- }
-
return 0;
}
static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS)
{
struct listnode *node, *nnode;
- struct bgp_path_info *pi;
- struct bgp_table *table;
- struct bgp_dest *dest;
struct connected *ifc;
struct peer *peer;
- struct bgp *bgp, *from_bgp, *bgp_default;
- struct listnode *next;
+ struct bgp *bgp;
struct prefix *addr;
- afi_t afi;
- safi_t safi;
bgp = bgp_lookup_by_vrf_id(vrf_id);
* we do not want the peering to bounce.
*/
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
+ afi_t afi;
+ safi_t safi;
+
if (addr->family == AF_INET)
continue;
}
}
- bgp_default = bgp_get_default();
- afi = family2afi(addr->family);
- safi = SAFI_UNICAST;
-
- /* When the last IPv4 address was deleted, Linux removes all routes
- * using the interface so that bgpd needs to re-send them.
- */
- if (bgp_default && afi == AFI_IP) {
- for (ALL_LIST_ELEMENTS_RO(bm->bgp, next, from_bgp)) {
- table = from_bgp->rib[afi][safi];
- if (!table)
- continue;
-
- for (dest = bgp_table_top(table); dest;
- dest = bgp_route_next(dest)) {
- for (pi = bgp_dest_get_bgp_path_info(dest); pi;
- pi = pi->next) {
- if (pi->type == ZEBRA_ROUTE_BGP &&
- pi->attr &&
- pi->attr->nh_ifindex ==
- ifc->ifp->ifindex) {
- SET_FLAG(pi->attr->nh_flag,
- BGP_ATTR_NH_REFRESH);
- }
- }
- }
-
- if (from_bgp->inst_type != BGP_INSTANCE_TYPE_VRF)
- continue;
-
- vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN, afi,
- bgp_default, from_bgp);
-
- vpn_leak_postchange(BGP_VPN_POLICY_DIR_FROMVPN, afi,
- bgp_default, from_bgp);
- }
- }
-
connected_free(&ifc);
return 0;
|| path->attr->mp_nexthop_len
== BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL) {
/* Check if route-map is set to prefer global over link-local */
- if (CHECK_FLAG(path->attr->nh_flag,
- BGP_ATTR_NH_MP_PREFER_GLOBAL)) {
+ if (path->attr->mp_nexthop_prefer_global) {
nexthop = &path->attr->mp_nexthop_global;
if (IN6_IS_ADDR_LINKLOCAL(nexthop))
*ifindex = path->attr->nh_ifindex;
uint8_t distance;
struct peer *peer;
struct bgp_path_info *mpinfo;
- struct bgp_path_info *bpi_ultimate;
struct bgp *bgp_orig;
uint32_t metric;
struct attr local_attr;
peer = info->peer;
- if (info->type == ZEBRA_ROUTE_BGP) {
- bpi_ultimate = bgp_get_imported_bpi_ultimate(info);
- peer = bpi_ultimate->peer;
+ if (info->type == ZEBRA_ROUTE_BGP
+ && info->sub_type == BGP_ROUTE_IMPORTED) {
+
+ /* Obtain peer from parent */
+ if (info->extra && info->extra->parent)
+ peer = ((struct bgp_path_info *)(info->extra->parent))
+ ->peer;
}
tag = info->attr->tag;
static int bgp_ifp_create(struct interface *ifp)
{
- struct bgp *bgp_default = bgp_get_default();
struct bgp *bgp;
if (BGP_DEBUG(zebra, ZEBRA))
bgp_update_interface_nbrs(bgp, ifp, ifp);
hook_call(bgp_vrf_status_changed, bgp, ifp);
-
- if (bgp_default &&
- (if_is_loopback_exact(ifp) ||
- (if_is_vrf(ifp) && ifp->vrf->vrf_id != VRF_DEFAULT))) {
- vpn_leak_zebra_vrf_label_update(bgp, AFI_IP);
- vpn_leak_zebra_vrf_label_update(bgp, AFI_IP6);
- vpn_leak_zebra_vrf_sid_update(bgp, AFI_IP);
- vpn_leak_zebra_vrf_sid_update(bgp, AFI_IP6);
- vpn_leak_postchange_all();
- }
-
return 0;
}