From owner-svn-src-head@FreeBSD.ORG Thu Aug 13 09:11:48 2009 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 3A6001065675; Thu, 13 Aug 2009 09:11:48 +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 295128FC3F; Thu, 13 Aug 2009 09:11:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7D9BmFT094790; Thu, 13 Aug 2009 09:11:48 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7D9BmsI094785; Thu, 13 Aug 2009 09:11:48 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908130911.n7D9BmsI094785@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 13 Aug 2009 09:11:48 +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: r196172 - head/tools/regression/priv 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: Thu, 13 Aug 2009 09:11:48 -0000 Author: bz Date: Thu Aug 13 09:11:47 2009 New Revision: 196172 URL: http://svn.freebsd.org/changeset/base/196172 Log: Start respecting WITHOUT_INET6. Make regression/priv compile again after the multi-IP jail changes. Note that we are still using the legacy jail(2) rather than the jail_set(2)/jail(3) syscall. Add an IPv4, and an IPv6 loopback address in case we compile with INET6 enabled. Make the priv_vfs_extattr_system compile on amd64 as well using the proper length modifier to printf(3) for ssize_t. Reviewed by: rwatson Approved by: re (kib) Modified: head/tools/regression/priv/Makefile head/tools/regression/priv/main.c head/tools/regression/priv/priv_netinet_ipsec.c head/tools/regression/priv/priv_vfs_extattr_system.c Modified: head/tools/regression/priv/Makefile ============================================================================== --- head/tools/regression/priv/Makefile Thu Aug 13 08:31:15 2009 (r196171) +++ head/tools/regression/priv/Makefile Thu Aug 13 09:11:47 2009 (r196172) @@ -2,6 +2,8 @@ # $FreeBSD$ # +.include + PROG= priv SRCS= main.c \ priv_acct.c \ @@ -49,4 +51,8 @@ WARNS= 3 DPADD+= ${LIBIPSEC} LDADD+= -lipsec +.if ${MK_INET6_SUPPORT} != "no" +CFLAGS+= -DINET6 +.endif + .include Modified: head/tools/regression/priv/main.c ============================================================================== --- head/tools/regression/priv/main.c Thu Aug 13 08:31:15 2009 (r196171) +++ head/tools/regression/priv/main.c Thu Aug 13 09:11:47 2009 (r196172) @@ -142,20 +142,24 @@ static struct test tests[] = { priv_netinet_ipsec_policy4_bypass, priv_netinet_ipsec_policy_bypass_cleanup }, +#ifdef INET6 { "priv_netinet_ipsec_policy6_bypass", priv_netinet_ipsec_policy6_bypass_setup, priv_netinet_ipsec_policy6_bypass, priv_netinet_ipsec_policy_bypass_cleanup }, +#endif { "priv_netinet_ipsec_policy4_entrust", priv_netinet_ipsec_policy4_entrust_setup, priv_netinet_ipsec_policy4_entrust, priv_netinet_ipsec_policy_entrust_cleanup }, +#ifdef INET6 { "priv_netinet_ipsec_policy6_entrust", priv_netinet_ipsec_policy6_entrust_setup, priv_netinet_ipsec_policy6_entrust, priv_netinet_ipsec_policy_entrust_cleanup }, +#endif { "priv_netinet_raw", priv_netinet_raw_setup, priv_netinet_raw, priv_netinet_raw_cleanup }, @@ -420,12 +424,23 @@ static void enter_jail(const char *test) { struct jail j; + struct in_addr ia4; +#ifdef INET6 + struct in6_addr ia6 = IN6ADDR_LOOPBACK_INIT; +#endif bzero(&j, sizeof(j)); - j.version = 0; + j.version = JAIL_API_VERSION; j.path = "/"; j.hostname = "test"; - j.ip_number = htonl(INADDR_LOOPBACK); + j.jailname = "regressions/priv"; + ia4.s_addr = htonl(INADDR_LOOPBACK); + j.ip4s = 1; + j.ip4 = &ia4; +#ifdef INET6 + j.ip6s = 1; + j.ip6 = &ia6; +#endif if (jail(&j) < 0) err(-1, "test %s: jail", test); } Modified: head/tools/regression/priv/priv_netinet_ipsec.c ============================================================================== --- head/tools/regression/priv/priv_netinet_ipsec.c Thu Aug 13 08:31:15 2009 (r196171) +++ head/tools/regression/priv/priv_netinet_ipsec.c Thu Aug 13 09:11:47 2009 (r196172) @@ -69,6 +69,7 @@ priv_netinet_ipsec_policy_bypass_setup_a return (-1); } break; +#ifdef INET6 case AF_INET6: sd = socket(AF_INET6, SOCK_DGRAM, 0); if (sd < 0) { @@ -76,6 +77,7 @@ priv_netinet_ipsec_policy_bypass_setup_a return (-1); } break; +#endif default: warnx("%s: unexpected address family", __func__); return (-1); @@ -92,6 +94,7 @@ priv_netinet_ipsec_policy4_bypass_setup( AF_INET)); } +#ifdef INET6 int priv_netinet_ipsec_policy6_bypass_setup(int asroot, int injail, struct test *test) @@ -100,7 +103,7 @@ priv_netinet_ipsec_policy6_bypass_setup( return (priv_netinet_ipsec_policy_bypass_setup_af(asroot, injail, test, AF_INET6)); } - +#endif static int @@ -121,6 +124,7 @@ priv_netinet_ipsec_policy_entrust_setup_ return (-1); } break; +#ifdef INET6 case AF_INET6: sd = socket(AF_INET6, SOCK_DGRAM, 0); if (sd < 0) { @@ -128,6 +132,7 @@ priv_netinet_ipsec_policy_entrust_setup_ return (-1); } break; +#endif default: warnx("%s: unexpected address family", __func__); return (-1); @@ -144,6 +149,7 @@ priv_netinet_ipsec_policy4_entrust_setup AF_INET)); } +#ifdef INET6 int priv_netinet_ipsec_policy6_entrust_setup(int asroot, int injail, struct test *test) @@ -152,7 +158,7 @@ priv_netinet_ipsec_policy6_entrust_setup return (priv_netinet_ipsec_policy_entrust_setup_af(asroot, injail, test, AF_INET6)); } - +#endif void priv_netinet_ipsec_pfkey(int asroot, int injail, struct test *test) @@ -196,10 +202,12 @@ priv_netinet_ipsec_policy_bypass_af(int level = IPPROTO_IP; optname = IP_IPSEC_POLICY; break; +#ifdef INET6 case AF_INET6: level = IPPROTO_IPV6; optname = IPV6_IPSEC_POLICY; break; +#endif default: warnx("%s: unexpected address family", __func__); return; @@ -227,13 +235,14 @@ priv_netinet_ipsec_policy4_bypass(int as priv_netinet_ipsec_policy_bypass_af(asroot, injail, test, AF_INET); } +#ifdef INET6 void priv_netinet_ipsec_policy6_bypass(int asroot, int injail, struct test *test) { priv_netinet_ipsec_policy_bypass_af(asroot, injail, test, AF_INET6); } - +#endif static void priv_netinet_ipsec_policy_entrust_af(int asroot, int injail, struct test *test, @@ -246,10 +255,12 @@ priv_netinet_ipsec_policy_entrust_af(int level = IPPROTO_IP; optname = IP_IPSEC_POLICY; break; +#ifdef INET6 case AF_INET6: level = IPPROTO_IPV6; optname = IPV6_IPSEC_POLICY; break; +#endif default: warnx("%s: unexpected address family", __func__); return; @@ -277,13 +288,14 @@ priv_netinet_ipsec_policy4_entrust(int a priv_netinet_ipsec_policy_entrust_af(asroot, injail, test, AF_INET); } +#ifdef INET6 void priv_netinet_ipsec_policy6_entrust(int asroot, int injail, struct test *test) { priv_netinet_ipsec_policy_entrust_af(asroot, injail, test, AF_INET6); } - +#endif void priv_netinet_ipsec_policy_bypass_cleanup(int asroot, int injail, Modified: head/tools/regression/priv/priv_vfs_extattr_system.c ============================================================================== --- head/tools/regression/priv/priv_vfs_extattr_system.c Thu Aug 13 08:31:15 2009 (r196171) +++ head/tools/regression/priv/priv_vfs_extattr_system.c Thu Aug 13 09:11:47 2009 (r196172) @@ -80,7 +80,7 @@ priv_vfs_extattr_system(int asroot, int else if (ret == EA_SIZE) error = 0; else - err(-1, "priv_vfs_extattr_system: set returned %d", ret); + err(-1, "priv_vfs_extattr_system: set returned %zd", ret); if (asroot && injail) expect("priv_vfs_extattr_system(asroot, injail)", error, -1, EPERM);