summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_accf.c
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2005-06-11 11:59:48 +0000
committermaxim <maxim@FreeBSD.org>2005-06-11 11:59:48 +0000
commite5e29d142df527fb60c2bf5787693048c03ccd91 (patch)
treecf645ec5448a6417f797787f1f7383a70a85373c /sys/kern/uipc_accf.c
parent516791d26e9b914790f29c420d3ed712d1984304 (diff)
downloadFreeBSD-src-e5e29d142df527fb60c2bf5787693048c03ccd91.zip
FreeBSD-src-e5e29d142df527fb60c2bf5787693048c03ccd91.tar.gz
o setsockopt(2) cannot remove accept filter. [1]
o getsockopt(SO_ACCEPTFILTER) always returns success on listen socket even we didn't install accept filter on the socket. o Fix these bugs and add regression tests for them. Submitted by: Igor Sysoev [1] Reviewed by: alfred MFC after: 2 weeks
Diffstat (limited to 'sys/kern/uipc_accf.c')
-rw-r--r--sys/kern/uipc_accf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/uipc_accf.c b/sys/kern/uipc_accf.c
index 8991120..4449b5b 100644
--- a/sys/kern/uipc_accf.c
+++ b/sys/kern/uipc_accf.c
@@ -176,8 +176,10 @@ do_getopt_accept_filter(struct socket *so, struct sockopt *sopt)
error = EINVAL;
goto out;
}
- if ((so->so_options & SO_ACCEPTFILTER) == 0)
+ if ((so->so_options & SO_ACCEPTFILTER) == 0) {
+ error = EINVAL;
goto out;
+ }
strcpy(afap->af_name, so->so_accf->so_accept_filter->accf_name);
if (so->so_accf->so_accept_filter_str != NULL)
strcpy(afap->af_arg, so->so_accf->so_accept_filter_str);
@@ -200,7 +202,7 @@ do_setopt_accept_filter(struct socket *so, struct sockopt *sopt)
/*
* Handle the simple delete case first.
*/
- if (sopt == NULL) {
+ if (sopt == NULL || sopt->sopt_val == NULL) {
SOCK_LOCK(so);
if ((so->so_options & SO_ACCEPTCONN) == 0) {
SOCK_UNLOCK(so);
OpenPOWER on IntegriCloud