summaryrefslogtreecommitdiff
path: root/bgpd/bgp_nexthop.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_nexthop.c')
-rw-r--r--bgpd/bgp_nexthop.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 50ae74e4..4dd5d946 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -196,15 +196,15 @@ bgp_nexthop_check_ebgp (afi_t afi, struct attr *attr)
#ifdef HAVE_IPV6
else if (afi == AFI_IP6)
{
- if (attr->mp_nexthop_len == 32)
+ if (attr->extra->mp_nexthop_len == 32)
return 1;
- else if (attr->mp_nexthop_len == 16)
+ else if (attr->extra->mp_nexthop_len == 16)
{
- if (IN6_IS_ADDR_LINKLOCAL (&attr->mp_nexthop_global))
+ if (IN6_IS_ADDR_LINKLOCAL (&attr->extra->mp_nexthop_global))
return 1;
rn = bgp_node_match_ipv6 (bgp_connected_table[AFI_IP6],
- &attr->mp_nexthop_global);
+ &attr->extra->mp_nexthop_global);
if (rn)
{
bgp_unlock_node (rn);
@@ -230,21 +230,22 @@ bgp_nexthop_lookup_ipv6 (struct peer *peer, struct bgp_info *ri, int *changed,
/* If lookup is not enabled, return valid. */
if (zlookup->sock < 0)
{
- ri->igpmetric = 0;
+ if (ri->extra)
+ ri->extra->igpmetric = 0;
return 1;
}
/* Only check IPv6 global address only nexthop. */
attr = ri->attr;
- if (attr->mp_nexthop_len != 16
- || IN6_IS_ADDR_LINKLOCAL (&attr->mp_nexthop_global))
+ if (attr->extra->mp_nexthop_len != 16
+ || IN6_IS_ADDR_LINKLOCAL (&attr->extra->mp_nexthop_global))
return 1;
memset (&p, 0, sizeof (struct prefix));
p.family = AF_INET6;
p.prefixlen = IPV6_MAX_BITLEN;
- p.u.prefix6 = attr->mp_nexthop_global;
+ p.u.prefix6 = attr->extra->mp_nexthop_global;
/* IBGP or ebgp-multihop */
rn = bgp_node_get (bgp_nexthop_cache_table[AFI_IP6], &p);
@@ -256,7 +257,7 @@ bgp_nexthop_lookup_ipv6 (struct peer *peer, struct bgp_info *ri, int *changed,
}
else
{
- bnc = zlookup_query_ipv6 (&attr->mp_nexthop_global);
+ bnc = zlookup_query_ipv6 (&attr->extra->mp_nexthop_global);
if (bnc)
{
struct bgp_table *old;
@@ -296,10 +297,10 @@ bgp_nexthop_lookup_ipv6 (struct peer *peer, struct bgp_info *ri, int *changed,
if (metricchanged)
*metricchanged = bnc->metricchanged;
- if (bnc->valid)
- ri->igpmetric = bnc->metric;
- else
- ri->igpmetric = 0;
+ if (bnc->valid && bnc->metric)
+ (bgp_info_extra_get (ri))->igpmetric = bnc->metric;
+ else if (ri->extra)
+ ri->extra->igpmetric = 0;
return bnc->valid;
}
@@ -318,7 +319,8 @@ bgp_nexthop_lookup (afi_t afi, struct peer *peer, struct bgp_info *ri,
/* If lookup is not enabled, return valid. */
if (zlookup->sock < 0)
{
- ri->igpmetric = 0;
+ if (ri->extra)
+ ri->extra->igpmetric = 0;
return 1;
}
@@ -384,10 +386,10 @@ bgp_nexthop_lookup (afi_t afi, struct peer *peer, struct bgp_info *ri,
if (metricchanged)
*metricchanged = bnc->metricchanged;
- if (bnc->valid)
- ri->igpmetric = bnc->metric;
- else
- ri->igpmetric = 0;
+ if (bnc->valid && bnc->metric)
+ (bgp_info_extra_get(ri))->igpmetric = bnc->metric;
+ else if (ri->extra)
+ ri->extra->igpmetric = 0;
return bnc->valid;
}
@@ -490,7 +492,7 @@ bgp_scan (afi_t afi, safi_t safi)
if (CHECK_FLAG (bgp->af_flags[afi][SAFI_UNICAST],
BGP_CONFIG_DAMPENING)
- && bi->damp_info )
+ && bi->extra && bi->extra->damp_info )
if (bgp_damp_scan (bi, afi, SAFI_UNICAST))
bgp_aggregate_increment (bgp, &rn->p, bi,
afi, SAFI_UNICAST);