Date: Sat, 30 Apr 2011 11:04:35 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r221247 - in head/sys: netinet netinet6 Message-ID: <201104301104.p3UB4ZuC042830@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Sat Apr 30 11:04:34 2011 New Revision: 221247 URL: http://svn.freebsd.org/changeset/base/221247 Log: Make the PCB code compile without INET support by adding #ifdef INETs and correcting few #includes. Reviewed by: gnn Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 4 days Modified: head/sys/netinet/in_pcb.c head/sys/netinet6/in6_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Sat Apr 30 10:59:55 2011 (r221246) +++ head/sys/netinet/in_pcb.c Sat Apr 30 11:04:34 2011 (r221247) @@ -65,17 +65,22 @@ __FBSDID("$FreeBSD$"); #include <net/route.h> #include <net/vnet.h> +#if defined(INET) || defined(INET6) #include <netinet/in.h> #include <netinet/in_pcb.h> -#include <netinet/in_var.h> #include <netinet/ip_var.h> #include <netinet/tcp_var.h> #include <netinet/udp.h> #include <netinet/udp_var.h> +#endif +#ifdef INET +#include <netinet/in_var.h> +#endif #ifdef INET6 #include <netinet/ip6.h> -#include <netinet6/ip6_var.h> #include <netinet6/in6_pcb.h> +#include <netinet6/in6_var.h> +#include <netinet6/ip6_var.h> #endif /* INET6 */ @@ -117,12 +122,13 @@ static VNET_DEFINE(int, ipport_tcplastco #define V_ipport_tcplastcount VNET(ipport_tcplastcount) +static void in_pcbremlists(struct inpcb *inp); + +#ifdef INET #define RANGECHK(var, min, max) \ if ((var) < (min)) { (var) = (min); } \ else if ((var) > (max)) { (var) = (max); } -static void in_pcbremlists(struct inpcb *inp); - static int sysctl_net_ipport_check(SYSCTL_HANDLER_ARGS) { @@ -179,6 +185,7 @@ SYSCTL_VNET_INT(_net_inet_ip_portrange, &VNET_NAME(ipport_randomtime), 0, "Minimum time to keep sequental port " "allocation before switching to a random one"); +#endif /* * in_pcb.c: manage the Protocol Control Blocks. @@ -291,6 +298,7 @@ out: return (error); } +#ifdef INET int in_pcbbind(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred) { @@ -316,6 +324,7 @@ in_pcbbind(struct inpcb *inp, struct soc inp->inp_flags |= INP_ANONPORT; return (0); } +#endif #if defined(INET) || defined(INET6) int @@ -396,6 +405,7 @@ in_pcb_lport(struct inpcb *inp, struct i laddr = *laddrp; } #endif + tmpinp = NULL; /* Make compiler happy. */ lport = *lportp; if (dorandom) @@ -435,6 +445,7 @@ in_pcb_lport(struct inpcb *inp, struct i } #endif /* INET || INET6 */ +#ifdef INET /* * Set up a bind operation on a PCB, performing port allocation * as required, but do not actually modify the PCB. Callers can @@ -998,6 +1009,7 @@ in_pcbdisconnect(struct inpcb *inp) inp->inp_fport = 0; in_pcbrehash(inp); } +#endif /* * in_pcbdetach() is responsibe for disassociating a socket from an inpcb. @@ -1046,8 +1058,10 @@ in_pcbfree_internal(struct inpcb *inp) #endif if (inp->inp_options) (void)m_free(inp->inp_options); +#ifdef INET if (inp->inp_moptions != NULL) inp_freemoptions(inp->inp_moptions); +#endif inp->inp_vflag = 0; crfree(inp->inp_cred); @@ -1164,6 +1178,7 @@ in_pcbdrop(struct inpcb *inp) } } +#ifdef INET /* * Common routines to return the socket addresses associated with inpcbs. */ @@ -1527,6 +1542,7 @@ in_pcblookup_hash(struct inpcbinfo *pcbi return (NULL); } +#endif /* INET */ /* * Insert PCB onto various hash lists. Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Sat Apr 30 10:59:55 2011 (r221246) +++ head/sys/netinet6/in6_pcb.c Sat Apr 30 11:04:34 2011 (r221247) @@ -204,6 +204,7 @@ in6_pcbbind(register struct inpcb *inp, == 0) && (inp->inp_cred->cr_uid != t->inp_cred->cr_uid)) return (EADDRINUSE); +#ifdef INET if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0 && IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { struct sockaddr_in sin; @@ -222,6 +223,7 @@ in6_pcbbind(register struct inpcb *inp, t->inp_cred->cr_uid)) return (EADDRINUSE); } +#endif } t = in6_pcblookup_local(pcbinfo, &sin6->sin6_addr, lport, wild, cred); @@ -229,6 +231,7 @@ in6_pcbbind(register struct inpcb *inp, intotw(t)->tw_so_options : t->inp_socket->so_options)) == 0) return (EADDRINUSE); +#ifdef INET if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0 && IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { struct sockaddr_in sin; @@ -252,6 +255,7 @@ in6_pcbbind(register struct inpcb *inp, INP_SOCKAF(t->inp_socket))) return (EADDRINUSE); } +#endif } inp->in6p_laddr = sin6->sin6_addr; } @@ -496,11 +500,14 @@ in6_mapped_sockaddr(struct socket *so, s inp = sotoinpcb(so); KASSERT(inp != NULL, ("in6_mapped_sockaddr: inp == NULL")); +#ifdef INET if ((inp->inp_vflag & (INP_IPV4 | INP_IPV6)) == INP_IPV4) { error = in_getsockaddr(so, nam); if (error == 0) in6_sin_2_v4mapsin6_in_sock(nam); - } else { + } else +#endif + { /* scope issues will be handled in in6_getsockaddr(). */ error = in6_getsockaddr(so, nam); } @@ -517,11 +524,13 @@ in6_mapped_peeraddr(struct socket *so, s inp = sotoinpcb(so); KASSERT(inp != NULL, ("in6_mapped_peeraddr: inp == NULL")); +#ifdef INET if ((inp->inp_vflag & (INP_IPV4 | INP_IPV6)) == INP_IPV4) { error = in_getpeeraddr(so, nam); if (error == 0) in6_sin_2_v4mapsin6_in_sock(nam); } else +#endif /* scope issues will be handled in in6_getpeeraddr(). */ error = in6_getpeeraddr(so, nam);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104301104.p3UB4ZuC042830>