From bed50e27dd14aa98a89a2c9e0e7a63a87bcaa830 Mon Sep 17 00:00:00 2001
From: Shaun Crampton <shaun.crampton@metaswitch.com>
Date: Wed, 17 Jun 2015 16:14:41 -0700
Subject: [PATCH 3/3] Disable recursive route check for GCE compatibility.

GCE uses a /32 for VM IPs with a default gateway that is, thus,
off-subnet.  This patch removes a check in BIRD that prevents
BIRD from accepting such a route as a valid next hop.

The following trail asserts that the check is not really needed
but that it is normally a useful sanity check:

https://www.mail-archive.com/bird-users@atrey.karlin.mff.cuni.cz/msg02600.html

Ideally GCE would set the online flag on the route or use a
link-local IP instead but that is unlikely to change.
---
 sysdep/linux/netlink.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index d754df7..3ac5b27 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -521,8 +521,7 @@ nl_parse_multipath(struct krt_proto *p, struct rtattr *ra)
 	  memcpy(&rv->gw, RTA_DATA(a[RTA_GATEWAY]), sizeof(ip_addr));
 	  ipa_ntoh(rv->gw);
 
-	  neighbor *ng = neigh_find2(&p->p, &rv->gw, rv->iface,
-				     (nh->rtnh_flags & RTNH_F_ONLINK) ? NEF_ONLINK : 0);
+	  neighbor *ng = neigh_find2(&p->p, &rv->gw, rv->iface, NEF_ONLINK);
 	  if (!ng || (ng->scope == SCOPE_HOST))
 	    return NULL;
 	}
@@ -1290,8 +1289,7 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
 	    return;
 #endif
 
-	  ng = neigh_find2(&p->p, &ra->gw, ra->iface,
-			   (i->rtm_flags & RTNH_F_ONLINK) ? NEF_ONLINK : 0);
+	  ng = neigh_find2(&p->p, &ra->gw, ra->iface, NEF_ONLINK);
 	  if (!ng || (ng->scope == SCOPE_HOST))
 	    {
 	      log(L_ERR "KRT: Received route %I/%d with strange next-hop %I",
-- 
2.7.4

