Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys remove transitional functions in{, 6}_pcbconnect_m() that...



details:   https://anonhg.NetBSD.org/src/rev/0ea559c3cbc0
branches:  trunk
changeset: 808574:0ea559c3cbc0
user:      rtr <rtr%NetBSD.org@localhost>
date:      Sun May 24 15:43:45 2015 +0000

description:
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).

diffstat:

 sys/netinet/in_pcb.c    |  19 ++-----------------
 sys/netinet/in_pcb.h    |   3 +--
 sys/netinet/tcp_input.c |  40 +++++++++++++++-------------------------
 sys/netinet6/in6_pcb.c  |  19 ++-----------------
 sys/netinet6/in6_pcb.h  |   3 +--
 5 files changed, 21 insertions(+), 63 deletions(-)

diffs (199 lines):

diff -r a1d559f3ed1e -r 0ea559c3cbc0 sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c      Sun May 24 14:56:57 2015 +0000
+++ b/sys/netinet/in_pcb.c      Sun May 24 15:43:45 2015 +0000
@@ -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"
@@ -443,21 +443,6 @@
 }
 
 /*
- * 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.
  * If don't have a local address for this socket yet,
diff -r a1d559f3ed1e -r 0ea559c3cbc0 sys/netinet/in_pcb.h
--- a/sys/netinet/in_pcb.h      Sun May 24 14:56:57 2015 +0000
+++ b/sys/netinet/in_pcb.h      Sun May 24 15:43:45 2015 +0000
@@ -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 @@
 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 -r a1d559f3ed1e -r 0ea559c3cbc0 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Sun May 24 14:56:57 2015 +0000
+++ b/sys/netinet/tcp_input.c   Sun May 24 15:43:45 2015 +0000
@@ -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 @@
        struct in6pcb *in6p = NULL;
 #endif
        struct tcpcb *tp = 0;
-       struct mbuf *am;
        int s;
        struct socket *oso;
 
@@ -4069,45 +4068,36 @@
        }
 #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 -r a1d559f3ed1e -r 0ea559c3cbc0 sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c    Sun May 24 14:56:57 2015 +0000
+++ b/sys/netinet6/in6_pcb.c    Sun May 24 15:43:45 2015 +0000
@@ -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"
@@ -418,21 +418,6 @@
 }
 
 /*
- * 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.
  * If don't have a local address for this socket yet,
diff -r a1d559f3ed1e -r 0ea559c3cbc0 sys/netinet6/in6_pcb.h
--- a/sys/netinet6/in6_pcb.h    Sun May 24 14:56:57 2015 +0000
+++ b/sys/netinet6/in6_pcb.h    Sun May 24 15:43:45 2015 +0000
@@ -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 @@
 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 *,



Home | Main Index | Thread Index | Old Index