Skip site navigation (1)Skip section navigation (2)
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&nbsp;&nbsp;&nbsp; Sun Oct&nbsp; 8 03:24:55 2006<br>+++ in.h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sun Oct&nbsp; 8 04:29:34 2006
 <br>@@ -542,7 +542,8 @@<br>&nbsp;#define&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPCTL_FASTFORWARDING&nbsp;&nbsp;&nbsp; 14&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* use fast IP forwarding code */<br>&nbsp;#define&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPCTL_KEEPFAITH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* FAITH IPv4-&gt;IPv6 translater ctl */<br>&nbsp;#define&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPCTL_GIF_TTL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; 16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* default TTL for gif encap packet */
 <br>-#define&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPCTL_MAXID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 17<br>+#define&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPCTL_FORWARDBROADCAST&nbsp; 17&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* may forward broadcast packets */<br>+#define&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPCTL_MAXID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18<br><br>&nbsp;#define&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IPCTL_NAMES {  \<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { 0, 0 }, \<br>@@ -560,6 +561,7 @@<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &quot;stats&quot;, CTLTYPE_STRUCT }, \<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &quot;accept_sourceroute&quot;, CTLTYPE_INT }, \<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &quot;fastforwarding&quot;, CTLTYPE_INT }, \<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &quot;forwardbroadcast&quot;, CTLTYPE_INT }, \
 <br>&nbsp;}<br><br>&nbsp;#endif /* __BSD_VISIBLE */<br>--- ip_input.c.old&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sun Oct&nbsp; 8 03:27:01 2006<br>+++ ip_input.c&nbsp; Sun Oct&nbsp; 8 03:41:09 2006<br>@@ -129,6 +129,11 @@<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;ip_do_randomid, 0,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Assign random ip_id values&quot;);
 <br><br>+int&nbsp;&nbsp;&nbsp; ip_forwardbroadcast = 0;<br>+SYSCTL_INT(_net_inet_ip, IPCTL_FORWARDBROADCAST, forwardbroadcast, CTLFLAG_RW,<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;ip_forwardbroadcast, 0,<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Allow forwarding of broadcast packets&quot;);
 <br>+<br>&nbsp;/*<br>&nbsp; * XXX - Setting ip_checkinterface mostly implements the receive side of<br>&nbsp; * the Strong ES model described in RFC 1122, but since the routing table<br>@@ -1896,8 +1901,10 @@<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (rt)<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RTFREE(rt);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>-<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error = ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL);<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!ip_forwardbroadcast)<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error = ip_output(m, NULL, NULL, IP_FORWARDING, N ULL, NULL);
 <br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error = ip_output(m, NULL, NULL, IP_FORWARDING|IP_ALLOWBROADCAST, NULL, NULL);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (error)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ipstat.ips_cantforward++;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>