Bug 30315

Summary: ifpw broken: curr_dyn_buckets cannot be changed
Product: Base System Reporter: Christian Wittenhorst <wiwi>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Christian Wittenhorst 2001-09-04 16:20:01 UTC
Bug in: /usr/src/sys/netinet/ip_fw.c
"static void
add_dyn_rule(struct ipfw_flow_id *id, struct ipfw_flow_id *mask,
       struct ip_fw_chain *chain)"

curr_dyn_buckets will never be updated! There is a statement missing!

if (i != 1) /* not a power of 2 */
           dyn_buckets = curr_dyn_buckets ; /* reset */       
       else {
******
******
the following statement is missing in the original sources!
******
******
           curr_dyn_buckets = dyn_buckets;

******
******
end of changes
******
******

           if (ipfw_dyn_v != NULL)
                free(ipfw_dyn_v, M_IPFW);
           ipfw_dyn_v = malloc(curr_dyn_buckets * sizeof r,
                   M_IPFW, M_DONTWAIT | M_ZERO);
           if (ipfw_dyn_v == NULL)      
                return ; /* failed ! */

Fix: 

insert:
         curr_dyn_buckets = dyn_buckets;
as shown above!
How-To-Repeat: just try to change the number of buckets for dynamic rules!

eg:
sysctl -w net.inet.ip.fw.dyn_buckets=8192

the number will never be changed actually...
Comment 1 Maxim Konovalov 2002-01-23 10:37:02 UTC
Fixed in -current and -stable:

http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netinet/ip_fw.c?rev=1.167&content-type=text/x-cvsweb-markup

-- 
Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer
phone: +7 (095) 796-9079, mailto: maxim@macomnet.ru
Comment 2 Crist J. Clark freebsd_committer freebsd_triage 2002-01-23 12:09:23 UTC
State Changed
From-To: open->closed

Fixed in CURRENT (1.167) and STABLE (1.131.2.27).