From owner-svn-src-all@FreeBSD.ORG Wed Nov 26 20:52:27 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C912E1065672; Wed, 26 Nov 2008 20:52:27 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A85948FC12; Wed, 26 Nov 2008 20:52:27 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAQKqRxb065926; Wed, 26 Nov 2008 20:52:27 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAQKqRN5065921; Wed, 26 Nov 2008 20:52:27 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811262052.mAQKqRN5065921@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 26 Nov 2008 20:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185344 - in head/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2008 20:52:28 -0000 Author: bz Date: Wed Nov 26 20:52:26 2008 New Revision: 185344 URL: http://svn.freebsd.org/changeset/base/185344 Log: Remove in6_pcbdetach() as it is exactly the same function as in_pcbdetach() and we don't need the code twice. Reviewed by: rwatson MFC after: 6 weeks (*) (*) possibly need to leave a stub wrapper in 7 to keep the symbol. Modified: head/sys/netinet/tcp_usrreq.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_pcb.h head/sys/netinet6/raw_ip6.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Wed Nov 26 19:29:33 2008 (r185343) +++ head/sys/netinet/tcp_usrreq.c Wed Nov 26 20:52:26 2008 (r185344) @@ -187,24 +187,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 { @@ -220,23 +211,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); } } @@ -1496,17 +1478,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(&V_tcbinfo); return (ENOBUFS); } Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Wed Nov 26 19:29:33 2008 (r185343) +++ head/sys/netinet6/in6_pcb.c Wed Nov 26 20:52:26 2008 (r185344) @@ -411,16 +411,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: head/sys/netinet6/in6_pcb.h ============================================================================== --- head/sys/netinet6/in6_pcb.h Wed Nov 26 19:29:33 2008 (r185343) +++ head/sys/netinet6/in6_pcb.h Wed Nov 26 20:52:26 2008 (r185344) @@ -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: head/sys/netinet6/raw_ip6.c ============================================================================== --- head/sys/netinet6/raw_ip6.c Wed Nov 26 19:29:33 2008 (r185343) +++ head/sys/netinet6/raw_ip6.c Wed Nov 26 20:52:26 2008 (r185344) @@ -604,7 +604,7 @@ rip6_detach(struct socket *so) INP_INFO_WLOCK(&V_ripcbinfo); INP_WLOCK(inp); free(inp->in6p_icmp6filt, M_PCB); - in6_pcbdetach(inp); + in_pcbdetach(inp); in6_pcbfree(inp); INP_INFO_WUNLOCK(&V_ripcbinfo); } Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Wed Nov 26 19:29:33 2008 (r185343) +++ head/sys/netinet6/udp6_usrreq.c Wed Nov 26 20:52:26 2008 (r185344) @@ -900,7 +900,7 @@ udp6_detach(struct socket *so) INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); - in6_pcbdetach(inp); + in_pcbdetach(inp); in6_pcbfree(inp); INP_INFO_WUNLOCK(&V_udbinfo); }