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)
This commit is contained in:
cy 2014-10-05 03:58:30 +00:00
parent f489a2c589
commit de281a2318

View File

@ -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;