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.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index db121d2c..dc448f9f 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -175,10 +175,6 @@ bgp_nexthop_onlink (afi_t afi, struct attr *attr)
{
struct bgp_node *rn;
- /* If zebra is not enabled return */
- if (zlookup->sock < 0)
- return 1;
-
/* Lookup the address is onlink or not. */
if (afi == AFI_IP)
{
@@ -223,14 +219,6 @@ bgp_nexthop_lookup_ipv6 (struct peer *peer, struct bgp_info *ri, int *changed,
struct bgp_nexthop_cache *bnc;
struct attr *attr;
- /* If lookup is not enabled, return valid. */
- if (zlookup->sock < 0)
- {
- if (ri->extra)
- ri->extra->igpmetric = 0;
- return 1;
- }
-
/* Only check IPv6 global address only nexthop. */
attr = ri->attr;
@@ -253,8 +241,9 @@ bgp_nexthop_lookup_ipv6 (struct peer *peer, struct bgp_info *ri, int *changed,
}
else
{
- bnc = zlookup_query_ipv6 (&attr->extra->mp_nexthop_global);
- if (bnc)
+ if (NULL == (bnc = zlookup_query_ipv6 (&attr->extra->mp_nexthop_global)))
+ bnc = bnc_new ();
+ else
{
if (changed)
{
@@ -280,10 +269,6 @@ bgp_nexthop_lookup_ipv6 (struct peer *peer, struct bgp_info *ri, int *changed,
}
}
}
- else
- {
- bnc = bnc_new ();
- }
rn->info = bnc;
}
@@ -312,14 +297,6 @@ bgp_nexthop_lookup (afi_t afi, struct peer *peer, struct bgp_info *ri,
struct bgp_nexthop_cache *bnc;
struct in_addr addr;
- /* If lookup is not enabled, return valid. */
- if (zlookup->sock < 0)
- {
- if (ri->extra)
- ri->extra->igpmetric = 0;
- return 1;
- }
-
#ifdef HAVE_IPV6
if (afi == AFI_IP6)
return bgp_nexthop_lookup_ipv6 (peer, ri, changed, metricchanged);
@@ -342,8 +319,9 @@ bgp_nexthop_lookup (afi_t afi, struct peer *peer, struct bgp_info *ri,
}
else
{
- bnc = zlookup_query (addr);
- if (bnc)
+ if (NULL == (bnc = zlookup_query (addr)))
+ bnc = bnc_new ();
+ else
{
if (changed)
{
@@ -369,10 +347,6 @@ bgp_nexthop_lookup (afi_t afi, struct peer *peer, struct bgp_info *ri,
}
}
}
- else
- {
- bnc = bnc_new ();
- }
rn->info = bnc;
}