diff options
Diffstat (limited to 'bgpd/bgp_zebra.c')
| -rw-r--r-- | bgpd/bgp_zebra.c | 106 |
1 files changed, 38 insertions, 68 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index db5c877759..cd1873054e 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1305,43 +1305,36 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, ATTR_FLAG_BIT(BGP_ATTR_SRTE_COLOR))) api_nh->srte_color = info->attr->srte_color; - if (nh_family == AF_INET) { - if (bgp_debug_zebra(&api.prefix)) { - if (mpinfo->extra) { - zlog_debug( - "%s: p=%s, bgp_is_valid_label: %d", - __func__, buf_prefix, - bgp_is_valid_label( - &mpinfo->extra - ->label[0])); - } else { - zlog_debug( - "%s: p=%s, extra is NULL, no label", - __func__, buf_prefix); - } - } - - if (bgp->table_map[afi][safi].name) { - /* Copy info and attributes, so the route-map - apply doesn't modify the BGP route info. */ - local_attr = *mpinfo->attr; - mpinfo_cp->attr = &local_attr; + if (bgp_debug_zebra(&api.prefix)) { + if (mpinfo->extra) { + zlog_debug("%s: p=%s, bgp_is_valid_label: %d", + __func__, buf_prefix, + bgp_is_valid_label( + &mpinfo->extra->label[0])); + } else { + zlog_debug("%s: p=%s, extra is NULL, no label", + __func__, buf_prefix); } + } - if (bgp->table_map[afi][safi].name) { - if (!bgp_table_map_apply( - bgp->table_map[afi][safi].map, p, - mpinfo_cp)) - continue; + if (bgp->table_map[afi][safi].name) { + /* Copy info and attributes, so the route-map + apply doesn't modify the BGP route info. */ + local_attr = *mpinfo->attr; + mpinfo_cp->attr = &local_attr; + if (!bgp_table_map_apply(bgp->table_map[afi][safi].map, + p, mpinfo_cp)) + continue; - /* metric/tag is only allowed to be - * overridden on 1st nexthop */ - if (mpinfo == info) { - metric = mpinfo_cp->attr->med; - tag = mpinfo_cp->attr->tag; - } + /* metric/tag is only allowed to be + * overridden on 1st nexthop */ + if (mpinfo == info) { + metric = mpinfo_cp->attr->med; + tag = mpinfo_cp->attr->tag; } + } + if (nh_family == AF_INET) { nh_updated = update_ipv4nh_for_route_install( nh_othervrf, nh_othervrf ? @@ -1352,31 +1345,6 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, ifindex_t ifindex = IFINDEX_INTERNAL; struct in6_addr *nexthop; - if (bgp->table_map[afi][safi].name) { - /* Copy info and attributes, so the route-map - apply doesn't modify the BGP route info. */ - local_attr = *mpinfo->attr; - mpinfo_cp->attr = &local_attr; - } - - if (bgp->table_map[afi][safi].name) { - /* Copy info and attributes, so the route-map - apply doesn't modify the BGP route info. */ - local_attr = *mpinfo->attr; - mpinfo_cp->attr = &local_attr; - - if (!bgp_table_map_apply( - bgp->table_map[afi][safi].map, p, - mpinfo_cp)) - continue; - - /* metric/tag is only allowed to be - * overridden on 1st nexthop */ - if (mpinfo == info) { - metric = mpinfo_cp->attr->med; - tag = mpinfo_cp->attr->tag; - } - } nexthop = bgp_path_info_to_ipv6_nexthop(mpinfo_cp, &ifindex); nh_updated = update_ipv6nh_for_route_install( @@ -1499,9 +1467,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, api_nh->vrf_id, api_nh->weight, label_buf, eth_buf); } - } - if (bgp_debug_zebra(p)) { int recursion_flag = 0; if (CHECK_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION)) @@ -2409,7 +2375,6 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, struct prefix p; enum zapi_route_notify_owner note; uint32_t table_id; - char buf[PREFIX_STRLEN]; afi_t afi; safi_t safi; struct bgp_dest *dest; @@ -2431,9 +2396,6 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, return -1; } - if (BGP_DEBUG(zebra, ZEBRA)) - prefix2str(&p, buf, sizeof(buf)); - /* Find the bgp route node */ dest = bgp_afi_node_lookup(bgp->rib[afi][safi], afi, safi, &p, &bgp->vrf_prd); @@ -2452,7 +2414,7 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, BGP_NODE_FIB_INSTALL_PENDING); SET_FLAG(dest->flags, BGP_NODE_FIB_INSTALLED); if (BGP_DEBUG(zebra, ZEBRA)) - zlog_debug("route %s : INSTALLED", buf); + zlog_debug("route %pRN : INSTALLED", dest); /* Find the best route */ for (pi = dest->info; pi; pi = pi->next) { /* Process aggregate route */ @@ -2468,8 +2430,8 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, dest, new_select); else { flog_err(EC_BGP_INVALID_ROUTE, - "selected route %s not found", - buf); + "selected route %pRN not found", + dest); return -1; } } @@ -2480,16 +2442,24 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, * route add later */ UNSET_FLAG(dest->flags, BGP_NODE_FIB_INSTALLED); + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("route %pRN: Removed from Fib", dest); break; case ZAPI_ROUTE_FAIL_INSTALL: + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("route: %pRN Failed to Install into Fib", + dest); /* Error will be logged by zebra module */ break; case ZAPI_ROUTE_BETTER_ADMIN_WON: + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("route: %pRN removed due to better admin won", + dest); /* No action required */ break; case ZAPI_ROUTE_REMOVE_FAIL: - zlog_warn("%s: Route %s failure to remove", - __func__, buf); + zlog_warn("%s: Route %pRN failure to remove", + __func__, dest); break; } return 0; |
