&& !CHECK_FLAG(peer->bgp->flags, BGP_FLAG_DISABLE_NH_CONNECTED_CHK))
connected = 1;
- return bgp_find_or_add_nexthop(
- peer->bgp, peer->bgp, family2afi(peer->su.sa.sa_family),
- NULL, peer, connected);
+ return bgp_find_or_add_nexthop(peer->bgp, peer->bgp,
+ family2afi(peer->su.sa.sa_family),
+ SAFI_UNICAST, NULL, peer, connected);
}
static void peer_xfer_stats(struct peer *peer_dst, struct peer *peer_src)
* TBD do we need to do anything about the
* 'connected' parameter?
*/
- nh_valid = bgp_find_or_add_nexthop(bgp, bgp_nexthop,
- afi, bpi, NULL, 0);
+ nh_valid = bgp_find_or_add_nexthop(
+ bgp, bgp_nexthop, afi, safi, bpi, NULL, 0);
if (debug)
zlog_debug("%s: nexthop is %svalid (in vrf %s)",
* TBD do we need to do anything about the
* 'connected' parameter?
*/
- nh_valid = bgp_find_or_add_nexthop(bgp, bgp_nexthop,
- afi, new, NULL, 0);
+ nh_valid = bgp_find_or_add_nexthop(bgp, bgp_nexthop, afi, safi,
+ new, NULL, 0);
if (debug)
zlog_debug("%s: nexthop is %svalid (in vrf %s)",
* we need both the bgp_route and bgp_nexthop pointers.
*/
int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
- afi_t afi, struct bgp_path_info *pi,
+ afi_t afi, safi_t safi, struct bgp_path_info *pi,
struct peer *peer, int connected)
{
struct bgp_nexthop_cache_head *tree = NULL;
*/
if (bgp_route->inst_type == BGP_INSTANCE_TYPE_VIEW)
return 1;
- else
+ else if (safi == SAFI_UNICAST && pi
+ && pi->sub_type == BGP_ROUTE_IMPORTED && pi->extra
+ && pi->extra->num_labels) {
+ return bgp_isvalid_labeled_nexthop(bnc);
+ } else
return (bgp_isvalid_nexthop(bnc));
}
* bgp_route - BGP instance of route
* bgp_nexthop - BGP instance of nexthop
* a - afi: AFI_IP or AF_IP6
+ * safi - safi: to check which table nhs are being imported to
* p - path for which the nexthop object is being looked up
* peer - The BGP peer associated with this NHT
* connected - True if NH MUST be a connected route
*/
extern int bgp_find_or_add_nexthop(struct bgp *bgp_route,
struct bgp *bgp_nexthop, afi_t a,
- struct bgp_path_info *p, struct peer *peer,
- int connected);
+ safi_t safi, struct bgp_path_info *p,
+ struct peer *peer, int connected);
/**
* bgp_unlink_nexthop() - Unlink the nexthop object from the path structure.
nh_afi = BGP_ATTR_NH_AFI(afi, pi->attr);
if (bgp_find_or_add_nexthop(bgp, bgp_nexthop, nh_afi,
- pi, NULL, connected)
+ safi, pi, NULL, connected)
|| CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD))
bgp_path_info_set_flag(dest, pi,
BGP_PATH_VALID);
nh_afi = BGP_ATTR_NH_AFI(afi, new->attr);
- if (bgp_find_or_add_nexthop(bgp, bgp, nh_afi, new, NULL,
+ if (bgp_find_or_add_nexthop(bgp, bgp, nh_afi, safi, new, NULL,
connected)
|| CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD))
bgp_path_info_set_flag(dest, new, BGP_PATH_VALID);
bgp_nexthop = pi->extra->bgp_orig;
if (bgp_find_or_add_nexthop(bgp, bgp_nexthop,
- afi, pi, NULL, 0))
+ afi, safi, pi, NULL,
+ 0))
bgp_path_info_set_flag(dest, pi,
BGP_PATH_VALID);
else {
/* Nexthop reachability check. */
if (CHECK_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK)
&& (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST)) {
- if (bgp_find_or_add_nexthop(bgp, bgp, afi, new, NULL, 0))
+ if (bgp_find_or_add_nexthop(bgp, bgp, afi, safi, new, NULL, 0))
bgp_path_info_set_flag(dest, new, BGP_PATH_VALID);
else {
if (BGP_DEBUG(nht, NHT)) {