Source-Changes-HG archive

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

[src/trunk]: src/sys/netsmb pass connect address directly to soconnect()



details:   https://anonhg.NetBSD.org/src/rev/bda59755f4c6
branches:  trunk
changeset: 808555:bda59755f4c6
user:      rtr <rtr%NetBSD.org@localhost>
date:      Fri May 22 22:05:32 2015 +0000

description:
pass connect address directly to soconnect()

instead of allocating an mbuf, copying the address into it and then
mtod()'ing it back to a sockaddr * for soconnect.

diffstat:

 sys/netsmb/smb_trantcp.c |  11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diffs (40 lines):

diff -r b88f73a7b4d2 -r bda59755f4c6 sys/netsmb/smb_trantcp.c
--- a/sys/netsmb/smb_trantcp.c  Fri May 22 18:27:03 2015 +0000
+++ b/sys/netsmb/smb_trantcp.c  Fri May 22 22:05:32 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smb_trantcp.c,v 1.48 2015/05/02 17:18:04 rtr Exp $     */
+/*     $NetBSD: smb_trantcp.c,v 1.49 2015/05/22 22:05:32 rtr Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smb_trantcp.c,v 1.48 2015/05/02 17:18:04 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smb_trantcp.c,v 1.49 2015/05/22 22:05:32 rtr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -161,7 +161,6 @@
 {
        struct socket *so;
        int error;
-       struct mbuf *m;
 
        error = socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP, l, NULL);
        if (error)
@@ -181,12 +180,8 @@
                goto bad;
        nb_setsockopt_int(so, SOL_SOCKET, SO_KEEPALIVE, 1);
        nb_setsockopt_int(so, IPPROTO_TCP, TCP_NODELAY, 1);
-       m = m_get(M_WAIT, MT_SONAME);
-       *mtod(m, struct sockaddr *) = *(struct sockaddr *)to;
-       m->m_len = sizeof(struct sockaddr);
        solock(so);
-       error = soconnect(so, mtod(m, struct sockaddr*), l);
-       m_free(m);
+       error = soconnect(so, (struct sockaddr *)to, l);
        if (error) {
                sounlock(so);
                goto bad;



Home | Main Index | Thread Index | Old Index