Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Feb 2017 05:58:16 +0000 (UTC)
From:      =?UTF-8?Q?Ermal_Lu=c3=a7i?= <eri@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313528 - in head/sys: netinet netinet6
Message-ID:  <201702100558.v1A5wGco084846@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eri
Date: Fri Feb 10 05:58:16 2017
New Revision: 313528
URL: https://svnweb.freebsd.org/changeset/base/313528

Log:
  Revert r313527
  
  Heh svn is not git

Modified:
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/tcp_usrreq.c
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/in6_pcb.c
  head/sys/netinet6/in6_pcb.h
  head/sys/netinet6/in6_src.c
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet/in_pcb.c
==============================================================================
--- head/sys/netinet/in_pcb.c	Fri Feb 10 05:51:39 2017	(r313527)
+++ head/sys/netinet/in_pcb.c	Fri Feb 10 05:58:16 2017	(r313528)
@@ -371,8 +371,8 @@ in_pcbbind(struct inpcb *inp, struct soc
  */
 #if defined(INET) || defined(INET6)
 int
-in_pcb_lport(struct inpcb *inp, struct sockaddr *nam, struct in_addr *laddrp,
-    u_short *lportp, struct ucred *cred, int lookupflags)
+in_pcb_lport(struct inpcb *inp, struct in_addr *laddrp, u_short *lportp,
+    struct ucred *cred, int lookupflags)
 {
 	struct inpcbinfo *pcbinfo;
 	struct inpcb *tmpinp;
@@ -381,7 +381,6 @@ in_pcb_lport(struct inpcb *inp, struct s
 	u_short aux, first, last, lport;
 #ifdef INET
 	struct in_addr laddr;
-	struct sockaddr_in *sin = NULL;
 #endif
 
 	pcbinfo = inp->inp_pcbinfo;
@@ -448,7 +447,6 @@ in_pcb_lport(struct inpcb *inp, struct s
 		KASSERT(laddrp != NULL, ("%s: laddrp NULL for v4 inp %p",
 		    __func__, inp));
 		laddr = *laddrp;
-		sin = (struct sockaddr_in *)nam;
 	}
 #endif
 	tmpinp = NULL;	/* Make compiler happy. */
@@ -468,29 +466,16 @@ in_pcb_lport(struct inpcb *inp, struct s
 		lport = htons(*lastport);
 
 #ifdef INET6
-		if ((inp->inp_vflag & INP_IPV6) != 0) {
-			struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam;
-			if (sin6 != NULL && (inp->inp_flags & INP_ANONPORT)) {
-				tmpinp = in6_pcblookup_hash_locked(pcbinfo,
-				    &sin6->sin6_addr, sin6->sin6_port,
-				    &inp->in6p_laddr, lport,
-				    lookupflags & (~INPLOOKUP_WILDCARD),
-				    NULL);
-			} else
-				tmpinp = in6_pcblookup_local(pcbinfo,
-				    &inp->in6p_laddr, lport, lookupflags, cred);
-		}
+		if ((inp->inp_vflag & INP_IPV6) != 0)
+			tmpinp = in6_pcblookup_local(pcbinfo,
+			    &inp->in6p_laddr, lport, lookupflags, cred);
 #endif
 #if defined(INET) && defined(INET6)
 		else
 #endif
 #ifdef INET
-			if (sin != NULL && (inp->inp_flags & INP_ANONPORT))
-				tmpinp = in_pcblookup_hash_locked(pcbinfo, sin->sin_addr, sin->sin_port, laddr,
-				    lport, lookupflags & (~INPLOOKUP_WILDCARD), NULL);
-			else
-				tmpinp = in_pcblookup_local(pcbinfo, laddr,
-				    lport, lookupflags, cred);
+			tmpinp = in_pcblookup_local(pcbinfo, laddr,
+			    lport, lookupflags, cred);
 #endif
 	} while (tmpinp != NULL);
 
@@ -586,7 +571,7 @@ in_pcbbind_setup(struct inpcb *inp, stru
 		return (EINVAL);
 	if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)
 		lookupflags = INPLOOKUP_WILDCARD;
-	if (nam == NULL || ((*lportp) == 0 && (inp->inp_flags & INP_ANONPORT))) {
+	if (nam == NULL) {
 		if ((error = prison_local_ip4(cred, &laddr)) != 0)
 			return (error);
 	} else {
@@ -707,7 +692,7 @@ in_pcbbind_setup(struct inpcb *inp, stru
 	if (*lportp != 0)
 		lport = *lportp;
 	if (lport == 0) {
-		error = in_pcb_lport(inp, nam, &laddr, &lport, cred, lookupflags);
+		error = in_pcb_lport(inp, &laddr, &lport, cred, lookupflags);
 		if (error != 0)
 			return (error);
 

Modified: head/sys/netinet/in_pcb.h
==============================================================================
--- head/sys/netinet/in_pcb.h	Fri Feb 10 05:51:39 2017	(r313527)
+++ head/sys/netinet/in_pcb.h	Fri Feb 10 05:58:16 2017	(r313528)
@@ -697,8 +697,8 @@ void	in_pcbgroup_update_mbuf(struct inpc
 void	in_pcbpurgeif0(struct inpcbinfo *, struct ifnet *);
 int	in_pcballoc(struct socket *, struct inpcbinfo *);
 int	in_pcbbind(struct inpcb *, struct sockaddr *, struct ucred *);
-int	in_pcb_lport(struct inpcb *, struct sockaddr *, struct in_addr *,
-	    u_short *, struct ucred *, int);
+int	in_pcb_lport(struct inpcb *, struct in_addr *, u_short *,
+	    struct ucred *, int);
 int	in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
 	    u_short *, struct ucred *);
 int	in_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *);

Modified: head/sys/netinet/tcp_usrreq.c
==============================================================================
--- head/sys/netinet/tcp_usrreq.c	Fri Feb 10 05:51:39 2017	(r313527)
+++ head/sys/netinet/tcp_usrreq.c	Fri Feb 10 05:58:16 2017	(r313528)
@@ -1238,12 +1238,9 @@ tcp_connect(struct tcpcb *tp, struct soc
 	INP_HASH_WLOCK(&V_tcbinfo);
 
 	if (inp->inp_lport == 0) {
-		inp->inp_flags |= INP_ANONPORT;
-		error = in_pcbbind(inp, nam, td->td_ucred);
-		if (error) {
-			inp->inp_flags &= ~INP_ANONPORT;
+		error = in_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
+		if (error)
 			goto out;
-		}
 	}
 
 	/*
@@ -1299,12 +1296,9 @@ tcp6_connect(struct tcpcb *tp, struct so
 	INP_HASH_WLOCK(&V_tcbinfo);
 
 	if (inp->inp_lport == 0) {
-		inp->inp_flags |= INP_ANONPORT;
-		error = in6_pcbbind(inp, nam, td->td_ucred);
-		if (error) {
-			inp->inp_flags &= ~INP_ANONPORT;
+		error = in6_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
+		if (error)
 			goto out;
-		}
 	}
 	error = in6_pcbconnect(inp, nam, td->td_ucred);
 	if (error != 0)

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c	Fri Feb 10 05:51:39 2017	(r313527)
+++ head/sys/netinet/udp_usrreq.c	Fri Feb 10 05:58:16 2017	(r313528)
@@ -636,7 +636,7 @@ udp_input(struct mbuf **mp, int *offp, i
 			goto badunlocked;
 		}
 		UDP_PROBE(receive, NULL, last, ip, last, uh);
-		if (udp_append(last, ip, m, iphlen, udpin) == 0) 
+		if (udp_append(last, ip, m, iphlen, udp_in) == 0) 
 			INP_RUNLOCK(last);
 	inp_lost:
 		INP_INFO_RUNLOCK(pcbinfo);

Modified: head/sys/netinet6/in6_pcb.c
==============================================================================
--- head/sys/netinet6/in6_pcb.c	Fri Feb 10 05:51:39 2017	(r313527)
+++ head/sys/netinet6/in6_pcb.c	Fri Feb 10 05:58:16 2017	(r313528)
@@ -132,7 +132,7 @@ in6_pcbbind(register struct inpcb *inp, 
 		return (EINVAL);
 	if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)
 		lookupflags = INPLOOKUP_WILDCARD;
-	if (nam == NULL || (inp->inp_flags & INP_ANONPORT)) {
+	if (nam == NULL) {
 		if ((error = prison_local_ip6(cred, &inp->in6p_laddr,
 		    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
 			return (error);
@@ -296,7 +296,7 @@ in6_pcbbind(register struct inpcb *inp, 
 		inp->in6p_laddr = sin6->sin6_addr;
 	}
 	if (lport == 0) {
-		if ((error = in6_pcbsetport(nam, &inp->in6p_laddr, inp, cred)) != 0) {
+		if ((error = in6_pcbsetport(&inp->in6p_laddr, inp, cred)) != 0) {
 			/* Undo an address bind that may have occurred. */
 			inp->in6p_laddr = in6addr_any;
 			return (error);
@@ -416,12 +416,9 @@ in6_pcbconnect_mbuf(register struct inpc
 	}
 	if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) {
 		if (inp->inp_lport == 0) {
-			inp->inp_flags |= INP_ANONPORT;
-			error = in6_pcbbind(inp, nam, cred);
-			if (error) {
-				inp->inp_flags &= ~INP_ANONPORT;
+			error = in6_pcbbind(inp, (struct sockaddr *)0, cred);
+			if (error)
 				return (error);
-			}
 		}
 		inp->in6p_laddr = addr6;
 	}

Modified: head/sys/netinet6/in6_pcb.h
==============================================================================
--- head/sys/netinet6/in6_pcb.h	Fri Feb 10 05:51:39 2017	(r313527)
+++ head/sys/netinet6/in6_pcb.h	Fri Feb 10 05:58:16 2017	(r313528)
@@ -112,8 +112,7 @@ int	in6_getsockaddr(struct socket *so, s
 int	in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam);
 int	in6_mapped_peeraddr(struct socket *so, struct sockaddr **nam);
 int	in6_selecthlim(struct in6pcb *, struct ifnet *);
-int	in6_pcbsetport(struct sockaddr *, struct in6_addr *, struct inpcb *,
-			struct ucred *);
+int	in6_pcbsetport(struct in6_addr *, struct inpcb *, struct ucred *);
 void	init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m, int);
 #endif /* _KERNEL */
 

Modified: head/sys/netinet6/in6_src.c
==============================================================================
--- head/sys/netinet6/in6_src.c	Fri Feb 10 05:51:39 2017	(r313527)
+++ head/sys/netinet6/in6_src.c	Fri Feb 10 05:58:16 2017	(r313528)
@@ -956,8 +956,7 @@ in6_selecthlim(struct inpcb *in6p, struc
  * share this function by all *bsd*...
  */
 int
-in6_pcbsetport(struct sockaddr *nam6, struct in6_addr *laddr, struct inpcb *inp,
-    struct ucred *cred)
+in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct ucred *cred)
 {
 	struct socket *so = inp->inp_socket;
 	u_int16_t lport = 0;
@@ -980,7 +979,7 @@ in6_pcbsetport(struct sockaddr *nam6, st
 
 	inp->inp_flags |= INP_ANONPORT;
 
-	error = in_pcb_lport(inp, nam6, NULL, &lport, cred, lookupflags);
+	error = in_pcb_lport(inp, NULL, &lport, cred, lookupflags);
 	if (error != 0)
 		return (error);
 

Modified: head/sys/netinet6/udp6_usrreq.c
==============================================================================
--- head/sys/netinet6/udp6_usrreq.c	Fri Feb 10 05:51:39 2017	(r313527)
+++ head/sys/netinet6/udp6_usrreq.c	Fri Feb 10 05:58:16 2017	(r313528)
@@ -778,16 +778,11 @@ udp6_output(struct inpcb *inp, struct mb
 				error = EADDRNOTAVAIL;
 			goto release;
 		}
-		if (inp->inp_lport == 0) {
-			inp->inp_flags |= INP_ANONPORT;
-			error = in6_pcbsetport((struct sockaddr *)addr6, laddr,
-						inp, td->td_ucred);
-			if (error) {
-				inp->inp_flags &= ~INP_ANONPORT;
-				/* Undo an address bind that may have occurred. */
-				inp->in6p_laddr = in6addr_any;
-				goto release;
-			}
+		if (inp->inp_lport == 0 &&
+		    (error = in6_pcbsetport(laddr, inp, td->td_ucred)) != 0) {
+			/* Undo an address bind that may have occurred. */
+			inp->in6p_laddr = in6addr_any;
+			goto release;
 		}
 	} else {
 		if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702100558.v1A5wGco084846>