summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Jakma <paul@quagga.net>2012-01-09 11:36:23 +0000
committerPaul Jakma <paul@quagga.net>2012-01-09 11:36:23 +0000
commitfc98d16ea77372f4ab4231e8904f8467e8d1ef71 (patch)
treead69423081bd300c5a60262f947760ac7189744f
parentdc00d2bb56aa6a84dd2328133f69db3c3e6d9dc7 (diff)
bgpd: reinstate zlookup checks, required for BGP without zebra
* bgp_nexthop.c: The nexthop lookup cache has to return success for queried nexthops if bgpd isn't connected to zebra, or else BGP without zebra doesn't work.
-rw-r--r--bgpd/bgp_nexthop.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index e9c78b3f..fdf251b2 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -174,7 +174,11 @@ int
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)
{
@@ -218,7 +222,15 @@ bgp_nexthop_lookup_ipv6 (struct peer *peer, struct bgp_info *ri, int *changed,
struct prefix p;
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;
@@ -296,7 +308,15 @@ bgp_nexthop_lookup (afi_t afi, struct peer *peer, struct bgp_info *ri,
struct prefix p;
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);