Module Name:    src
Committed By:   rtr
Date:           Sat Apr  4 04:33:39 UTC 2015

Modified Files:
        src/sys/netinet: dccp_usrreq.c
        src/sys/netinet6: dccp6_usrreq.c dccp6_var.h

Log Message:
* update dccp_bind for struct mbuf * to struct sockaddr * parameter change
* pass NULL instead of casting 0 to a pointer when calling in_pcbbind()


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/dccp_usrreq.c
cvs rdiff -u -r1.1 -r1.2 src/sys/netinet6/dccp6_usrreq.c \
    src/sys/netinet6/dccp6_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/dccp_usrreq.c
diff -u src/sys/netinet/dccp_usrreq.c:1.1 src/sys/netinet/dccp_usrreq.c:1.2
--- src/sys/netinet/dccp_usrreq.c:1.1	Tue Feb 10 19:11:52 2015
+++ src/sys/netinet/dccp_usrreq.c	Sat Apr  4 04:33:38 2015
@@ -1,5 +1,5 @@
 /*	$KAME: dccp_usrreq.c,v 1.67 2005/11/03 16:05:04 nishida Exp $	*/
-/*	$NetBSD: dccp_usrreq.c,v 1.1 2015/02/10 19:11:52 rjs Exp $ */
+/*	$NetBSD: dccp_usrreq.c,v 1.2 2015/04/04 04:33:38 rtr Exp $ */
 
 /*
  * Copyright (c) 2003 Joacim H�ggmark, Magnus Erixzon, Nils-Erik Mattsson 
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.1 2015/02/10 19:11:52 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.2 2015/04/04 04:33:38 rtr Exp $");
 
 #include "opt_inet.h"
 #include "opt_dccp.h"
@@ -1820,12 +1820,11 @@ out:
 }
 
 static int
-dccp_bind(struct socket *so, struct mbuf *m, struct lwp *l)
+dccp_bind(struct socket *so, struct sockaddr *nam, struct lwp *l)
 {
 	struct inpcb *inp;
 	int error;
-	struct sockaddr_in *sinp;
-	struct sockaddr *nam;
+	struct sockaddr_in *sin = (struct sockaddr_in *)nam;
 
 	DCCP_DEBUG((LOG_INFO, "Entering dccp_bind!\n"));
 	INP_INFO_WLOCK(&dccpbinfo);
@@ -1836,15 +1835,13 @@ dccp_bind(struct socket *so, struct mbuf
 	}
 
 	/* Do not bind to multicast addresses! */
-	nam = mtod(m, struct sockaddr *);
-	sinp = (struct sockaddr_in *)nam;
-	if (sinp->sin_family == AF_INET &&
-	    IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) {
+	if (sin->sin_family == AF_INET &&
+	    IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) {
 		INP_INFO_WUNLOCK(&dccpbinfo);
 		return EAFNOSUPPORT;
 	}
 	INP_LOCK(inp);
-	error = in_pcbbind(inp, m, l);
+	error = in_pcbbind(inp, sin, l);
 	INP_UNLOCK(inp);
 	INP_INFO_WUNLOCK(&dccpbinfo);
 	return error;
@@ -1964,11 +1961,11 @@ dccp_doconnect(struct socket *so, struct
 #ifdef INET6
 		if (isipv6) {
 			DCCP_DEBUG((LOG_INFO, "Running in6_pcbbind!\n"));
-			error = in6_pcbbind(in6p, (struct mbuf *)0, l);
+			error = in6_pcbbind(in6p, NULL, l);
 		} else
 #endif /* INET6 */
 		{
-			error = in_pcbbind(inp, (struct mbuf *)0, l);
+			error = in_pcbbind(inp, NULL, l);
 		}
 		if (error) {
 			DCCP_DEBUG((LOG_INFO, "in_pcbbind=%d\n",error));
@@ -2260,7 +2257,7 @@ dccp_listen(struct socket *so, struct lw
 	INP_INFO_RUNLOCK(&dccpbinfo);
 	dp = (struct dccpcb *)inp->inp_ppcb;
 	if (inp->inp_lport == 0)
-		error = in_pcbbind(inp, (struct mbuf *)0, td);
+		error = in_pcbbind(inp, NULL, td);
 	if (error == 0) {
 		dp->state = DCCPS_LISTEN;
 		dp->who = DCCP_LISTENER;

Index: src/sys/netinet6/dccp6_usrreq.c
diff -u src/sys/netinet6/dccp6_usrreq.c:1.1 src/sys/netinet6/dccp6_usrreq.c:1.2
--- src/sys/netinet6/dccp6_usrreq.c:1.1	Tue Feb 10 19:11:52 2015
+++ src/sys/netinet6/dccp6_usrreq.c	Sat Apr  4 04:33:39 2015
@@ -1,5 +1,5 @@
 /*	$KAME: dccp6_usrreq.c,v 1.13 2005/07/27 08:42:56 nishida Exp $	*/
-/*	$NetBSD: dccp6_usrreq.c,v 1.1 2015/02/10 19:11:52 rjs Exp $ */
+/*	$NetBSD: dccp6_usrreq.c,v 1.2 2015/04/04 04:33:39 rtr Exp $ */
 
 /*
  * Copyright (C) 2003 WIDE Project.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dccp6_usrreq.c,v 1.1 2015/02/10 19:11:52 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dccp6_usrreq.c,v 1.2 2015/04/04 04:33:39 rtr Exp $");
 
 #include "opt_inet.h"
 #include "opt_dccp.h"
@@ -111,12 +111,11 @@ dccp6_ctlinput(int cmd, const struct soc
 }
 
 int
-dccp6_bind(struct socket *so, struct mbuf *m, struct lwp *td)
+dccp6_bind(struct socket *so, struct sockaddr *nam, struct lwp *td)
 {
 	struct in6pcb *in6p;
-	struct sockaddr *nam;
 	int error;
-	struct sockaddr_in6 *sin6p;
+	struct sockaddr_in6 *sin6p = (struct sockaddr_in6 *)nam;
 
 	DCCP_DEBUG((LOG_INFO, "Entering dccp6_bind!\n"));
 	INP_INFO_WLOCK(&dccpbinfo);
@@ -127,8 +126,6 @@ dccp6_bind(struct socket *so, struct mbu
 		return EINVAL;
 	}
 	/* Do not bind to multicast addresses! */
-	nam = mtod(m, struct sockaddr *);
-	sin6p = (struct sockaddr_in6 *)nam;
 	if (sin6p->sin6_family == AF_INET6 &&
 	    IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr)) {
 		INP_INFO_WUNLOCK(&dccpbinfo);
@@ -139,7 +136,7 @@ dccp6_bind(struct socket *so, struct mbu
 	in6todccpcb(in6p)->inp_vflag &= ~INP_IPV4;
 	in6todccpcb(in6p)->inp_vflag |= INP_IPV6;
 	
-	error = in6_pcbbind(in6p, m, td);
+	error = in6_pcbbind(in6p, sin6p, td);
 	INP_UNLOCK(inp);
 	INP_INFO_WUNLOCK(&dccpbinfo);
 	return error;
@@ -253,7 +250,7 @@ dccp6_listen(struct socket *so, struct l
 	dp = in6todccpcb(in6p);
 	DCCP_DEBUG((LOG_INFO, "Checking in6p->in6p_lport!\n"));
 	if (in6p->in6p_lport == 0) {
-		error = in6_pcbbind(in6p, (struct mbuf *)0, l);
+		error = in6_pcbbind(in6p, NULL, l);
 	}
 	if (error == 0) {
 		dp->state = DCCPS_LISTEN;
Index: src/sys/netinet6/dccp6_var.h
diff -u src/sys/netinet6/dccp6_var.h:1.1 src/sys/netinet6/dccp6_var.h:1.2
--- src/sys/netinet6/dccp6_var.h:1.1	Tue Feb 10 19:11:52 2015
+++ src/sys/netinet6/dccp6_var.h	Sat Apr  4 04:33:39 2015
@@ -1,5 +1,5 @@
 /*	$KAME: dccp6_var.h,v 1.3 2003/11/18 04:55:43 ono Exp $	*/
-/*	$NetBSD: dccp6_var.h,v 1.1 2015/02/10 19:11:52 rjs Exp $ */
+/*	$NetBSD: dccp6_var.h,v 1.2 2015/04/04 04:33:39 rtr Exp $ */
 
 /*
  * Copyright (c) 2003 Joacim H�ggmark
@@ -43,7 +43,7 @@ void *	dccp6_ctlinput(int, const struct 
 int	dccp6_input(struct mbuf **, int *, int);
 int	dccp6_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
 		     struct mbuf *, struct lwp *);
-int	dccp6_bind(struct socket *, struct mbuf *, struct lwp *);
+int	dccp6_bind(struct socket *, struct sockaddr *, struct lwp *);
 int	dccp6_listen(struct socket *, struct lwp *);
 int	dccp6_connect(struct socket *, struct mbuf *, struct lwp *);
 int	dccp6_accept(struct socket *, struct mbuf *);

Reply via email to