diff options
author | zec <zec@FreeBSD.org> | 2011-07-08 09:38:33 +0000 |
---|---|---|
committer | zec <zec@FreeBSD.org> | 2011-07-08 09:38:33 +0000 |
commit | 99a0b299b3e1499b4637e127d2dd98bbf780464e (patch) | |
tree | aad8ef2126dd98c18ff880e797ec2c49495f9e91 /sys/netinet/in.c | |
parent | cbb0abbaca8551d0b28a2e9050b36edd3a891bac (diff) | |
download | FreeBSD-src-99a0b299b3e1499b4637e127d2dd98bbf780464e.zip FreeBSD-src-99a0b299b3e1499b4637e127d2dd98bbf780464e.tar.gz |
Permit ARP to proceed for IPv4 host routes for which the gateway is the
same as the host address. This already works fine for INET6 and ND6.
While here, remove two function pointers from struct lltable which are
only initialized but never used.
MFC after: 3 days
Diffstat (limited to 'sys/netinet/in.c')
-rw-r--r-- | sys/netinet/in.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 7ae8477..c090117 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1416,6 +1416,18 @@ in_lltable_rtcheck(struct ifnet *ifp, u_int flags, const struct sockaddr *l3addr /* XXX rtalloc1 should take a const param */ rt = rtalloc1(__DECONST(struct sockaddr *, l3addr), 0, 0); + + /* + * If the gateway for an existing host route matches the target L3 + * address, allow for ARP to proceed. + */ + if (rt != NULL && (rt->rt_flags & (RTF_HOST|RTF_GATEWAY)) && + rt->rt_gateway->sa_family == AF_INET && + memcmp(rt->rt_gateway->sa_data, l3addr->sa_data, 4) == 0) { + RTFREE_LOCKED(rt); + return (0); + } + if (rt == NULL || (!(flags & LLE_PUB) && ((rt->rt_flags & RTF_GATEWAY) || (rt->rt_ifp != ifp)))) { @@ -1599,10 +1611,8 @@ in_domifattach(struct ifnet *ifp) llt = lltable_init(ifp, AF_INET); if (llt != NULL) { - llt->llt_new = in_lltable_new; llt->llt_free = in_lltable_free; llt->llt_prefix_free = in_lltable_prefix_free; - llt->llt_rtcheck = in_lltable_rtcheck; llt->llt_lookup = in_lltable_lookup; llt->llt_dump = in_lltable_dump; } |