1*f3ac6781SToomas Soome /* 2*f3ac6781SToomas Soome * Copyright (C) 1993-2001 by Darren Reed. 3*f3ac6781SToomas Soome * 4*f3ac6781SToomas Soome * See the IPFILTER.LICENCE file for details on licencing. 5*f3ac6781SToomas Soome * 6*f3ac6781SToomas Soome * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 7*f3ac6781SToomas Soome * Use is subject to license terms. 8*f3ac6781SToomas Soome */ 9*f3ac6781SToomas Soome 10*f3ac6781SToomas Soome #include "ipf.h" 11*f3ac6781SToomas Soome nat_setgroupmap(n)12*f3ac6781SToomas Soomevoid nat_setgroupmap(n) 13*f3ac6781SToomas Soome ipnat_t *n; 14*f3ac6781SToomas Soome { 15*f3ac6781SToomas Soome if (n->in_outmsk == n->in_inmsk) 16*f3ac6781SToomas Soome n->in_ippip = 1; 17*f3ac6781SToomas Soome else if (n->in_flags & IPN_AUTOPORTMAP) { 18*f3ac6781SToomas Soome n->in_ippip = ~ntohl(n->in_inmsk); 19*f3ac6781SToomas Soome if (n->in_outmsk != 0xffffffff) 20*f3ac6781SToomas Soome n->in_ippip /= (~ntohl(n->in_outmsk) + 1); 21*f3ac6781SToomas Soome n->in_ippip++; 22*f3ac6781SToomas Soome if (n->in_ippip == 0) 23*f3ac6781SToomas Soome n->in_ippip = 1; 24*f3ac6781SToomas Soome n->in_ppip = USABLE_PORTS / n->in_ippip; 25*f3ac6781SToomas Soome } else { 26*f3ac6781SToomas Soome n->in_space = USABLE_PORTS * ~ntohl(n->in_outmsk); 27*f3ac6781SToomas Soome n->in_nip = 0; 28*f3ac6781SToomas Soome if (!(n->in_ppip = n->in_pmin)) 29*f3ac6781SToomas Soome n->in_ppip = 1; 30*f3ac6781SToomas Soome n->in_ippip = USABLE_PORTS / n->in_ppip; 31*f3ac6781SToomas Soome } 32*f3ac6781SToomas Soome } 33