diff options
| author | rtr <rtr@NetBSD.org> | 2015-04-03 20:01:07 +0000 |
|---|---|---|
| committer | rtr <rtr@NetBSD.org> | 2015-04-03 20:01:07 +0000 |
| commit | 0da58ac00a9b5753aba6c2f4714b9d499759d1f2 (patch) | |
| tree | f85b2abd805d39ad26a562d1836377ec5f5a012d /sys/netinet/tcp_usrreq.c | |
| parent | 96d58810e5e839733058d3448402f7aac437b4ea (diff) | |
* change pr_bind to accept struct sockaddr * instead of struct mbuf *
* update protocol bind implementations to use/expect sockaddr *
instead of mbuf *
* introduce sockaddr_big struct for storage of addr data passed via
sys_bind; sockaddr_big is of sufficient size and alignment to
accommodate all addr data sizes received.
* modify sys_bind to allocate sockaddr_big instead of using an mbuf.
* bump kernel version to 7.99.9 for change to pr_bind() parameter type.
Patch posted to tech-net@
http://mail-index.netbsd.org/tech-net/2015/03/15/msg005004.html
The choice to use a new structure sockaddr_big has been retained since
changing sockaddr_storage size would lead to unnecessary ABI change. The
use of the new structure does not preclude future work that increases
the size of sockaddr_storage and at that time sockaddr_big may be
trivially replaced.
Tested by mrg@ and myself, discussed with rmind@, posted to tech-net@
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
| -rw-r--r-- | sys/netinet/tcp_usrreq.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 13f703684d5..31464c4f066 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_usrreq.c,v 1.204 2015/03/31 08:47:01 ozaki-r Exp $ */ +/* $NetBSD: tcp_usrreq.c,v 1.205 2015/04/03 20:01:07 rtr Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -99,7 +99,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.204 2015/03/31 08:47:01 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.205 2015/04/03 20:01:07 rtr Exp $"); #include "opt_inet.h" #include "opt_tcp_debug.h" @@ -711,10 +711,14 @@ tcp_accept(struct socket *so, struct mbuf *nam) } static int -tcp_bind(struct socket *so, struct mbuf *nam, struct lwp *l) +tcp_bind(struct socket *so, struct sockaddr *nam, struct lwp *l) { struct inpcb *inp = NULL; struct in6pcb *in6p = NULL; + struct sockaddr_in *sin = (struct sockaddr_in *)nam; +#ifdef INET6 + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; +#endif /* INET6 */ struct tcpcb *tp = NULL; int s; int error = 0; @@ -732,12 +736,12 @@ tcp_bind(struct socket *so, struct mbuf *nam, struct lwp *l) switch (so->so_proto->pr_domain->dom_family) { #ifdef INET case PF_INET: - error = in_pcbbind(inp, nam, l); + error = in_pcbbind(inp, sin, l); break; #endif #ifdef INET6 case PF_INET6: - error = in6_pcbbind(in6p, nam, l); + error = in6_pcbbind(in6p, sin6, l); if (!error) { /* mapped addr case */ if (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_laddr)) |
