From owner-svn-src-head@FreeBSD.ORG Sat Apr 30 11:17:00 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 824441065672; Sat, 30 Apr 2011 11:17:00 +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 7108B8FC17; Sat, 30 Apr 2011 11:17:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3UBH0JS043239; Sat, 30 Apr 2011 11:17:00 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3UBH0Au043235; Sat, 30 Apr 2011 11:17:00 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201104301117.p3UBH0Au043235@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 30 Apr 2011 11:17:00 +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: r221248 - in head/sys: conf netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2011 11:17:00 -0000 Author: bz Date: Sat Apr 30 11:17:00 2011 New Revision: 221248 URL: http://svn.freebsd.org/changeset/base/221248 Log: Make the UDP code compile without INET. Expose udp_usrreq.c to IPv6 only as well compiling out most functions adding or extending #ifdef INET coverage. Reviewed by: gnn Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 4 days Modified: head/sys/conf/files head/sys/netinet/udp_usrreq.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Apr 30 11:04:34 2011 (r221247) +++ head/sys/conf/files Sat Apr 30 11:17:00 2011 (r221248) @@ -2770,7 +2770,7 @@ netinet/tcp_syncache.c optional inet netinet/tcp_timer.c optional inet netinet/tcp_timewait.c optional inet netinet/tcp_usrreq.c optional inet -netinet/udp_usrreq.c optional inet +netinet/udp_usrreq.c optional inet | inet6 netinet/libalias/alias.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_db.c optional libalias inet | netgraph_nat inet netinet/libalias/alias_mod.c optional libalias | netgraph_nat Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Sat Apr 30 11:04:34 2011 (r221247) +++ head/sys/netinet/udp_usrreq.c Sat Apr 30 11:17:00 2011 (r221248) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ipfw.h" +#include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" @@ -143,9 +144,12 @@ SYSCTL_VNET_STRUCT(_net_inet_udp, UDPCTL &VNET_NAME(udpstat), udpstat, "UDP statistics (struct udpstat, netinet/udp_var.h)"); +#ifdef INET static void udp_detach(struct socket *so); static int udp_output(struct inpcb *, struct mbuf *, struct sockaddr *, struct mbuf *, struct thread *); +#endif + #ifdef IPSEC #ifdef IPSEC_NAT_T #define UF_ESPINUDP_ALL (UF_ESPINUDP_NON_IKE|UF_ESPINUDP) @@ -229,6 +233,7 @@ udp_destroy(void) } #endif +#ifdef INET /* * Subroutine of udp_input(), which appends the provided mbuf chain to the * passed pcb/socket. The caller must provide a sockaddr_in via udp_in that @@ -272,7 +277,6 @@ udp_append(struct inpcb *inp, struct ip return; } #ifdef IPSEC_NAT_T -#ifdef INET up = intoudpcb(inp); KASSERT(up != NULL, ("%s: udpcb NULL", __func__)); if (up->u_flags & UF_ESPINUDP_ALL) { /* IPSec UDP encaps. */ @@ -280,7 +284,6 @@ udp_append(struct inpcb *inp, struct ip if (n == NULL) /* Consumed. */ return; } -#endif /* INET */ #endif /* IPSEC_NAT_T */ #endif /* IPSEC */ #ifdef MAC @@ -288,14 +291,14 @@ udp_append(struct inpcb *inp, struct ip m_freem(n); return; } -#endif +#endif /* MAC */ if (inp->inp_flags & INP_CONTROLOPTS || inp->inp_socket->so_options & (SO_TIMESTAMP | SO_BINTIME)) { #ifdef INET6 if (inp->inp_vflag & INP_IPV6) (void)ip6_savecontrol_v4(inp, n, &opts, NULL); else -#endif +#endif /* INET6 */ ip_savecontrol(inp, &opts, ip, n); } #ifdef INET6 @@ -306,7 +309,7 @@ udp_append(struct inpcb *inp, struct ip in6_sin_2_v4mapsin6(udp_in, &udp_in6); append_sa = (struct sockaddr *)&udp_in6; } else -#endif +#endif /* INET6 */ append_sa = (struct sockaddr *)udp_in; m_adj(n, off); @@ -598,6 +601,7 @@ badheadlocked: badunlocked: m_freem(m); } +#endif /* INET */ /* * Notify a udp user of an asynchronous error; just wake up so that they can @@ -621,6 +625,7 @@ udp_notify(struct inpcb *inp, int errno) return (inp); } +#ifdef INET void udp_ctlinput(int cmd, struct sockaddr *sa, void *vip) { @@ -666,6 +671,7 @@ udp_ctlinput(int cmd, struct sockaddr *s in_pcbnotifyall(&V_udbinfo, faddr, inetctlerrmap[cmd], udp_notify); } +#endif /* INET */ static int udp_pcblist(SYSCTL_HANDLER_ARGS) @@ -778,6 +784,7 @@ SYSCTL_PROC(_net_inet_udp, UDPCTL_PCBLIS CTLTYPE_OPAQUE | CTLFLAG_RD, NULL, 0, udp_pcblist, "S,xinpcb", "List of active UDP sockets"); +#ifdef INET static int udp_getcred(SYSCTL_HANDLER_ARGS) { @@ -817,6 +824,7 @@ udp_getcred(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_net_inet_udp, OID_AUTO, getcred, CTLTYPE_OPAQUE|CTLFLAG_RW|CTLFLAG_PRISON, 0, 0, udp_getcred, "S,xucred", "Get the xucred of a UDP connection"); +#endif /* INET */ int udp_ctloutput(struct socket *so, struct sockopt *sopt) @@ -835,11 +843,15 @@ udp_ctloutput(struct socket *so, struct if (INP_CHECK_SOCKAF(so, AF_INET6)) { INP_WUNLOCK(inp); error = ip6_ctloutput(so, sopt); - } else { + } +#endif +#if defined(INET) && defined(INET6) + else #endif +#ifdef INET + { INP_WUNLOCK(inp); error = ip_ctloutput(so, sopt); -#ifdef INET6 } #endif return (error); @@ -911,6 +923,7 @@ udp_ctloutput(struct socket *so, struct return (error); } +#ifdef INET static int udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *td) @@ -1223,7 +1236,6 @@ release: #if defined(IPSEC) && defined(IPSEC_NAT_T) -#ifdef INET /* * Potentially decap ESP in UDP frame. Check for an ESP header * and optional marker; if present, strip the UDP header and @@ -1355,7 +1367,6 @@ udp4_espdecap(struct inpcb *inp, struct (void) ipsec4_common_input(m, iphlen, ip->ip_p); return (NULL); /* NB: consumed, bypass processing. */ } -#endif /* INET */ #endif /* defined(IPSEC) && defined(IPSEC_NAT_T) */ static void @@ -1410,6 +1421,7 @@ udp_attach(struct socket *so, int proto, INP_INFO_WUNLOCK(&V_udbinfo); return (0); } +#endif /* INET */ int udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f) @@ -1432,6 +1444,7 @@ udp_set_kernel_tunneling(struct socket * return (0); } +#ifdef INET static int udp_bind(struct socket *so, struct sockaddr *nam, struct thread *td) { @@ -1553,6 +1566,7 @@ udp_send(struct socket *so, int flags, s KASSERT(inp != NULL, ("udp_send: inp == NULL")); return (udp_output(inp, m, addr, control, td)); } +#endif /* INET */ int udp_shutdown(struct socket *so) @@ -1567,6 +1581,7 @@ udp_shutdown(struct socket *so) return (0); } +#ifdef INET struct pr_usrreqs udp_usrreqs = { .pru_abort = udp_abort, .pru_attach = udp_attach, @@ -1584,3 +1599,4 @@ struct pr_usrreqs udp_usrreqs = { .pru_sosetlabel = in_pcbsosetlabel, .pru_close = udp_close, }; +#endif /* INET */ Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Sat Apr 30 11:04:34 2011 (r221247) +++ head/sys/netinet6/udp6_usrreq.c Sat Apr 30 11:17:00 2011 (r221248) @@ -849,6 +849,7 @@ udp6_bind(struct socket *so, struct sock if (IN6_IS_ADDR_UNSPECIFIED(&sin6_p->sin6_addr)) inp->inp_vflag |= INP_IPV4; +#ifdef INET else if (IN6_IS_ADDR_V4MAPPED(&sin6_p->sin6_addr)) { struct sockaddr_in sin; @@ -859,10 +860,13 @@ udp6_bind(struct socket *so, struct sock td->td_ucred); goto out; } +#endif } error = in6_pcbbind(inp, nam, td->td_ucred); +#ifdef INET out: +#endif INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_udbinfo); return (error); @@ -909,6 +913,7 @@ udp6_connect(struct socket *so, struct s INP_INFO_WLOCK(&V_udbinfo); INP_WLOCK(inp); +#ifdef INET if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { struct sockaddr_in sin; @@ -932,6 +937,7 @@ udp6_connect(struct socket *so, struct s soisconnected(so); goto out; } +#endif if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { error = EISCONN; goto out;