From owner-freebsd-bugs@FreeBSD.ORG Sun Oct 8 04:40:29 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1D3B916A416 for ; Sun, 8 Oct 2006 04:40:29 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id AAB9143D4C for ; Sun, 8 Oct 2006 04:40:28 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k984eSRM070791 for ; Sun, 8 Oct 2006 04:40:28 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k984eScl070790; Sun, 8 Oct 2006 04:40:28 GMT (envelope-from gnats) Date: Sun, 8 Oct 2006 04:40:28 GMT Message-Id: <200610080440.k984eScl070790@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Astrodog Cc: Subject: Re: kern/103950: Broadcast packets are not forwarded X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Astrodog List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Oct 2006 04:40:29 -0000 The following reply was made to PR kern/103950; it has been noted by GNATS. From: Astrodog To: bug-followup@FreeBSD.org, damien.deville@netasq.com Cc: Subject: Re: kern/103950: Broadcast packets are not forwarded Date: Sat, 7 Oct 2006 23:30:47 -0500 ------=_Part_152478_26133337.1160281847644 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I reworked the included fix to allow for a sysctl tunable. I don't think we want to make forwarding broadcast mandatory when forwarding. --- in.h.old Sun Oct 8 03:24:55 2006 +++ in.h Sun Oct 8 04:29:34 2006 @@ -542,7 +542,8 @@ #define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */ #define IPCTL_KEEPFAITH 15 /* FAITH IPv4->IPv6 translater ctl */ #define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */ -#define IPCTL_MAXID 17 +#define IPCTL_FORWARDBROADCAST 17 /* may forward broadcast packets */ +#define IPCTL_MAXID 18 #define IPCTL_NAMES { \ { 0, 0 }, \ @@ -560,6 +561,7 @@ { "stats", CTLTYPE_STRUCT }, \ { "accept_sourceroute", CTLTYPE_INT }, \ { "fastforwarding", CTLTYPE_INT }, \ + { "forwardbroadcast", CTLTYPE_INT }, \ } #endif /* __BSD_VISIBLE */ --- ip_input.c.old Sun Oct 8 03:27:01 2006 +++ ip_input.c Sun Oct 8 03:41:09 2006 @@ -129,6 +129,11 @@ &ip_do_randomid, 0, "Assign random ip_id values"); +int ip_forwardbroadcast = 0; +SYSCTL_INT(_net_inet_ip, IPCTL_FORWARDBROADCAST, forwardbroadcast, CTLFLAG_RW, + &ip_forwardbroadcast, 0, + "Allow forwarding of broadcast packets"); + /* * XXX - Setting ip_checkinterface mostly implements the receive side of * the Strong ES model described in RFC 1122, but since the routing table @@ -1896,8 +1901,10 @@ if (rt) RTFREE(rt); } - - error = ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL); + if (!ip_forwardbroadcast) + error = ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL); + else + error = ip_output(m, NULL, NULL, IP_FORWARDING|IP_ALLOWBROADCAST, NULL, NULL); if (error) ipstat.ips_cantforward++; else { ------=_Part_152478_26133337.1160281847644 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I reworked the included fix to allow for a sysctl tunable. I don't think we want to make forwarding broadcast mandatory when forwarding.

--- in.h.old    Sun Oct  8 03:24:55 2006
+++ in.h        Sun Oct  8 04:29:34 2006
@@ -542,7 +542,8 @@
 #define        IPCTL_FASTFORWARDING    14      /* use fast IP forwarding code */
 #define        IPCTL_KEEPFAITH         15      /* FAITH IPv4->IPv6 translater ctl */
 #define        IPCTL_GIF_TTL          ;  16      /* default TTL for gif encap packet */
-#define        IPCTL_MAXID             17
+#define        IPCTL_FORWARDBROADCAST  17      /* may forward broadcast packets */
+#define        IPCTL_MAXID             18

 #define        IPCTL_NAMES { \
        { 0, 0 }, \
@@ -560,6 +561,7 @@
        { "stats", CTLTYPE_STRUCT }, \
        { "accept_sourceroute", CTLTYPE_INT }, \
        { "fastforwarding", CTLTYPE_INT }, \
+       { "forwardbroadcast", CTLTYPE_INT }, \
 }

 #endif /* __BSD_VISIBLE */
--- ip_input.c.old      Sun Oct  8 03:27:01 2006
+++ ip_input.c  Sun Oct  8 03:41:09 2006
@@ -129,6 +129,11 @@
        &ip_do_randomid, 0,
        "Assign random ip_id values");

+int    ip_forwardbroadcast = 0;
+SYSCTL_INT(_net_inet_ip, IPCTL_FORWARDBROADCAST, forwardbroadcast, CTLFLAG_RW,
+       &ip_forwardbroadcast, 0,
+       "Allow forwarding of broadcast packets");
+
 /*
  * XXX - Setting ip_checkinterface mostly implements the receive side of
  * the Strong ES model described in RFC 1122, but since the routing table
@@ -1896,8 +1901,10 @@
                if (rt)
                        RTFREE(rt);
        }
-
-       error = ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL);
+       if (!ip_forwardbroadcast)
+               error = ip_output(m, NULL, NULL, IP_FORWARDING, N ULL, NULL);
+       else
+               error = ip_output(m, NULL, NULL, IP_FORWARDING|IP_ALLOWBROADCAST, NULL, NULL);
        if (error)
                ipstat.ips_cantforward++;
        else {

------=_Part_152478_26133337.1160281847644--