Date: Sun, 8 Oct 2006 04:40:28 GMT From: Astrodog <astrodog@gmail.com> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/103950: Broadcast packets are not forwarded Message-ID: <200610080440.k984eScl070790@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/103950; it has been noted by GNATS. From: Astrodog <astrodog@gmail.com> 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.<br><br>--- in.h.old Sun Oct 8 03:24:55 2006<br>+++ in.h Sun Oct 8 04:29:34 2006 <br>@@ -542,7 +542,8 @@<br> #define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */<br> #define IPCTL_KEEPFAITH 15 /* FAITH IPv4->IPv6 translater ctl */<br> #define IPCTL_GIF_TTL   ; 16 /* default TTL for gif encap packet */ <br>-#define IPCTL_MAXID 17<br>+#define IPCTL_FORWARDBROADCAST 17 /* may forward broadcast packets */<br>+#define IPCTL_MAXID 18<br><br> #define IPCTL_NAMES { \<br> { 0, 0 }, \<br>@@ -560,6 +561,7 @@<br> { "stats", CTLTYPE_STRUCT }, \<br> { "accept_sourceroute", CTLTYPE_INT }, \<br> { "fastforwarding", CTLTYPE_INT }, \<br>+ { "forwardbroadcast", CTLTYPE_INT }, \ <br> }<br><br> #endif /* __BSD_VISIBLE */<br>--- ip_input.c.old Sun Oct 8 03:27:01 2006<br>+++ ip_input.c Sun Oct 8 03:41:09 2006<br>@@ -129,6 +129,11 @@<br> &ip_do_randomid, 0,<br> "Assign random ip_id values"); <br><br>+int ip_forwardbroadcast = 0;<br>+SYSCTL_INT(_net_inet_ip, IPCTL_FORWARDBROADCAST, forwardbroadcast, CTLFLAG_RW,<br>+ &ip_forwardbroadcast, 0,<br>+ "Allow forwarding of broadcast packets"); <br>+<br> /*<br> * XXX - Setting ip_checkinterface mostly implements the receive side of<br> * the Strong ES model described in RFC 1122, but since the routing table<br>@@ -1896,8 +1901,10 @@<br> if (rt)<br> RTFREE(rt);<br> }<br>-<br>- error = ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL);<br>+ if (!ip_forwardbroadcast)<br>+ error = ip_output(m, NULL, NULL, IP_FORWARDING, N ULL, NULL); <br>+ else<br>+ error = ip_output(m, NULL, NULL, IP_FORWARDING|IP_ALLOWBROADCAST, NULL, NULL);<br> if (error)<br> ipstat.ips_cantforward++;<br> else {<br><br> ------=_Part_152478_26133337.1160281847644--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610080440.k984eScl070790>