diff options
author | Cy Schubert <cy@FreeBSD.org> | 2014-10-05 03:58:30 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2014-10-05 03:58:30 +0000 |
commit | 2777bfabc064d70f4ca6e94be8c188547188c699 (patch) | |
tree | caf9b1afd303932bb8799a1976db0ddedcf56fb4 | |
parent | 3a77b75120868c80a0b0f7636973a652003dbd84 (diff) | |
download | src-2777bfabc064d70f4ca6e94be8c188547188c699.tar.gz src-2777bfabc064d70f4ca6e94be8c188547188c699.zip |
ipfilter bug #537 NAT rules with sticky have incorrect hostmap IP address.
This fixes when an IP address mapping is put in the hostmap table for
sticky NAT rules, it ends up having the wrong byte order.
Obtained from: ipfilter CVS repo (r1.102), NetBSD CVS repo (r1.12)
Notes
Notes:
svn path=/head/; revision=272555
-rw-r--r-- | sys/contrib/ipfilter/netinet/ip_nat.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index d6647085a7eb..6c93810c215a 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -2946,10 +2946,11 @@ ipf_nat_newrdr(fin, nat, ni) */ if (np->in_flags & IPN_SPLIT) { in.s_addr = np->in_dnip; + inb.s_addr = htonl(in.s_addr); if ((np->in_flags & (IPN_ROUNDR|IPN_STICKY)) == IPN_STICKY) { hm = ipf_nat_hostmap(softn, NULL, fin->fin_src, - fin->fin_dst, in, (u_32_t)dport); + fin->fin_dst, inb, (u_32_t)dport); if (hm != NULL) { in.s_addr = hm->hm_ndstip.s_addr; move = 0; @@ -3050,13 +3051,14 @@ ipf_nat_newrdr(fin, nat, ni) return -1; } + inb.s_addr = htonl(in.s_addr); nat->nat_ndstaddr = htonl(in.s_addr); nat->nat_odstip = fin->fin_dst; nat->nat_nsrcip = fin->fin_src; nat->nat_osrcip = fin->fin_src; if ((nat->nat_hm == NULL) && ((np->in_flags & IPN_STICKY) != 0)) nat->nat_hm = ipf_nat_hostmap(softn, np, fin->fin_src, - fin->fin_dst, in, (u_32_t)dport); + fin->fin_dst, inb, (u_32_t)dport); if (flags & IPN_TCPUDP) { nat->nat_odport = dport; |