summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2005-02-14 07:37:51 +0000
committermaxim <maxim@FreeBSD.org>2005-02-14 07:37:51 +0000
commitd2ebfe4c1f1998f4bd2184a39cb19cc7ec023001 (patch)
treea6be9f7597e232f5e70091fea00613f0423dc377 /sys/netinet/tcp_usrreq.c
parent70bda33804e254c8add665f1fd0a4cd42750423d (diff)
downloadFreeBSD-src-d2ebfe4c1f1998f4bd2184a39cb19cc7ec023001.zip
FreeBSD-src-d2ebfe4c1f1998f4bd2184a39cb19cc7ec023001.tar.gz
o Add handling of an IPv4-mapped IPv6 address.
o Use SYSCTL_IN() macro instead of direct call of copyin(9). Submitted by: ume o Move sysctl_drop() implementation to sys/netinet/tcp_subr.c where most of tcp sysctls live. o There are net.inet[6].tcp[6].getcred sysctls already, no needs in a separate struct tcp_ident_mapping. Suggested by: ume
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c87
1 files changed, 0 insertions, 87 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index a2e3d3c..d6824dd 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1272,90 +1272,3 @@ tcp_usrclosed(tp)
}
return (tp);
}
-
-static int
-sysctl_drop(SYSCTL_HANDLER_ARGS)
-{
- struct tcp_ident_mapping tir;
- struct inpcb *inp;
- struct tcpcb *tp;
- struct sockaddr_in *fin, *lin;
-#ifdef INET6
- struct sockaddr_in6 *fin6, *lin6;
- struct in6_addr f6, l6;
-#endif
- int error;
-
- inp = NULL;
- fin = lin = NULL;
-#ifdef INET6
- fin6 = lin6 = NULL;
-#endif
- error = 0;
-
- if (req->oldptr != NULL || req->oldlen != 0)
- return (EINVAL);
- if (req->newptr == NULL)
- return (EPERM);
- if (req->newlen < sizeof(tir))
- return (ENOMEM);
- if ((error = copyin(req->newptr, &tir, sizeof(tir))) != 0)
- return (error);
-
- switch (tir.faddr.ss_family) {
-#ifdef INET6
- case AF_INET6:
- fin6 = (struct sockaddr_in6 *)&tir.faddr;
- lin6 = (struct sockaddr_in6 *)&tir.laddr;
- if (fin6->sin6_len != sizeof(struct sockaddr_in6) ||
- lin6->sin6_len != sizeof(struct sockaddr_in6))
- return (EINVAL);
- error = in6_embedscope(&f6, fin6, NULL, NULL);
- if (error)
- return (EINVAL);
- error = in6_embedscope(&l6, lin6, NULL, NULL);
- if (error)
- return (EINVAL);
- break;
-#endif
- case AF_INET:
- fin = (struct sockaddr_in *)&tir.faddr;
- lin = (struct sockaddr_in *)&tir.laddr;
- if (fin->sin_len != sizeof(struct sockaddr_in) ||
- lin->sin_len != sizeof(struct sockaddr_in))
- return (EINVAL);
- break;
- default:
- return (EINVAL);
- }
- INP_INFO_WLOCK(&tcbinfo);
- switch (tir.faddr.ss_family) {
-#ifdef INET6
- case AF_INET6:
- inp = in6_pcblookup_hash(&tcbinfo, &f6, fin6->sin6_port,
- &l6, lin6->sin6_port, 0, NULL);
- break;
-#endif
- case AF_INET:
- inp = in_pcblookup_hash(&tcbinfo, fin->sin_addr, fin->sin_port,
- lin->sin_addr, lin->sin_port, 0, NULL);
- break;
- }
- if (inp != NULL) {
- INP_LOCK(inp);
- if ((tp = intotcpcb(inp)) &&
- ((inp->inp_socket->so_options & SO_ACCEPTCONN) == 0)) {
- tp = tcp_drop(tp, ECONNABORTED);
- if (tp != NULL)
- INP_UNLOCK(inp);
- } else
- INP_UNLOCK(inp);
- } else
- error = ESRCH;
- INP_INFO_WUNLOCK(&tcbinfo);
- return (error);
-}
-
-SYSCTL_PROC(_net_inet_tcp, TCPCTL_DROP, drop,
- CTLTYPE_STRUCT|CTLFLAG_WR|CTLFLAG_SKIP, NULL,
- 0, sysctl_drop, "", "Drop TCP connection");
OpenPOWER on IntegriCloud