vif.c: Fallback on routing table for neighbor checks
Falling back on the routing table allows for a dynamic routing protocol
to provide adjacency with PIM routers that would otherwise fail the
subnet check.
@@ -590,6 +590,7 @@ vifi_t find_vif_direct(uint32_t src)
vifi_t vifi;
struct uvif *v;
struct phaddr *p;
+ struct rpfctl rpf;
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
if (v->uv_flags & (VIFF_DISABLED | VIFF_DOWN | VIFF_REGISTER | VIFF_TUNNEL))
@@ -613,6 +614,13 @@ vifi_t find_vif_direct(uint32_t src)
return vifi;
}
+ /* Check if the routing table has a direct route (no gateway). */
+ if (k_req_incoming(src, &rpf)) {
+ if (rpf.source.s_addr == rpf.rpfneighbor.s_addr) {
+ return rpf.iif;
+ }
+ }
+
return NO_VIF;
}
@@ -650,6 +658,7 @@ vifi_t find_vif_direct_local(uint32_t src)
vifi_t vifi;
struct uvif *v;
struct phaddr *p;
+ struct rpfctl rpf;
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
/* TODO: XXX: what about VIFF_TUNNEL? */
@@ -674,6 +683,13 @@ vifi_t find_vif_direct_local(uint32_t src)
return vifi;
}
+ /* Check if the routing table has a direct route (no gateway). */
+ if (k_req_incoming(src, &rpf)) {
+ if (rpf.source.s_addr == rpf.rpfneighbor.s_addr) {
+ return rpf.iif;
+ }
+ }
+
return NO_VIF;
}
