diff options
author | peter <peter@FreeBSD.org> | 1998-06-20 18:29:38 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1998-06-20 18:29:38 +0000 |
commit | 9529c38ad8859b9f325867d97f266101f2c4dca3 (patch) | |
tree | 7c9206c000e7ad493db842a3fecdf77deacb096a /contrib/ipfilter/ip_proxy.c | |
parent | 58e3555d887b6a5b1f460d8ee84ca4e97c0a8217 (diff) | |
download | FreeBSD-src-9529c38ad8859b9f325867d97f266101f2c4dca3.zip FreeBSD-src-9529c38ad8859b9f325867d97f266101f2c4dca3.tar.gz |
Import trimmed version of ipfilter 3.2.7.
Obtained from: Darren Reed via http://cheops.anu.edu.au/~avalon/
Diffstat (limited to 'contrib/ipfilter/ip_proxy.c')
-rw-r--r-- | contrib/ipfilter/ip_proxy.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/contrib/ipfilter/ip_proxy.c b/contrib/ipfilter/ip_proxy.c index cc3b9a0..0fb7e95 100644 --- a/contrib/ipfilter/ip_proxy.c +++ b/contrib/ipfilter/ip_proxy.c @@ -6,7 +6,7 @@ * to the original author and the contributors. */ #if !defined(lint) -static const char rcsid[] = "@(#)$Id: ip_proxy.c,v 2.0.2.11.2.6 1997/11/28 00:41:25 darrenr Exp $"; +static const char rcsid[] = "@(#)$Id: ip_proxy.c,v 2.0.2.11.2.7 1998/05/18 11:15:22 darrenr Exp $"; #endif #if defined(__FreeBSD__) && defined(KERNEL) && !defined(_KERNEL) @@ -111,15 +111,37 @@ ipnat_t *nat; } +static int +ap_matchsrcdst(aps, src, dst, tcp, sport, dport) +ap_session_t *aps; +struct in_addr src, dst; +void *tcp; +u_short sport, dport; +{ + if (aps->aps_dst.s_addr == dst.s_addr) { + if ((aps->aps_src.s_addr == src.s_addr) && + (!tcp || (sport == aps->aps_sport) && + (dport == aps->aps_dport))) + return 1; + } else if (aps->aps_dst.s_addr == src.s_addr) { + if ((aps->aps_src.s_addr == dst.s_addr) && + (!tcp || (sport == aps->aps_dport) && + (dport == aps->aps_sport))) + return 1; + } + return 0; +} + + static ap_session_t *ap_find(ip, tcp) ip_t *ip; tcphdr_t *tcp; { - struct in_addr src, dst; - register u_long hv; - register u_short sp, dp; - register ap_session_t *aps; register u_char p = ip->ip_p; + register ap_session_t *aps; + register u_short sp, dp; + register u_long hv; + struct in_addr src, dst; src = ip->ip_src, dst = ip->ip_dst; sp = dp = 0; /* XXX gcc -Wunitialized */ @@ -136,14 +158,8 @@ tcphdr_t *tcp; for (aps = ap_sess_tab[hv]; aps; aps = aps->aps_next) if ((aps->aps_p == p) && - IPPAIR(aps->aps_src, aps->aps_dst, src, dst)) { - if (tcp) { - if (PAIRS(aps->aps_sport, aps->aps_dport, - sp, dp)) - break; - } else - break; - } + ap_matchsrcdst(aps, src, dst, tcp, sp, dp)) + break; return aps; } |