svn commit: r190177 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb netinet netinet6

Bjoern A. Zeeb bz at FreeBSD.org
Fri Mar 20 14:22:15 PDT 2009


Author: bz
Date: Fri Mar 20 21:22:14 2009
New Revision: 190177
URL: http://svn.freebsd.org/changeset/base/190177

Log:
  MFC r185344:
  
    Remove in6_pcbdetach() as it is exactly the same function
    as in_pcbdetach() and we don't need the code twice.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/netinet/tcp_usrreq.c
  stable/7/sys/netinet6/in6_pcb.c
  stable/7/sys/netinet6/in6_pcb.h
  stable/7/sys/netinet6/raw_ip6.c
  stable/7/sys/netinet6/udp6_usrreq.c

Modified: stable/7/sys/netinet/tcp_usrreq.c
==============================================================================
--- stable/7/sys/netinet/tcp_usrreq.c	Fri Mar 20 21:12:38 2009	(r190176)
+++ stable/7/sys/netinet/tcp_usrreq.c	Fri Mar 20 21:22:14 2009	(r190177)
@@ -183,24 +183,15 @@ tcp_detach(struct socket *so, struct inp
 		if (inp->inp_vflag & INP_DROPPED) {
 			KASSERT(tp == NULL, ("tcp_detach: INP_TIMEWAIT && "
 			    "INP_DROPPED && tp != NULL"));
+			in_pcbdetach(inp);
 #ifdef INET6
-			if (isipv6) {
-				in6_pcbdetach(inp);
+			if (isipv6)
 				in6_pcbfree(inp);
-			} else {
+			else
 #endif
-				in_pcbdetach(inp);
 				in_pcbfree(inp);
-#ifdef INET6
-			}
-#endif
 		} else {
-#ifdef INET6
-			if (isipv6)
-				in6_pcbdetach(inp);
-			else
-#endif
-				in_pcbdetach(inp);
+			in_pcbdetach(inp);
 			INP_WUNLOCK(inp);
 		}
 	} else {
@@ -216,23 +207,14 @@ tcp_detach(struct socket *so, struct inp
 		if (inp->inp_vflag & INP_DROPPED ||
 		    tp->t_state < TCPS_SYN_SENT) {
 			tcp_discardcb(tp);
+			in_pcbdetach(inp);
 #ifdef INET6
-			if (isipv6) {
-				in6_pcbdetach(inp);
+			if (isipv6)
 				in6_pcbfree(inp);
-			} else {
+			else
 #endif
-				in_pcbdetach(inp);
 				in_pcbfree(inp);
-#ifdef INET6
-			}
-#endif
 		} else {
-#ifdef INET6
-			if (isipv6)
-				in6_pcbdetach(inp);
-			else
-#endif
 				in_pcbdetach(inp);
 		}
 	}
@@ -1481,17 +1463,13 @@ tcp_attach(struct socket *so)
 	inp->inp_vflag |= INP_IPV4;
 	tp = tcp_newtcpcb(inp);
 	if (tp == NULL) {
+		in_pcbdetach(inp);
 #ifdef INET6
-		if (isipv6) {
-			in6_pcbdetach(inp);
+		if (isipv6)
 			in6_pcbfree(inp);
-		} else {
+		else
 #endif
-			in_pcbdetach(inp);
 			in_pcbfree(inp);
-#ifdef INET6
-		}
-#endif
 		INP_INFO_WUNLOCK(&tcbinfo);
 		return (ENOBUFS);
 	}

Modified: stable/7/sys/netinet6/in6_pcb.c
==============================================================================
--- stable/7/sys/netinet6/in6_pcb.c	Fri Mar 20 21:12:38 2009	(r190176)
+++ stable/7/sys/netinet6/in6_pcb.c	Fri Mar 20 21:22:14 2009	(r190177)
@@ -413,16 +413,6 @@ in6_pcbdisconnect(struct inpcb *inp)
 }
 
 void
-in6_pcbdetach(struct inpcb *inp)
-{
-
-	KASSERT(inp->inp_socket != NULL, ("%s: inp_socket == NULL", __func__));
-
-	inp->inp_socket->so_pcb = NULL;
-	inp->inp_socket = NULL;
-}
-
-void
 in6_pcbfree(struct inpcb *inp)
 {
 	struct inpcbinfo *ipi = inp->inp_pcbinfo;

Modified: stable/7/sys/netinet6/in6_pcb.h
==============================================================================
--- stable/7/sys/netinet6/in6_pcb.h	Fri Mar 20 21:12:38 2009	(r190176)
+++ stable/7/sys/netinet6/in6_pcb.h	Fri Mar 20 21:22:14 2009	(r190177)
@@ -73,7 +73,6 @@ void	in6_pcbpurgeif0 __P((struct inpcbin
 void	in6_losing __P((struct inpcb *));
 int	in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct ucred *));
 int	in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct ucred *));
-void	in6_pcbdetach __P((struct inpcb *));
 void	in6_pcbdisconnect __P((struct inpcb *));
 void	in6_pcbfree __P((struct inpcb *));
 int	in6_pcbladdr __P((struct inpcb *, struct sockaddr *,

Modified: stable/7/sys/netinet6/raw_ip6.c
==============================================================================
--- stable/7/sys/netinet6/raw_ip6.c	Fri Mar 20 21:12:38 2009	(r190176)
+++ stable/7/sys/netinet6/raw_ip6.c	Fri Mar 20 21:22:14 2009	(r190177)
@@ -600,7 +600,7 @@ rip6_detach(struct socket *so)
 	INP_INFO_WLOCK(&ripcbinfo);
 	INP_WLOCK(inp);
 	FREE(inp->in6p_icmp6filt, M_PCB);
-	in6_pcbdetach(inp);
+	in_pcbdetach(inp);
 	in6_pcbfree(inp);
 	INP_INFO_WUNLOCK(&ripcbinfo);
 }

Modified: stable/7/sys/netinet6/udp6_usrreq.c
==============================================================================
--- stable/7/sys/netinet6/udp6_usrreq.c	Fri Mar 20 21:12:38 2009	(r190176)
+++ stable/7/sys/netinet6/udp6_usrreq.c	Fri Mar 20 21:22:14 2009	(r190177)
@@ -889,7 +889,7 @@ udp6_detach(struct socket *so)
 
 	INP_INFO_WLOCK(&udbinfo);
 	INP_WLOCK(inp);
-	in6_pcbdetach(inp);
+	in_pcbdetach(inp);
 	in6_pcbfree(inp);
 	INP_INFO_WUNLOCK(&udbinfo);
 }


More information about the svn-src-all mailing list