change sosend() to accept sockaddr * instead of mbuf * for nam. trunk
authorrtr <rtr@NetBSD.org>
Sat, 09 May 2015 15:22:47 +0000
branchtrunk
changeset 235293 28e981405ee8
parent 235292 a18620b96d88
child 235294 7fd636ebd09a
change sosend() to accept sockaddr * instead of mbuf * for nam. bump to 7.99.16
sys/kern/uipc_socket.c
sys/kern/uipc_syscalls.c
sys/nfs/nfs_boot.c
sys/nfs/nfs_socket.c
sys/sys/param.h
sys/sys/socketvar.h
--- a/sys/kern/uipc_socket.c	Sat May 09 15:14:45 2015 +0000
+++ b/sys/kern/uipc_socket.c	Sat May 09 15:22:47 2015 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.244 2015/05/03 04:18:45 rtr Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.245 2015/05/09 15:22:47 rtr Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.244 2015/05/03 04:18:45 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.245 2015/05/09 15:22:47 rtr Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_sock_counters.h"
@@ -883,8 +883,8 @@
  * Data and control buffers are freed on return.
  */
 int
-sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top,
-	struct mbuf *control, int flags, struct lwp *l)
+sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
+	struct mbuf *top, struct mbuf *control, int flags, struct lwp *l)
 {
 	struct mbuf	**mp, *m;
 	long		space, len, resid, clen, mlen;
@@ -1059,12 +1059,8 @@
 				error = (*so->so_proto->pr_usrreqs->pr_sendoob)(so,
 				    top, control);
 			} else {
-				struct sockaddr *sin = NULL;
-				if (addr) {
-					sin = mtod(addr, struct sockaddr *);
-				}
 				error = (*so->so_proto->pr_usrreqs->pr_send)(so,
-				    top, sin, control, l);
+				    top, addr, control, l);
 			}
 			if (dontroute)
 				so->so_options &= ~SO_DONTROUTE;
--- a/sys/kern/uipc_syscalls.c	Sat May 09 15:14:45 2015 +0000
+++ b/sys/kern/uipc_syscalls.c	Sat May 09 15:22:47 2015 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls.c,v 1.177 2015/05/02 17:18:03 rtr Exp $	*/
+/*	$NetBSD: uipc_syscalls.c,v 1.178 2015/05/09 15:22:47 rtr Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.177 2015/05/02 17:18:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.178 2015/05/09 15:22:47 rtr Exp $");
 
 #include "opt_pipe.h"
 
@@ -532,6 +532,7 @@
 {
 
 	struct iovec	aiov[UIO_SMALLIOV], *iov = aiov, *tiov, *ktriov = NULL;
+	struct sockaddr *sa = NULL;
 	struct mbuf	*to, *control;
 	struct uio	auio;
 	size_t		len, iovsz;
@@ -611,8 +612,12 @@
 	if (mp->msg_control)
 		MCLAIM(control, so->so_mowner);
 
+	if (to) {
+		sa = mtod(to, struct sockaddr *);
+	}
+
 	len = auio.uio_resid;
-	error = (*so->so_send)(so, to, &auio, NULL, control, flags, l);
+	error = (*so->so_send)(so, sa, &auio, NULL, control, flags, l);
 	/* Protocol is responsible for freeing 'control' */
 	control = NULL;
 
--- a/sys/nfs/nfs_boot.c	Sat May 09 15:14:45 2015 +0000
+++ b/sys/nfs/nfs_boot.c	Sat May 09 15:22:47 2015 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_boot.c,v 1.83 2015/04/03 20:01:07 rtr Exp $	*/
+/*	$NetBSD: nfs_boot.c,v 1.84 2015/05/09 15:22:47 rtr Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_boot.c,v 1.83 2015/04/03 20:01:07 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_boot.c,v 1.84 2015/05/09 15:22:47 rtr Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -468,7 +468,8 @@
 		error = ENOBUFS;
 		goto out;
 	}
-	error = (*so->so_send)(so, nam, NULL, m, NULL, 0, lwp);
+	error = (*so->so_send)(so, mtod(nam, struct sockaddr *), NULL,
+	    m, NULL, 0, lwp);
 	if (error) {
 		printf("nfs_boot: sosend: %d\n", error);
 		goto out;
--- a/sys/nfs/nfs_socket.c	Sat May 09 15:14:45 2015 +0000
+++ b/sys/nfs/nfs_socket.c	Sat May 09 15:22:47 2015 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_socket.c,v 1.195 2015/05/02 17:18:04 rtr Exp $	*/
+/*	$NetBSD: nfs_socket.c,v 1.196 2015/05/09 15:22:47 rtr Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1995
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.195 2015/05/02 17:18:04 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.196 2015/05/09 15:22:47 rtr Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -439,7 +439,7 @@
 int
 nfs_send(struct socket *so, struct mbuf *nam, struct mbuf *top, struct nfsreq *rep, struct lwp *l)
 {
-	struct mbuf *sendnam;
+	struct sockaddr *sendnam;
 	int error, soflags, flags;
 
 	/* XXX nfs_doio()/nfs_request() calls with  rep->r_lwp == NULL */
@@ -463,7 +463,7 @@
 	if ((soflags & PR_CONNREQUIRED) || (so->so_state & SS_ISCONNECTED))
 		sendnam = NULL;
 	else
-		sendnam = nam;
+		sendnam = mtod(nam, struct sockaddr *);
 	if (so->so_type == SOCK_SEQPACKET)
 		flags = MSG_EOR;
 	else
--- a/sys/sys/param.h	Sat May 09 15:14:45 2015 +0000
+++ b/sys/sys/param.h	Sat May 09 15:22:47 2015 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.477 2015/05/02 17:18:04 rtr Exp $	*/
+/*	$NetBSD: param.h,v 1.478 2015/05/09 15:22:47 rtr Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	799001500	/* NetBSD 7.99.15 */
+#define	__NetBSD_Version__	799001600	/* NetBSD 7.99.16 */
 
 #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
     (m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
--- a/sys/sys/socketvar.h	Sat May 09 15:14:45 2015 +0000
+++ b/sys/sys/socketvar.h	Sat May 09 15:22:47 2015 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: socketvar.h,v 1.138 2015/05/02 17:18:04 rtr Exp $	*/
+/*	$NetBSD: socketvar.h,v 1.139 2015/05/09 15:22:47 rtr Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -127,6 +127,8 @@
 	char	*so_accept_filter_str;	/* saved user args */
 };
 
+struct sockaddr;
+
 struct socket {
 	kmutex_t * volatile so_lock;	/* pointer to lock on structure */
 	kcondvar_t	so_cv;		/* notifier */
@@ -167,7 +169,7 @@
 	void		*so_internal;	/* Space for svr4 stream data */
 	void		(*so_upcall) (struct socket *, void *, int, int);
 	void *		so_upcallarg;	/* Arg for above */
-	int		(*so_send) (struct socket *, struct mbuf *,
+	int		(*so_send) (struct socket *, struct sockaddr *,
 					struct uio *, struct mbuf *,
 					struct mbuf *, int, struct lwp *);
 	int		(*so_receive) (struct socket *,
@@ -241,7 +243,6 @@
 extern kmutex_t		*softnet_lock;
 
 struct mbuf;
-struct sockaddr;
 struct lwp;
 struct msghdr;
 struct stat;
@@ -315,7 +316,7 @@
 	    struct mbuf **, struct mbuf **, int *);
 int	soreserve(struct socket *, u_long, u_long);
 void	sorflush(struct socket *);
-int	sosend(struct socket *, struct mbuf *, struct uio *,
+int	sosend(struct socket *, struct sockaddr *, struct uio *,
 	    struct mbuf *, struct mbuf *, int, struct lwp *);
 int	sosetopt(struct socket *, struct sockopt *);
 int	so_setsockopt(struct lwp *, struct socket *, int, int, const void *, size_t);