From owner-svn-src-all@FreeBSD.ORG Sat Mar 21 11:18:59 2009 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 D6C28106564A; Sat, 21 Mar 2009 11:18:59 +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 BA4708FC22; Sat, 21 Mar 2009 11:18:59 +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 n2LBIxZe034643; Sat, 21 Mar 2009 11:18:59 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2LBIxtk034636; Sat, 21 Mar 2009 11:18:59 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200903211118.n2LBIxtk034636@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 21 Mar 2009 11:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190197 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb 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: Sat, 21 Mar 2009 11:19:00 -0000 Author: bz Date: Sat Mar 21 11:18:59 2009 New Revision: 190197 URL: http://svn.freebsd.org/changeset/base/190197 Log: MFC r185370: Merge in6_pcbfree() into in_pcbfree() which after the previous IPsec change in r185366 (r185366 for stable/7) only differed in two additonal IPv6 lines. Rather than splattering conditional code everywhere add the v6 check centrally at this single place. 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/in_pcb.c stable/7/sys/netinet/tcp_timewait.c 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/in_pcb.c ============================================================================== --- stable/7/sys/netinet/in_pcb.c Sat Mar 21 10:10:33 2009 (r190196) +++ stable/7/sys/netinet/in_pcb.c Sat Mar 21 11:18:59 2009 (r190197) @@ -901,10 +901,17 @@ in_pcbfree(struct inpcb *inp) INP_WLOCK_ASSERT(inp); #ifdef IPSEC - ipsec_delete_pcbpolicy(inp); + if (inp->inp_sp != NULL) + ipsec_delete_pcbpolicy(inp); #endif /* IPSEC */ inp->inp_gencnt = ++ipi->ipi_gencnt; in_pcbremlists(inp); +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6PROTO) { + ip6_freepcbopts(inp->in6p_outputopts); + ip6_freemoptions(inp->in6p_moptions); + } +#endif if (inp->inp_options) (void)m_free(inp->inp_options); if (inp->inp_moptions != NULL) Modified: stable/7/sys/netinet/tcp_timewait.c ============================================================================== --- stable/7/sys/netinet/tcp_timewait.c Sat Mar 21 10:10:33 2009 (r190196) +++ stable/7/sys/netinet/tcp_timewait.c Sat Mar 21 11:18:59 2009 (r190197) @@ -501,14 +501,8 @@ tcp_twclose(struct tcptw *tw, int reuse) */ INP_WUNLOCK(inp); } - } else { -#ifdef INET6 - if (inp->inp_vflag & INP_IPV6PROTO) - in6_pcbfree(inp); - else -#endif - in_pcbfree(inp); - } + } else + in_pcbfree(inp); tcpstat.tcps_closed++; crfree(tw->tw_cred); tw->tw_cred = NULL; Modified: stable/7/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/7/sys/netinet/tcp_usrreq.c Sat Mar 21 10:10:33 2009 (r190196) +++ stable/7/sys/netinet/tcp_usrreq.c Sat Mar 21 11:18:59 2009 (r190197) @@ -155,9 +155,6 @@ static void tcp_detach(struct socket *so, struct inpcb *inp) { struct tcpcb *tp; -#ifdef INET6 - int isipv6 = INP_CHECK_SOCKAF(so, AF_INET6) != 0; -#endif INP_INFO_WLOCK_ASSERT(&tcbinfo); INP_WLOCK_ASSERT(inp); @@ -184,12 +181,7 @@ tcp_detach(struct socket *so, struct inp KASSERT(tp == NULL, ("tcp_detach: INP_TIMEWAIT && " "INP_DROPPED && tp != NULL")); in_pcbdetach(inp); -#ifdef INET6 - if (isipv6) - in6_pcbfree(inp); - else -#endif - in_pcbfree(inp); + in_pcbfree(inp); } else { in_pcbdetach(inp); INP_WUNLOCK(inp); @@ -208,15 +200,9 @@ tcp_detach(struct socket *so, struct inp tp->t_state < TCPS_SYN_SENT) { tcp_discardcb(tp); in_pcbdetach(inp); -#ifdef INET6 - if (isipv6) - in6_pcbfree(inp); - else -#endif - in_pcbfree(inp); - } else { - in_pcbdetach(inp); - } + in_pcbfree(inp); + } else + in_pcbdetach(inp); } } @@ -1464,12 +1450,7 @@ tcp_attach(struct socket *so) tp = tcp_newtcpcb(inp); if (tp == NULL) { in_pcbdetach(inp); -#ifdef INET6 - if (isipv6) - in6_pcbfree(inp); - else -#endif - in_pcbfree(inp); + in_pcbfree(inp); INP_INFO_WUNLOCK(&tcbinfo); return (ENOBUFS); } Modified: stable/7/sys/netinet6/in6_pcb.c ============================================================================== --- stable/7/sys/netinet6/in6_pcb.c Sat Mar 21 10:10:33 2009 (r190196) +++ stable/7/sys/netinet6/in6_pcb.c Sat Mar 21 11:18:59 2009 (r190197) @@ -101,12 +101,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef IPSEC -#include -#include -#include -#endif /* IPSEC */ - #include struct in6_addr zeroin6_addr; @@ -412,39 +406,6 @@ in6_pcbdisconnect(struct inpcb *inp) in_pcbrehash(inp); } -void -in6_pcbfree(struct inpcb *inp) -{ - struct inpcbinfo *ipi = inp->inp_pcbinfo; - - KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); - - INP_INFO_WLOCK_ASSERT(ipi); - INP_WLOCK_ASSERT(inp); - -#ifdef IPSEC - if (inp->in6p_sp != NULL) - ipsec_delete_pcbpolicy(inp); -#endif /* IPSEC */ - inp->inp_gencnt = ++ipi->ipi_gencnt; - in_pcbremlists(inp); - ip6_freepcbopts(inp->in6p_outputopts); - ip6_freemoptions(inp->in6p_moptions); - /* Check and free IPv4 related resources in case of mapped addr */ - if (inp->inp_options) - (void)m_free(inp->inp_options); - if (inp->inp_moptions != NULL) - inp_freemoptions(inp->inp_moptions); - inp->inp_vflag = 0; - crfree(inp->inp_cred); - -#ifdef MAC - mac_destroy_inpcb(inp); -#endif - INP_WUNLOCK(inp); - uma_zfree(ipi->ipi_zone, inp); -} - struct sockaddr * in6_sockaddr(in_port_t port, struct in6_addr *addr_p) { Modified: stable/7/sys/netinet6/in6_pcb.h ============================================================================== --- stable/7/sys/netinet6/in6_pcb.h Sat Mar 21 10:10:33 2009 (r190196) +++ stable/7/sys/netinet6/in6_pcb.h Sat Mar 21 11:18:59 2009 (r190197) @@ -74,7 +74,6 @@ 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_pcbdisconnect __P((struct inpcb *)); -void in6_pcbfree __P((struct inpcb *)); int in6_pcbladdr __P((struct inpcb *, struct sockaddr *, struct in6_addr **)); struct inpcb * Modified: stable/7/sys/netinet6/raw_ip6.c ============================================================================== --- stable/7/sys/netinet6/raw_ip6.c Sat Mar 21 10:10:33 2009 (r190196) +++ stable/7/sys/netinet6/raw_ip6.c Sat Mar 21 11:18:59 2009 (r190197) @@ -601,7 +601,7 @@ rip6_detach(struct socket *so) INP_WLOCK(inp); FREE(inp->in6p_icmp6filt, M_PCB); in_pcbdetach(inp); - in6_pcbfree(inp); + in_pcbfree(inp); INP_INFO_WUNLOCK(&ripcbinfo); } Modified: stable/7/sys/netinet6/udp6_usrreq.c ============================================================================== --- stable/7/sys/netinet6/udp6_usrreq.c Sat Mar 21 10:10:33 2009 (r190196) +++ stable/7/sys/netinet6/udp6_usrreq.c Sat Mar 21 11:18:59 2009 (r190197) @@ -890,7 +890,7 @@ udp6_detach(struct socket *so) INP_INFO_WLOCK(&udbinfo); INP_WLOCK(inp); in_pcbdetach(inp); - in6_pcbfree(inp); + in_pcbfree(inp); INP_INFO_WUNLOCK(&udbinfo); }