Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jul 2014 19:27:35 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r269142 - in head/sys: conf kern netinet
Message-ID:  <201407261927.s6QJRZsC015019@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Sat Jul 26 19:27:34 2014
New Revision: 269142
URL: http://svnweb.freebsd.org/changeset/base/269142

Log:
  The accept filter code is not specific to the FreeBSD IPv4 network stack,
  so it really should not be under "optional inet". The fact that uipc_accf.c
  lives under kern/ lends some weight to making it a "standard" file.
  
  Moving kern/uipc_accf.c from "optional inet" to "standard" eliminates the
  need for #ifdef INET in kern/uipc_socket.c.
  
  Also, this meant the net.inet.accf.unloadable sysctl needed to move, as
  net.inet does not exist without networking compiled in (as it lives in
  netinet/in_proto.c.) The new sysctl has been named net.accf.unloadable.
  
  In order to support existing accept filter sysctls, the net.inet.accf node
  has been added netinet/in_proto.c.
  
  Submitted by:	Steve Kiernan <stevek@juniper.net>
  Obtained from:	Juniper Networks, Inc.

Modified:
  head/sys/conf/files
  head/sys/kern/uipc_accf.c
  head/sys/kern/uipc_socket.c
  head/sys/netinet/in_proto.c

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Sat Jul 26 19:25:52 2014	(r269141)
+++ head/sys/conf/files	Sat Jul 26 19:27:34 2014	(r269142)
@@ -3017,7 +3017,7 @@ kern/tty_outq.c			standard
 kern/tty_pts.c			standard
 kern/tty_tty.c			standard
 kern/tty_ttydisc.c		standard
-kern/uipc_accf.c		optional inet
+kern/uipc_accf.c		standard
 kern/uipc_debug.c		optional ddb
 kern/uipc_domain.c		standard
 kern/uipc_mbuf.c		standard

Modified: head/sys/kern/uipc_accf.c
==============================================================================
--- head/sys/kern/uipc_accf.c	Sat Jul 26 19:25:52 2014	(r269141)
+++ head/sys/kern/uipc_accf.c	Sat Jul 26 19:27:34 2014	(r269142)
@@ -60,9 +60,8 @@ MALLOC_DEFINE(M_ACCF, "accf", "accept fi
 
 static int unloadable = 0;
 
-SYSCTL_DECL(_net_inet);	/* XXX: some header should do this for me */
-SYSCTL_NODE(_net_inet, OID_AUTO, accf, CTLFLAG_RW, 0, "Accept filters");
-SYSCTL_INT(_net_inet_accf, OID_AUTO, unloadable, CTLFLAG_RW, &unloadable, 0,
+SYSCTL_NODE(_net, OID_AUTO, accf, CTLFLAG_RW, 0, "Accept filters");
+SYSCTL_INT(_net_accf, OID_AUTO, unloadable, CTLFLAG_RW, &unloadable, 0,
 	"Allow unload of accept filters (not recommended)");
 
 /*

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Sat Jul 26 19:25:52 2014	(r269141)
+++ head/sys/kern/uipc_socket.c	Sat Jul 26 19:27:34 2014	(r269142)
@@ -378,11 +378,9 @@ sodealloc(struct socket *so)
 	if (so->so_snd.sb_hiwat)
 		(void)chgsbsize(so->so_cred->cr_uidinfo,
 		    &so->so_snd.sb_hiwat, 0, RLIM_INFINITY);
-#ifdef INET
 	/* remove acccept filter if one is present. */
 	if (so->so_accf != NULL)
 		do_setopt_accept_filter(so, NULL);
-#endif
 #ifdef MAC
 	mac_socket_destroy(so);
 #endif
@@ -2402,13 +2400,12 @@ sosetopt(struct socket *so, struct socko
 		error = ENOPROTOOPT;
 	} else {
 		switch (sopt->sopt_name) {
-#ifdef INET
 		case SO_ACCEPTFILTER:
 			error = do_setopt_accept_filter(so, sopt);
 			if (error)
 				goto bad;
 			break;
-#endif
+
 		case SO_LINGER:
 			error = sooptcopyin(sopt, &l, sizeof l, sizeof l);
 			if (error)
@@ -2635,11 +2632,10 @@ sogetopt(struct socket *so, struct socko
 		return (error);
 	} else {
 		switch (sopt->sopt_name) {
-#ifdef INET
 		case SO_ACCEPTFILTER:
 			error = do_getopt_accept_filter(so, sopt);
 			break;
-#endif
+
 		case SO_LINGER:
 			SOCK_LOCK(so);
 			l.l_onoff = so->so_options & SO_LINGER;

Modified: head/sys/netinet/in_proto.c
==============================================================================
--- head/sys/netinet/in_proto.c	Sat Jul 26 19:25:52 2014	(r269141)
+++ head/sys/netinet/in_proto.c	Sat Jul 26 19:27:34 2014	(r269142)
@@ -394,3 +394,5 @@ SYSCTL_NODE(_net_inet, IPPROTO_IPCOMP,	i
 SYSCTL_NODE(_net_inet, IPPROTO_IPIP,	ipip,	CTLFLAG_RW, 0,	"IPIP");
 #endif /* IPSEC */
 SYSCTL_NODE(_net_inet, IPPROTO_RAW,	raw,	CTLFLAG_RW, 0,	"RAW");
+SYSCTL_NODE(_net_inet, OID_AUTO,	accf,	CTLFLAG_RW, 0,
+    "Accept filters");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407261927.s6QJRZsC015019>