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.
This commit is contained in:
parent
ba9b6cdd1c
commit
c6a7dd8e59
@ -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
|
||||
|
@ -60,9 +60,8 @@ MALLOC_DEFINE(M_ACCF, "accf", "accept filter data");
|
||||
|
||||
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)");
|
||||
|
||||
/*
|
||||
|
@ -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 sockopt *sopt)
|
||||
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 sockopt *sopt)
|
||||
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;
|
||||
|
@ -394,3 +394,5 @@ SYSCTL_NODE(_net_inet, IPPROTO_IPCOMP, ipcomp, CTLFLAG_RW, 0, "IPCOMP");
|
||||
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");
|
||||
|
Loading…
Reference in New Issue
Block a user