summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1995-07-18 09:56:44 +0000
committerpeter <peter@FreeBSD.org>1995-07-18 09:56:44 +0000
commit8424d675bc800cef5b661fa40603ec3836315fc7 (patch)
tree138ac41c38124e476ab8920832c30c03e5fe0d60 /sys
parent5105427ac0aae405dfc58fee4fbcb81902fb92d2 (diff)
downloadFreeBSD-src-8424d675bc800cef5b661fa40603ec3836315fc7.zip
FreeBSD-src-8424d675bc800cef5b661fa40603ec3836315fc7.tar.gz
Change the compile-time option of DIRECTED_BROADCAST into a sysctl
variable underneath ip, "directed-broadcast". Reviewed by: David Greenman Obtained from: NetBSD, by Darren Reed.
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/in.h6
-rw-r--r--sys/netinet/ip_input.c14
2 files changed, 13 insertions, 7 deletions
diff --git a/sys/netinet/in.h b/sys/netinet/in.h
index 80c5b2b..53fd103 100644
--- a/sys/netinet/in.h
+++ b/sys/netinet/in.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in.h 8.3 (Berkeley) 1/3/94
- * $Id: in.h,v 1.9 1995/03/16 18:22:26 wollman Exp $
+ * $Id: in.h,v 1.10 1995/06/13 17:51:08 wollman Exp $
*/
#ifndef _NETINET_IN_H_
@@ -232,7 +232,8 @@ struct ip_mreq {
#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */
#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */
#define IPCTL_SOURCEROUTE 8 /* may perform source routes */
-#define IPCTL_MAXID 9
+#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */
+#define IPCTL_MAXID 10
#define IPCTL_NAMES { \
{ 0, 0 }, \
@@ -244,6 +245,7 @@ struct ip_mreq {
{ "rtminexpire", CTLTYPE_INT }, \
{ "rtmaxcache", CTLTYPE_INT }, \
{ "sourceroute", CTLTYPE_INT }, \
+ { "directed-broadcast", CTLTYPE_INT }, \
}
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index d91a0f9..b514ca7 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_input.c 8.2 (Berkeley) 1/4/94
- * $Id: ip_input.c,v 1.24 1995/06/27 17:26:27 guido Exp $
+ * $Id: ip_input.c,v 1.25 1995/07/09 14:29:46 davidg Exp $
*/
#include <sys/param.h>
@@ -79,8 +79,12 @@ struct socket *ip_rsvpd;
#ifndef IPSENDREDIRECTS
#define IPSENDREDIRECTS 1
#endif
+#ifndef DIRECTED_BROADCAST
+#define DIRECTED_BROADCAST 0
+#endif
int ipforwarding = IPFORWARDING;
int ipsendredirects = IPSENDREDIRECTS;
+int ipdirbroadcast = DIRECTED_BROADCAST;
int ip_defttl = IPDEFTTL;
int ip_dosourceroute = 0;
#ifdef DIAGNOSTIC
@@ -273,10 +277,7 @@ next:
if (IA_SIN(ia)->sin_addr.s_addr == ip->ip_dst.s_addr)
goto ours;
- if (
-#ifdef DIRECTED_BROADCAST
- ia->ia_ifp == m->m_pkthdr.rcvif &&
-#endif
+ if ((!ipdirbroadcast || ia->ia_ifp == m->m_pkthdr.rcvif) &&
(ia->ia_ifp->if_flags & IFF_BROADCAST)) {
u_long t;
@@ -1206,6 +1207,9 @@ ip_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
case IPCTL_SENDREDIRECTS:
return (sysctl_int(oldp, oldlenp, newp, newlen,
&ipsendredirects));
+ case IPCTL_DIRECTEDBROADCAST:
+ return (sysctl_int(oldp, oldlenp, newp, newlen,
+ &ipdirbroadcast));
case IPCTL_DEFTTL:
return (sysctl_int(oldp, oldlenp, newp, newlen, &ip_defttl));
case IPCTL_SOURCEROUTE:
OpenPOWER on IntegriCloud