diff options
author | andre <andre@FreeBSD.org> | 2003-11-27 09:40:13 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2003-11-27 09:40:13 +0000 |
commit | f3b2f134c79d6eab66155734154a2a52812fbc4e (patch) | |
tree | dfae84dc9e6b362b1c6f1df81dc5f44977564252 /sys/netinet/ip_fw2.c | |
parent | 03480fac227a174c542c25b116c230e275646e0c (diff) | |
download | FreeBSD-src-f3b2f134c79d6eab66155734154a2a52812fbc4e.zip FreeBSD-src-f3b2f134c79d6eab66155734154a2a52812fbc4e.tar.gz |
Fix verify_rev_path() function. The author of this function tried to
cut corners which completely broke down when the routing table locking
was introduced.
Reviewed by: sam (mentor)
Approved by: re (rwatson)
Diffstat (limited to 'sys/netinet/ip_fw2.c')
-rw-r--r-- | sys/netinet/ip_fw2.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/sys/netinet/ip_fw2.c b/sys/netinet/ip_fw2.c index a532a6d..6511722 100644 --- a/sys/netinet/ip_fw2.c +++ b/sys/netinet/ip_fw2.c @@ -453,22 +453,16 @@ iface_match(struct ifnet *ifp, ipfw_insn_if *cmd) static int verify_rev_path(struct in_addr src, struct ifnet *ifp) { - static struct route ro; + struct route ro; struct sockaddr_in *dst; - dst = (struct sockaddr_in *)&(ro.ro_dst); - - /* Check if we've cached the route from the previous call. */ - if (src.s_addr != dst->sin_addr.s_addr) { - ro.ro_rt = NULL; - - bzero(dst, sizeof(*dst)); - dst->sin_family = AF_INET; - dst->sin_len = sizeof(*dst); - dst->sin_addr = src; + bzero(&ro, sizeof(ro)); - rtalloc_ign(&ro, RTF_CLONING); - } + dst = (struct sockaddr_in *)&(ro.ro_dst); + dst->sin_family = AF_INET; + dst->sin_len = sizeof(*dst); + dst->sin_addr = src; + rtalloc_ign(&ro, RTF_CLONING); if (ro.ro_rt == NULL) return 0; |