diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2004-04-26 18:16:10 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2004-04-26 18:16:10 +0000 |
commit | da849d0f3dde878da6ae9bc3965f4089fc0c001b (patch) | |
tree | 78783de0d565302bbde1b16e749cfc11fbfcdf65 /sys/netinet | |
parent | 60d2bb762f3e34b1cb49541ea7d5d80c8cbcb153 (diff) |
change tcpdrop to require newp instead of oldp; suggested by otto
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index abafe056ef2..496f261dfe6 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.83 2004/04/25 04:34:05 markus Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.84 2004/04/26 18:16:09 markus Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -790,22 +790,23 @@ tcp_ident(oldp, oldlenp, newp, newlen, dodrop) struct sockaddr_in6 *fin6, *lin6; struct in6_addr f6, l6; #endif - if (oldp == NULL) return (EINVAL); + if (*oldlenp < sizeof(tir)) + return (ENOMEM); if (dodrop) { - /* - * XXX stupid permission hack: - * only root may set newp, so we require newp for tcp_drop() - */ if (newp == NULL) return (EPERM); - } else if (newp != NULL || newlen != 0) - return (EINVAL); - if (*oldlenp < sizeof(tir)) - return (ENOMEM); - if ((error = copyin(oldp, &tir, sizeof (tir))) != 0 ) - return (error); + if (newlen < sizeof(tir)) + return (ENOMEM); + if ((error = copyin(newp, &tir, sizeof (tir))) != 0 ) + return (error); + } else { + if (newp != NULL || newlen != 0) + return (EINVAL); + if ((error = copyin(oldp, &tir, sizeof (tir))) != 0 ) + return (error); + } switch (tir.faddr.ss_family) { #ifdef INET6 case AF_INET6: |