remove transitional functions in{,6}_pcbconnect_m() that were used in

converting protocol user requests to accept sockaddr instead of mbufs.

remove tcp_input copy in to mbuf from sockaddr and just copy to sockaddr
to make it possible for the transitional functions to go away.

no version bump since these functions only existed for a short time and
were commented as adapters (they appeared in 7.99.15).
This commit is contained in:
rtr 2015-05-24 15:43:45 +00:00
parent dd8e199a16
commit e7083d7a4b
5 changed files with 21 additions and 63 deletions

View File

@ -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 <sys/cdefs.h>
__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.

View File

@ -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);

View File

@ -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 <sys/cdefs.h>
__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);

View File

@ -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 <sys/cdefs.h>
__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.

View File

@ -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 *,