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.
This commit is contained in:
Peter Wemm 1995-07-18 09:56:44 +00:00
parent f7ad28d790
commit 42c03a52ba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9575
2 changed files with 13 additions and 7 deletions

View File

@ -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 }, \
}

View File

@ -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 @@ ipintr(void)
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: