summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2000-11-20 01:35:25 +0000
committeralfred <alfred@FreeBSD.org>2000-11-20 01:35:25 +0000
commit5870a97ec2c2e7bb1e0095de97f57af8ede5e725 (patch)
tree948cf4c9d2fec6eb2c919abc970ce422eede36ac /sys
parentee2707f1c2af95f097f8ba5eaeb087e316e84036 (diff)
downloadFreeBSD-src-5870a97ec2c2e7bb1e0095de97f57af8ede5e725.zip
FreeBSD-src-5870a97ec2c2e7bb1e0095de97f57af8ede5e725.tar.gz
Accept filters broke kernels compiled without options INET.
Make accept filters conditional on INET support to fix. Pointed out by: bde Tested and assisted by: Stephen J. Kiernan <sab@vegamuse.org>
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/files2
-rw-r--r--sys/kern/uipc_socket.c25
2 files changed, 20 insertions, 7 deletions
diff --git a/sys/conf/files b/sys/conf/files
index 04b46ec..6bb991b 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -668,7 +668,7 @@ kern/tty_pty.c optional pty
kern/tty_snoop.c count snp
kern/tty_subr.c standard
kern/tty_tty.c standard
-kern/uipc_accf.c standard
+kern/uipc_accf.c optional inet
kern/uipc_domain.c standard
kern/uipc_mbuf.c standard
kern/uipc_mbuf2.c standard
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 210dce4..2d8a578 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -34,6 +34,8 @@
* $FreeBSD$
*/
+#include "opt_inet.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/fcntl.h>
@@ -58,7 +60,9 @@
#include <machine/limits.h>
+#ifdef INET
static int do_setopt_accept_filter(struct socket *so, struct sockopt *sopt);
+#endif
static int filt_sorattach(struct knote *kn);
static void filt_sordetach(struct knote *kn);
@@ -195,6 +199,7 @@ sodealloc(so)
if (so->so_snd.sb_hiwat)
(void)chgsbsize(so->so_cred->cr_uidinfo,
&so->so_snd.sb_hiwat, 0, RLIM_INFINITY);
+#ifdef INET
if (so->so_accf != NULL) {
if (so->so_accf->so_accept_filter != NULL &&
so->so_accf->so_accept_filter->accf_destroy != NULL) {
@@ -204,6 +209,7 @@ sodealloc(so)
FREE(so->so_accf->so_accept_filter_str, M_ACCF);
FREE(so->so_accf, M_ACCF);
}
+#endif
crfree(so->so_cred);
zfreei(so->so_zone, so);
}
@@ -988,6 +994,7 @@ sorflush(so)
sbrelease(&asb, so);
}
+#ifdef INET
static int
do_setopt_accept_filter(so, sopt)
struct socket *so;
@@ -1064,6 +1071,7 @@ out:
FREE(afap, M_TEMP);
return (error);
}
+#endif /* INET */
/*
* Perhaps this routine, and sooptcopyout(), below, ought to come in
@@ -1117,6 +1125,13 @@ sosetopt(so, 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)
@@ -1224,12 +1239,6 @@ sosetopt(so, sopt)
break;
}
break;
-
- case SO_ACCEPTFILTER:
- error = do_setopt_accept_filter(so, sopt);
- if (error)
- goto bad;
- break;
default:
error = ENOPROTOOPT;
break;
@@ -1283,7 +1292,9 @@ sogetopt(so, sopt)
int error, optval;
struct linger l;
struct timeval tv;
+#ifdef INET
struct accept_filter_arg *afap;
+#endif
error = 0;
if (sopt->sopt_level != SOL_SOCKET) {
@@ -1294,6 +1305,7 @@ sogetopt(so, sopt)
return (ENOPROTOOPT);
} else {
switch (sopt->sopt_name) {
+#ifdef INET
case SO_ACCEPTFILTER:
if ((so->so_options & SO_ACCEPTCONN) == 0)
return (EINVAL);
@@ -1308,6 +1320,7 @@ sogetopt(so, sopt)
error = sooptcopyout(sopt, afap, sizeof(*afap));
FREE(afap, M_TEMP);
break;
+#endif
case SO_LINGER:
l.l_onoff = so->so_options & SO_LINGER;
OpenPOWER on IntegriCloud