Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jul 2010 10:50:12 +0400
From:      "Alexander Zagrebin" <alexz@visp.ru>
To:        <freebsd-current@freebsd.org>, <freebsd-net@freebsd.org>
Subject:   8.1-RC2: bug in ng_ipfw (ng_ipfw doesn't return a packet back to ipfw)
Message-ID:  <FB42F5E7B867446C9AB4F3341FBCC607@vosz.local>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
After upgrading from RELENG_8_0 to RELENG_8_1 (8.1-RC2)
I have noticed that ng_ipfw doesn't return a packet back to ipfw
after `ipfw add ... netgraph ...` due to the bug in the
sys/netgraph/ng_ipfw.c

The attached patch solves the problem.

-- 
Alexander

[-- Attachment #2 --]
--- sys/netgraph/ng_ipfw.c.orig	2010-06-16 08:55:21.021628270 +0400
+++ sys/netgraph/ng_ipfw.c	2010-07-01 10:29:09.561958484 +0400
@@ -221,20 +221,21 @@
 static int
 ng_ipfw_rcvdata(hook_p hook, item_p item)
 {
-	struct ipfw_rule_ref	*tag;
+	struct m_tag *tag;
+	struct ipfw_rule_ref *r;
 	struct mbuf *m;
 
 	NGI_GET_M(item, m);
 	NG_FREE_ITEM(item);
 
-	tag = (struct ipfw_rule_ref *)
-		m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL);
+	tag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL);
 	if (tag == NULL) {
 		NG_FREE_M(m);
 		return (EINVAL);	/* XXX: find smth better */
 	};
 
-	if (tag->info & IPFW_INFO_IN) {
+	r = (struct ipfw_rule_ref *)(tag + 1);
+	if (r->info & IPFW_INFO_IN) {
 		ip_input(m);
 		return (0);
 	} else {

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FB42F5E7B867446C9AB4F3341FBCC607>