diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 38bba255b8f5..5922ba255c09 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.c,v 1.160 2015/05/02 17:18:03 rtr Exp $ */ +/* $NetBSD: in_pcb.c,v 1.161 2015/05/24 15:43:45 rtr Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.160 2015/05/02 17:18:03 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.161 2015/05/24 15:43:45 rtr Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -442,21 +442,6 @@ in_pcbbind(void *v, struct sockaddr_in *sin, struct lwp *l) return (0); } -/* - * adapter function that accepts nam as mbuf for in_pcbconnect() - */ -int -in_pcbconnect_m(void *v, struct mbuf *nam, struct lwp *l) -{ - struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *); - - if (sizeof (*sin) != nam->m_len) { - return EINVAL; - } - - return in_pcbconnect(v, sin, l); -} - /* * Connect from a socket to a specified address. * Both address and port must be specified in argument sin. diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 709fa5bd8f2c..a0642d2a5779 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.h,v 1.58 2015/05/02 17:18:03 rtr Exp $ */ +/* $NetBSD: in_pcb.h,v 1.59 2015/05/24 15:43:45 rtr Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -133,7 +133,6 @@ void in_losing(struct inpcb *); int in_pcballoc(struct socket *, void *); int in_pcbbind(void *, struct sockaddr_in *, struct lwp *); int in_pcbconnect(void *, struct sockaddr_in *, struct lwp *); -int in_pcbconnect_m(void *, struct mbuf *, struct lwp *); void in_pcbdetach(void *); void in_pcbdisconnect(void *); void in_pcbinit(struct inpcbtable *, int, int); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 46c217f3481c..8aca33efedb1 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_input.c,v 1.340 2015/05/15 18:03:45 kefren Exp $ */ +/* $NetBSD: tcp_input.c,v 1.341 2015/05/24 15:43:45 rtr Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -148,7 +148,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.340 2015/05/15 18:03:45 kefren Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.341 2015/05/24 15:43:45 rtr Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -3918,7 +3918,6 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct in6pcb *in6p = NULL; #endif struct tcpcb *tp = 0; - struct mbuf *am; int s; struct socket *oso; @@ -4069,45 +4068,36 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, } #endif - am = m_get(M_DONTWAIT, MT_SONAME); /* XXX */ - if (am == NULL) - goto resetandabort; - MCLAIM(am, &tcp_mowner); - am->m_len = src->sa_len; - bcopy(src, mtod(am, void *), src->sa_len); if (inp) { - if (in_pcbconnect_m(inp, am, &lwp0)) { - (void) m_free(am); + struct sockaddr_in sin; + memcpy(&sin, src, src->sa_len); + if (in_pcbconnect(inp, &sin, &lwp0)) { goto resetandabort; } } #ifdef INET6 else if (in6p) { + struct sockaddr_in6 sin6; + memcpy(&sin6, src, src->sa_len); if (src->sa_family == AF_INET) { /* IPv4 packet to AF_INET6 socket */ - struct sockaddr_in6 *sin6; - sin6 = mtod(am, struct sockaddr_in6 *); - am->m_len = sizeof(*sin6); - memset(sin6, 0, sizeof(*sin6)); - sin6->sin6_family = AF_INET6; - sin6->sin6_len = sizeof(*sin6); - sin6->sin6_port = ((struct sockaddr_in *)src)->sin_port; - sin6->sin6_addr.s6_addr16[5] = htons(0xffff); + memset(&sin6, 0, sizeof(sin6)); + sin6.sin6_family = AF_INET6; + sin6.sin6_len = sizeof(sin6); + sin6.sin6_port = ((struct sockaddr_in *)src)->sin_port; + sin6.sin6_addr.s6_addr16[5] = htons(0xffff); bcopy(&((struct sockaddr_in *)src)->sin_addr, - &sin6->sin6_addr.s6_addr32[3], - sizeof(sin6->sin6_addr.s6_addr32[3])); + &sin6.sin6_addr.s6_addr32[3], + sizeof(sin6.sin6_addr.s6_addr32[3])); } - if (in6_pcbconnect_m(in6p, am, NULL)) { - (void) m_free(am); + if (in6_pcbconnect(in6p, &sin6, NULL)) { goto resetandabort; } } #endif else { - (void) m_free(am); goto resetandabort; } - (void) m_free(am); if (inp) tp = intotcpcb(inp); diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index a4041655f272..49a12196ab46 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,4 +1,4 @@ -/* $NetBSD: in6_pcb.c,v 1.141 2015/05/19 01:14:40 ozaki-r Exp $ */ +/* $NetBSD: in6_pcb.c,v 1.142 2015/05/24 15:43:45 rtr Exp $ */ /* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.141 2015/05/19 01:14:40 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.142 2015/05/24 15:43:45 rtr Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -417,21 +417,6 @@ in6_pcbbind(void *v, struct sockaddr_in6 *sin6, struct lwp *l) return (0); } -/* - * adapter function that accepts nam as mbuf for in6_pcbconnect - */ -int -in6_pcbconnect_m(void *v, struct mbuf *nam, struct lwp *l) -{ - struct sockaddr_in6 *sin6 = mtod(nam, struct sockaddr_in6 *); - - if (sizeof (*sin6) != nam->m_len) { - return EINVAL; - } - - return in6_pcbconnect(v, sin6, l); -} - /* * Connect from a socket to a specified address. * Both address and port must be specified in argument sin6. diff --git a/sys/netinet6/in6_pcb.h b/sys/netinet6/in6_pcb.h index abea3d888e44..08b6613882c7 100644 --- a/sys/netinet6/in6_pcb.h +++ b/sys/netinet6/in6_pcb.h @@ -1,4 +1,4 @@ -/* $NetBSD: in6_pcb.h,v 1.45 2015/05/02 17:18:03 rtr Exp $ */ +/* $NetBSD: in6_pcb.h,v 1.46 2015/05/24 15:43:45 rtr Exp $ */ /* $KAME: in6_pcb.h,v 1.45 2001/02/09 05:59:46 itojun Exp $ */ /* @@ -158,7 +158,6 @@ void in6_pcbinit(struct inpcbtable *, int, int); int in6_pcballoc(struct socket *, void *); int in6_pcbbind(void *, struct sockaddr_in6 *, struct lwp *); int in6_pcbconnect(void *, struct sockaddr_in6 *, struct lwp *); -int in6_pcbconnect_m(void *, struct mbuf *, struct lwp *); void in6_pcbdetach(struct in6pcb *); void in6_pcbdisconnect(struct in6pcb *); struct in6pcb *in6_pcblookup_port(struct inpcbtable *, struct in6_addr *,