Date: Tue, 22 Apr 2003 14:52:47 +0400 From: "Kozin Maxim V." <maxes@peterlink.ru> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/51274: ipfw2 create dynamic rules with parent number 65535 Message-ID: <E197vOJ-000B6M-00@solo.peterlink.ru> Resent-Message-ID: <200304221100.h3MB0Vsk050469@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 51274 >Category: kern >Synopsis: ipfw2 create dynamic rules with parent number 65535 >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Apr 22 04:00:30 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Kozin Maxim >Release: FreeBSD 4.7-RELEASE-p7 i386 >Organization: maxes@peterlink.ru >Environment: System: FreeBSD 4.7-RELEASE-p7 i386 >Description: IPFW2 limut src-addr rule incorrect denied some clinets. >How-To-Repeat: Use rule: ipfw add 01 allow tcp from any to me 80 setup limit src-addr 20 On production serer with large number concurent connection to httpd, run command: ipfw -d sh | grep PARENT | sort -nk6 After some time, You can see result like this: 00020 0 0 (2s) PARENT 3 tcp 1.2.3.4 0 <-> 0.0.0.0 0 00020 0 0 (0s) PARENT 4 tcp 1.2.3.5 0 <-> 0.0.0.0 0 00020 0 0 (0s) PARENT 4 tcp 1.2.3.6 0 <-> 0.0.0.0 0 00020 0 0 (0s) PARENT 5 tcp 1.2.3.7 0 <-> 0.0.0.0 0 00020 0 0 (0s) PARENT 65532 tcp 2.2.3.9 0 <-> 0.0.0.0 0 00020 0 0 (0s) PARENT 65534 tcp 2.2.3.10 0 <-> 0.0.0.0 0 Host 2.2.3.9 and 2.2.3.10 blocked by ipfw, but ipfw -d sh | grep LIMIT | grep "2.2.3." show nothing. Host 2.2.3.9 and 2.2.3.10 was blocked incorrectly. After some time (10-60 sec.) records "PARENT 65532" and "PARENT 65534" go away. On httpd with 20-30 req/sec and with simultaneously 70-120 distinct IP, number of blocked client may be varied from 1 to 10. >Fix: As workaround I use next patch: /usr/src/sys/netinet/ip_fw2.c: $FreeBSD: src/sys/netinet/ip_fw2.c,v 1.6.2.3 2002/08/21 05:34:07 luigi Exp $ --- /usr/src/sys/netinet/ip_fw2.c.old Wed Aug 21 09:34:07 2002 +++ /usr/src/sys/netinet/ip_fw2.c Wed Mar 19 16:20:54 2003 @@ -617,7 +617,7 @@ ipfw_dyn_rule *old_q = q; \ \ /* remove a refcount to the parent */ \ - if (q->dyn_type == O_LIMIT) \ + if ((q->dyn_type == O_LIMIT) && (q->parent->count !=0)) \ q->parent->count--; \ DEB(printf("-- unlink entry 0x%08x %d -> 0x%08x %d, %d left\n", \ (q->id.src_ip), (q->id.src_port), \ >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E197vOJ-000B6M-00>