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)
This commit is contained in:
parent
9517e86625
commit
e7fba5c772
@ -2,6 +2,8 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
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 <bsd.prog.mk>
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ priv_netinet_ipsec_policy_bypass_setup_af(int asroot, int injail,
|
||||
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_af(int asroot, int injail,
|
||||
return (-1);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
warnx("%s: unexpected address family", __func__);
|
||||
return (-1);
|
||||
@ -92,6 +94,7 @@ priv_netinet_ipsec_policy4_bypass_setup(int asroot, int injail,
|
||||
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(int asroot, int injail,
|
||||
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_af(int asroot, int injail,
|
||||
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_af(int asroot, int injail,
|
||||
return (-1);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
warnx("%s: unexpected address family", __func__);
|
||||
return (-1);
|
||||
@ -144,6 +149,7 @@ priv_netinet_ipsec_policy4_entrust_setup(int asroot, int injail,
|
||||
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(int asroot, int injail,
|
||||
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 asroot, int injail, struct test *test,
|
||||
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 asroot, int injail, struct test *test)
|
||||
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 asroot, int injail, struct test *test,
|
||||
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 asroot, int injail, struct test *test)
|
||||
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,
|
||||
|
@ -80,7 +80,7 @@ priv_vfs_extattr_system(int asroot, int injail, struct test *test)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user