Extend versrcreach by checking against the rt_flags for RTF_REJECT and

RTF_BLACKHOLE as well.

To quote the submitter:

 The uRPF loose-check implementation by the industry vendors, at least on Cisco
 and possibly Juniper, will fail the check if the route of the source address
 is pointed to Null0 (on Juniper, discard or reject route). What this means is,
 even if uRPF Loose-check finds the route, if the route is pointed to blackhole,
 uRPF loose-check must fail. This allows people to utilize uRPF loose-check mode
 as a pseudo-packet-firewall without using any manual filtering configuration --
 one can simply inject a IGP or BGP prefix with next-hop set to a static route
 that directs to null/discard facility. This results in uRPF Loose-check failing
 on all packets with source addresses that are within the range of the nullroute.

Submitted by:	James Jun <james@towardex.com>
This commit is contained in:
andre 2004-07-21 19:55:14 +00:00
parent e9050ad7ae
commit 2b19687226
2 changed files with 8 additions and 2 deletions

View File

@ -1267,8 +1267,8 @@ packets with source addresses not from this interface.
.It Cm versrcreach
For incoming packets,
a routing table lookup is done on the packet's source address.
If a route to the source address exists, but not the default route,
the packet matches.
If a route to the source address exists, but not the default route
or a blackhole/reject route, the packet matches.
Otherwise the packet does not match.
All outgoing packets match.
.Pp

View File

@ -506,6 +506,12 @@ verify_path(struct in_addr src, struct ifnet *ifp)
return 0;
}
/* or if this is a blackhole/reject route */
if (ifp == NULL && ro.ro_rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) {
RTFREE(ro.ro_rt);
return 0;
}
/* found valid route */
RTFREE(ro.ro_rt);
return 1;