diff options
author | alfred <alfred@FreeBSD.org> | 2000-07-20 12:17:17 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2000-07-20 12:17:17 +0000 |
commit | a4c6219207587870627c7729e87155b8a9f6fe94 (patch) | |
tree | ce223bb2fd1296ebd75fa4a8ac58d3661abb36b1 /sys/kern/uipc_socket.c | |
parent | fb96eed99671467b451b3b2d3db7695a5ce2ff9e (diff) | |
download | FreeBSD-src-a4c6219207587870627c7729e87155b8a9f6fe94.zip FreeBSD-src-a4c6219207587870627c7729e87155b8a9f6fe94.tar.gz |
only allow accept filter modifications on listening sockets
Submitted by: ps
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 4dffd3a..eea9e44 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -998,6 +998,12 @@ do_setopt_accept_filter(so, sopt) struct so_accf *af = so->so_accf; int error = 0; + /* do not set/remove accept filters on non listen sockets */ + if ((so->so_options & SO_ACCEPTCONN) == 0) { + error = EINVAL; + goto out; + } + /* removing the filter */ if (sopt == NULL) { if (af != NULL) { @@ -1289,6 +1295,8 @@ sogetopt(so, sopt) } else { switch (sopt->sopt_name) { case SO_ACCEPTFILTER: + if ((so->so_options & SO_ACCEPTCONN) == 0) + return (EINVAL); MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), M_TEMP, M_WAITOK); bzero(afap, sizeof(*afap)); |