1139825Simp/*-
2191668Sjamie * Copyright (c) 1999 Poul-Henning Kamp.
3191673Sjamie * Copyright (c) 2009 James Gritton.
4191668Sjamie * All rights reserved.
546155Sphk *
6191668Sjamie * Redistribution and use in source and binary forms, with or without
7191668Sjamie * modification, are permitted provided that the following conditions
8191668Sjamie * are met:
9191668Sjamie * 1. Redistributions of source code must retain the above copyright
10191668Sjamie *    notice, this list of conditions and the following disclaimer.
11191668Sjamie * 2. Redistributions in binary form must reproduce the above copyright
12191668Sjamie *    notice, this list of conditions and the following disclaimer in the
13191668Sjamie *    documentation and/or other materials provided with the distribution.
14191668Sjamie *
15191668Sjamie * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16191668Sjamie * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17191668Sjamie * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18191668Sjamie * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19191668Sjamie * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20191668Sjamie * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21191668Sjamie * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22191668Sjamie * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23191668Sjamie * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24191668Sjamie * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25191668Sjamie * SUCH DAMAGE.
26191668Sjamie *
2750477Speter * $FreeBSD$
2846155Sphk */
2946155Sphk
3046155Sphk#ifndef _SYS_JAIL_H_
3146155Sphk#define _SYS_JAIL_H_
3246155Sphk
33185435Sbz#ifdef _KERNEL
34185435Sbzstruct jail_v0 {
3551398Sphk	u_int32_t	version;
3651398Sphk	char		*path;
3751398Sphk	char		*hostname;
3851398Sphk	u_int32_t	ip_number;
3946155Sphk};
40185435Sbz#endif
4146155Sphk
42185435Sbzstruct jail {
43185435Sbz	uint32_t	version;
44185435Sbz	char		*path;
45185435Sbz	char		*hostname;
46185435Sbz	char		*jailname;
47185435Sbz	uint32_t	ip4s;
48185435Sbz	uint32_t	ip6s;
49185435Sbz	struct in_addr	*ip4;
50185435Sbz	struct in6_addr	*ip6;
51185435Sbz};
52190466Sjamie#define	JAIL_API_VERSION	2
53185435Sbz
54185435Sbz/*
55185435Sbz * For all xprison structs, always keep the pr_version an int and
56185435Sbz * the first variable so userspace can easily distinguish them.
57185435Sbz */
58185435Sbz#ifndef _KERNEL
59185435Sbzstruct xprison_v1 {
60185435Sbz	int		 pr_version;
61185435Sbz	int		 pr_id;
62185435Sbz	char		 pr_path[MAXPATHLEN];
63185435Sbz	char		 pr_host[MAXHOSTNAMELEN];
64185435Sbz	u_int32_t	 pr_ip;
65185435Sbz};
66185435Sbz#endif
67185435Sbz
68113275Smikestruct xprison {
69113275Smike	int		 pr_version;
70113275Smike	int		 pr_id;
71185435Sbz	int		 pr_state;
72185435Sbz	cpusetid_t	 pr_cpusetid;
73113275Smike	char		 pr_path[MAXPATHLEN];
74190466Sjamie	char		 pr_host[MAXHOSTNAMELEN];
75190466Sjamie	char		 pr_name[MAXHOSTNAMELEN];
76185435Sbz	uint32_t	 pr_ip4s;
77185435Sbz	uint32_t	 pr_ip6s;
78185435Sbz#if 0
79185435Sbz	/*
80185435Sbz	 * sizeof(xprison) will be malloced + size needed for all
81185435Sbz	 * IPv4 and IPv6 addesses. Offsets are based numbers of addresses.
82185435Sbz	 */
83185435Sbz	struct in_addr	 pr_ip4[];
84185435Sbz	struct in6_addr	 pr_ip6[];
85185435Sbz#endif
86113275Smike};
87192896Sjamie#define	XPRISON_VERSION		3
88113275Smike
89192896Sjamie#define	PRISON_STATE_INVALID	0
90192896Sjamie#define	PRISON_STATE_ALIVE	1
91192896Sjamie#define	PRISON_STATE_DYING	2
92185435Sbz
93191673Sjamie/*
94191673Sjamie * Flags for jail_set and jail_get.
95191673Sjamie */
96191673Sjamie#define	JAIL_CREATE	0x01	/* Create jail if it doesn't exist */
97191673Sjamie#define	JAIL_UPDATE	0x02	/* Update parameters of existing jail */
98191673Sjamie#define	JAIL_ATTACH	0x04	/* Attach to jail upon creation */
99191673Sjamie#define	JAIL_DYING	0x08	/* Allow getting a dying jail */
100191673Sjamie#define	JAIL_SET_MASK	0x0f
101191673Sjamie#define	JAIL_GET_MASK	0x08
102185435Sbz
103195870Sjamie#define	JAIL_SYS_DISABLE	0
104195870Sjamie#define	JAIL_SYS_NEW		1
105195870Sjamie#define	JAIL_SYS_INHERIT	2
106195870Sjamie
10755205Speter#ifndef _KERNEL
10846155Sphk
109191673Sjamiestruct iovec;
110191673Sjamie
11192719Salfredint jail(struct jail *);
112191673Sjamieint jail_set(struct iovec *, unsigned int, int);
113191673Sjamieint jail_get(struct iovec *, unsigned int, int);
114113275Smikeint jail_attach(int);
115191673Sjamieint jail_remove(int);
11647249Sphk
11755205Speter#else /* _KERNEL */
11847249Sphk
11996090Sbde#include <sys/queue.h>
120191673Sjamie#include <sys/sysctl.h>
121192895Sjamie#include <sys/lock.h>
122192895Sjamie#include <sys/mutex.h>
123124882Srwatson#include <sys/_task.h>
12487275Srwatson
125179881Sdelphij#define JAIL_MAX	999999
126179881Sdelphij
12746155Sphk#ifdef MALLOC_DECLARE
12846155SphkMALLOC_DECLARE(M_PRISON);
12946155Sphk#endif
130143869Spjd#endif /* _KERNEL */
13146155Sphk
132185029Spjd#if defined(_KERNEL) || defined(_WANT_PRISON)
133185029Spjd
134185029Spjd#include <sys/osd.h>
135185029Spjd
136193066Sjamie#define	HOSTUUIDLEN	64
137280632Sian#define	OSRELEASELEN	32
138193066Sjamie
139220137Straszstruct racct;
140221362Straszstruct prison_racct;
141220137Strasz
14246155Sphk/*
14347249Sphk * This structure describes a prison.  It is pointed to by all struct
14472786Srwatson * ucreds's of the inmates.  pr_ref keeps track of them and is used to
14546155Sphk * delete the struture when the last inmate is dead.
14672786Srwatson *
14787275Srwatson * Lock key:
148168401Spjd *   (a) allprison_lock
149138045Spjd *   (p) locked by pr_mtx
15087275Srwatson *   (c) set only during creation before the structure is shared, no mutex
15187275Srwatson *       required to read
15246155Sphk */
15346155Sphkstruct prison {
154191673Sjamie	TAILQ_ENTRY(prison) pr_list;			/* (a) all prisons */
155113275Smike	int		 pr_id;				/* (c) prison id */
15687275Srwatson	int		 pr_ref;			/* (p) refcount */
157191673Sjamie	int		 pr_uref;			/* (p) user (alive) refcount */
158191673Sjamie	unsigned	 pr_flags;			/* (p) PR_* flags */
159194842Sjamie	LIST_HEAD(, prison) pr_children;		/* (a) list of child jails */
160194842Sjamie	LIST_ENTRY(prison) pr_sibling;			/* (a) next in parent's list */
161192895Sjamie	struct prison	*pr_parent;			/* (c) containing jail */
162194842Sjamie	struct mtx	 pr_mtx;
163298833Sjamie	struct task	 pr_task;			/* (c) destroy task */
164185029Spjd	struct osd	 pr_osd;			/* (p) additional data */
165194842Sjamie	struct cpuset	*pr_cpuset;			/* (p) cpuset */
166194842Sjamie	struct vnet	*pr_vnet;			/* (c) network stack */
167194842Sjamie	struct vnode	*pr_root;			/* (c) vnode to rdir */
168191673Sjamie	int		 pr_ip4s;			/* (p) number of v4 IPs */
169194842Sjamie	int		 pr_ip6s;			/* (p) number of v6 IPs */
170191673Sjamie	struct in_addr	*pr_ip4;			/* (p) v4 IPs of jail */
171191673Sjamie	struct in6_addr	*pr_ip6;			/* (p) v6 IPs of jail */
172221362Strasz	struct prison_racct *pr_prison_racct;		/* (c) racct jail proxy */
173220137Strasz	void		*pr_sparep[3];
174194762Sjamie	int		 pr_childcount;			/* (a) number of child jails */
175194842Sjamie	int		 pr_childmax;			/* (p) maximum child jails */
176192895Sjamie	unsigned	 pr_allow;			/* (p) PR_ALLOW_* flags */
177194842Sjamie	int		 pr_securelevel;		/* (p) securelevel */
178192895Sjamie	int		 pr_enforce_statfs;		/* (p) statfs permission */
179231267Smm	int		 pr_devfs_rsnum;		/* (p) devfs ruleset */
180280632Sian	int		 pr_spare[3];
181280632Sian	int		 pr_osreldate;			/* (c) kern.osreldate value */
182194842Sjamie	unsigned long	 pr_hostid;			/* (p) jail hostid */
183194842Sjamie	char		 pr_name[MAXHOSTNAMELEN];	/* (p) admin jail name */
184194842Sjamie	char		 pr_path[MAXPATHLEN];		/* (c) chroot path */
185194842Sjamie	char		 pr_hostname[MAXHOSTNAMELEN];	/* (p) jail hostname */
186194118Sjamie	char		 pr_domainname[MAXHOSTNAMELEN];	/* (p) jail domainname */
187194118Sjamie	char		 pr_hostuuid[HOSTUUIDLEN];	/* (p) jail hostuuid */
188280632Sian	char		 pr_osrelease[OSRELEASELEN];	/* (c) kern.osrelease value */
18946155Sphk};
190221362Strasz
191221362Straszstruct prison_racct {
192221362Strasz	LIST_ENTRY(prison_racct) prr_next;
193221362Strasz	char		prr_name[MAXHOSTNAMELEN];
194221362Strasz	u_int		prr_refcount;
195221362Strasz	struct racct	*prr_racct;
196221362Strasz};
197143869Spjd#endif /* _KERNEL || _WANT_PRISON */
19846155Sphk
199143869Spjd#ifdef _KERNEL
200192895Sjamie/* Flag bits set via options */
201191673Sjamie#define	PR_PERSIST	0x00000001	/* Can exist without processes */
202193066Sjamie#define	PR_HOST		0x00000002	/* Virtualize hostname et al */
203195870Sjamie#define	PR_IP4_USER	0x00000004	/* Restrict IPv4 addresses */
204195870Sjamie#define	PR_IP6_USER	0x00000008	/* Restrict IPv6 addresses */
205194251Sjamie#define	PR_VNET		0x00000010	/* Virtual network stack */
206195870Sjamie#define	PR_IP4_DISABLE	0x00000020	/* Disable IPv4 */
207195870Sjamie#define	PR_IP6_DISABLE	0x00000040	/* Disable IPv6 */
208202468Sbz#define	PR_IP4_SADDRSEL	0x00000080	/* Do IPv4 src addr sel. or use the */
209202468Sbz					/* primary jail address. */
210202468Sbz#define	PR_IP6_SADDRSEL	0x00000100	/* Do IPv6 src addr sel. or use the */
211202468Sbz					/* primary jail address. */
212192895Sjamie
213192895Sjamie/* Internal flag bits */
214195870Sjamie#define	PR_IP4		0x02000000	/* IPv4 restricted or disabled */
215195870Sjamie					/* by this jail or an ancestor */
216195870Sjamie#define	PR_IP6		0x04000000	/* IPv6 restricted or disabled */
217195870Sjamie					/* by this jail or an ancestor */
218191673Sjamie
219192895Sjamie/* Flags for pr_allow */
220192895Sjamie#define	PR_ALLOW_SET_HOSTNAME		0x0001
221192895Sjamie#define	PR_ALLOW_SYSVIPC		0x0002
222192895Sjamie#define	PR_ALLOW_RAW_SOCKETS		0x0004
223192895Sjamie#define	PR_ALLOW_CHFLAGS		0x0008
224192895Sjamie#define	PR_ALLOW_MOUNT			0x0010
225192895Sjamie#define	PR_ALLOW_QUOTAS			0x0020
226194762Sjamie#define	PR_ALLOW_SOCKET_AF		0x0040
227232059Smm#define	PR_ALLOW_MOUNT_DEVFS		0x0080
228232059Smm#define	PR_ALLOW_MOUNT_NULLFS		0x0100
229232186Smm#define	PR_ALLOW_MOUNT_ZFS		0x0200
230232278Smm#define	PR_ALLOW_MOUNT_PROCFS		0x0400
231254741Sdelphij#define	PR_ALLOW_MOUNT_TMPFS		0x0800
232277985Sjamie#define	PR_ALLOW_MOUNT_FDESCFS		0x1000
233295951Saraujo#define	PR_ALLOW_MOUNT_LINPROCFS	0x2000
234295951Saraujo#define	PR_ALLOW_MOUNT_LINSYSFS		0x4000
235295951Saraujo#define	PR_ALLOW_ALL			0x7fff
236192895Sjamie
237191673Sjamie/*
238191673Sjamie * OSD methods
239191673Sjamie */
240191673Sjamie#define	PR_METHOD_CREATE	0
241191673Sjamie#define	PR_METHOD_GET		1
242191673Sjamie#define	PR_METHOD_SET		2
243191673Sjamie#define	PR_METHOD_CHECK		3
244191673Sjamie#define	PR_METHOD_ATTACH	4
245298833Sjamie#define	PR_METHOD_REMOVE	5
246298833Sjamie#define	PR_MAXMETHOD		6
247191673Sjamie
248191673Sjamie/*
249192895Sjamie * Lock/unlock a prison.
250192895Sjamie * XXX These exist not so much for general convenience, but to be useable in
251192895Sjamie *     the FOREACH_PRISON_DESCENDANT_LOCKED macro which can't handle them in
252192895Sjamie *     non-function form as currently defined.
25357119Srwatson */
254192895Sjamiestatic __inline void
255192895Sjamieprison_lock(struct prison *pr)
256192895Sjamie{
25757119Srwatson
258192895Sjamie	mtx_lock(&pr->pr_mtx);
259192895Sjamie}
260192895Sjamie
261192895Sjamiestatic __inline void
262192895Sjamieprison_unlock(struct prison *pr)
263192895Sjamie{
264192895Sjamie
265192895Sjamie	mtx_unlock(&pr->pr_mtx);
266192895Sjamie}
267192895Sjamie
268192895Sjamie/* Traverse a prison's immediate children. */
269192895Sjamie#define	FOREACH_PRISON_CHILD(ppr, cpr)					\
270192895Sjamie	LIST_FOREACH(cpr, &(ppr)->pr_children, pr_sibling)
271192895Sjamie
272192895Sjamie/*
273192895Sjamie * Preorder traversal of all of a prison's descendants.
274192895Sjamie * This ugly loop allows the macro to be followed by a single block
275192895Sjamie * as expected in a looping primitive.
276192895Sjamie */
277192895Sjamie#define	FOREACH_PRISON_DESCENDANT(ppr, cpr, descend)			\
278192895Sjamie	for ((cpr) = (ppr), (descend) = 1;				\
279192895Sjamie	    ((cpr) = (((descend) && !LIST_EMPTY(&(cpr)->pr_children))	\
280192895Sjamie	      ? LIST_FIRST(&(cpr)->pr_children)				\
281192895Sjamie	      : ((cpr) == (ppr)						\
282192895Sjamie		 ? NULL							\
283192895Sjamie		 : (((descend) = LIST_NEXT(cpr, pr_sibling) != NULL)	\
284192895Sjamie		    ? LIST_NEXT(cpr, pr_sibling)			\
285192895Sjamie		    : (cpr)->pr_parent))));)				\
286192895Sjamie		if (!(descend))						\
287192895Sjamie			;						\
288192895Sjamie		else
289192895Sjamie
290192895Sjamie/*
291192895Sjamie * As above, but lock descendants on the way down and unlock on the way up.
292192895Sjamie */
293192895Sjamie#define	FOREACH_PRISON_DESCENDANT_LOCKED(ppr, cpr, descend)		\
294192895Sjamie	for ((cpr) = (ppr), (descend) = 1;				\
295192895Sjamie	    ((cpr) = (((descend) && !LIST_EMPTY(&(cpr)->pr_children))	\
296192895Sjamie	      ? LIST_FIRST(&(cpr)->pr_children)				\
297192895Sjamie	      : ((cpr) == (ppr)						\
298192895Sjamie		 ? NULL							\
299192895Sjamie		 : ((prison_unlock(cpr),				\
300192895Sjamie		    (descend) = LIST_NEXT(cpr, pr_sibling) != NULL)	\
301192895Sjamie		    ? LIST_NEXT(cpr, pr_sibling)			\
302192895Sjamie		    : (cpr)->pr_parent))));)				\
303192895Sjamie		if ((descend) ? (prison_lock(cpr), 0) : 1)		\
304192895Sjamie			;						\
305192895Sjamie		else
306192895Sjamie
307192895Sjamie/*
308194762Sjamie * As above, but also keep track of the level descended to.
309194762Sjamie */
310194762Sjamie#define	FOREACH_PRISON_DESCENDANT_LOCKED_LEVEL(ppr, cpr, descend, level)\
311194762Sjamie	for ((cpr) = (ppr), (descend) = 1, (level) = 0;			\
312194762Sjamie	    ((cpr) = (((descend) && !LIST_EMPTY(&(cpr)->pr_children))	\
313194762Sjamie	      ? (level++, LIST_FIRST(&(cpr)->pr_children))		\
314194762Sjamie	      : ((cpr) == (ppr)						\
315194762Sjamie		 ? NULL							\
316194762Sjamie		 : ((prison_unlock(cpr),				\
317194762Sjamie		    (descend) = LIST_NEXT(cpr, pr_sibling) != NULL)	\
318194762Sjamie		    ? LIST_NEXT(cpr, pr_sibling)			\
319194762Sjamie		    : (level--, (cpr)->pr_parent)))));)			\
320194762Sjamie		if ((descend) ? (prison_lock(cpr), 0) : 1)		\
321194762Sjamie			;						\
322194762Sjamie		else
323194762Sjamie
324194762Sjamie/*
325192895Sjamie * Attributes of the physical system, and the root of the jail tree.
326192895Sjamie */
327192895Sjamieextern struct	prison prison0;
328192895Sjamie
329191673SjamieTAILQ_HEAD(prisonlist, prison);
330113275Smikeextern struct	prisonlist allprison;
331168401Spjdextern struct	sx allprison_lock;
332113275Smike
33372786Srwatson/*
334191673Sjamie * Sysctls to describe jail parameters.
335191673Sjamie */
336191673SjamieSYSCTL_DECL(_security_jail_param);
337191673Sjamie
338191673Sjamie#define	SYSCTL_JAIL_PARAM(module, param, type, fmt, descr)		\
339191673Sjamie    SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\
340191673Sjamie	(type) | CTLFLAG_MPSAFE, NULL, 0, sysctl_jail_param, fmt, descr)
341191673Sjamie#define	SYSCTL_JAIL_PARAM_STRING(module, param, access, len, descr)	\
342191673Sjamie    SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\
343191673Sjamie	CTLTYPE_STRING | CTLFLAG_MPSAFE | (access), NULL, len,		\
344191673Sjamie	sysctl_jail_param, "A", descr)
345191673Sjamie#define	SYSCTL_JAIL_PARAM_STRUCT(module, param, access, len, fmt, descr)\
346191673Sjamie    SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\
347191673Sjamie	CTLTYPE_STRUCT | CTLFLAG_MPSAFE | (access), NULL, len,		\
348191673Sjamie	sysctl_jail_param, fmt, descr)
349191673Sjamie#define	SYSCTL_JAIL_PARAM_NODE(module, descr)				\
350195870Sjamie    SYSCTL_NODE(_security_jail_param, OID_AUTO, module, 0, 0, descr)
351232059Smm#define	SYSCTL_JAIL_PARAM_SUBNODE(parent, module, descr)		\
352232059Smm    SYSCTL_NODE(_security_jail_param_##parent, OID_AUTO, module, 0, 0, descr)
353195870Sjamie#define	SYSCTL_JAIL_PARAM_SYS_NODE(module, access, descr)		\
354195870Sjamie    SYSCTL_JAIL_PARAM_NODE(module, descr);				\
355195870Sjamie    SYSCTL_JAIL_PARAM(_##module, , CTLTYPE_INT | (access), "E,jailsys",	\
356195870Sjamie	descr)
357191673Sjamie
358191673Sjamie/*
35972786Srwatson * Kernel support functions for jail().
36072786Srwatson */
36172786Srwatsonstruct ucred;
362125804Srwatsonstruct mount;
36372786Srwatsonstruct sockaddr;
364147185Spjdstruct statfs;
36592719Salfredint jailed(struct ucred *cred);
366200473Sbzint jailed_without_vnet(struct ucred *);
367194090Sjamievoid getcredhostname(struct ucred *, char *, size_t);
368194090Sjamievoid getcreddomainname(struct ucred *, char *, size_t);
369194090Sjamievoid getcredhostuuid(struct ucred *, char *, size_t);
370194090Sjamievoid getcredhostid(struct ucred *, unsigned long *);
371280632Sianvoid prison0_init(void);
372192895Sjamieint prison_allow(struct ucred *, unsigned);
37392719Salfredint prison_check(struct ucred *cred1, struct ucred *cred2);
374196176Sbzint prison_owns_vnet(struct ucred *);
375147185Spjdint prison_canseemount(struct ucred *cred, struct mount *mp);
376147185Spjdvoid prison_enforce_statfs(struct ucred *cred, struct mount *mp,
377147185Spjd    struct statfs *sp);
378168399Spjdstruct prison *prison_find(int prid);
379192895Sjamiestruct prison *prison_find_child(struct prison *, int);
380192895Sjamiestruct prison *prison_find_name(struct prison *, const char *);
381192895Sjamieint prison_flag(struct ucred *, unsigned);
38292719Salfredvoid prison_free(struct prison *pr);
383185029Spjdvoid prison_free_locked(struct prison *pr);
38492719Salfredvoid prison_hold(struct prison *pr);
385185029Spjdvoid prison_hold_locked(struct prison *pr);
386185435Sbzvoid prison_proc_hold(struct prison *);
387185435Sbzvoid prison_proc_free(struct prison *);
388192895Sjamieint prison_ischild(struct prison *, struct prison *);
389192895Sjamieint prison_equal_ip4(struct prison *, struct prison *);
390187684Sbzint prison_get_ip4(struct ucred *cred, struct in_addr *ia);
391185435Sbzint prison_local_ip4(struct ucred *cred, struct in_addr *ia);
392185435Sbzint prison_remote_ip4(struct ucred *cred, struct in_addr *ia);
393185435Sbzint prison_check_ip4(struct ucred *cred, struct in_addr *ia);
394202468Sbzint prison_saddrsel_ip4(struct ucred *, struct in_addr *);
395185435Sbz#ifdef INET6
396192895Sjamieint prison_equal_ip6(struct prison *, struct prison *);
397187684Sbzint prison_get_ip6(struct ucred *, struct in6_addr *);
398185435Sbzint prison_local_ip6(struct ucred *, struct in6_addr *, int);
399185435Sbzint prison_remote_ip6(struct ucred *, struct in6_addr *);
400185435Sbzint prison_check_ip6(struct ucred *, struct in6_addr *);
401202468Sbzint prison_saddrsel_ip6(struct ucred *, struct in6_addr *);
402185435Sbz#endif
403188146Sjamieint prison_check_af(struct ucred *cred, int af);
40492719Salfredint prison_if(struct ucred *cred, struct sockaddr *sa);
405192895Sjamiechar *prison_name(struct prison *, struct prison *);
406164032Srwatsonint prison_priv_check(struct ucred *cred, int priv);
407219819Sjeffint sysctl_jail_param(SYSCTL_HANDLER_ARGS);
408220137Straszvoid prison_racct_foreach(void (*callback)(struct racct *racct,
409220137Strasz    void *arg2, void *arg3), void *arg2, void *arg3);
410221362Straszstruct prison_racct *prison_racct_find(const char *name);
411221362Straszvoid prison_racct_hold(struct prison_racct *prr);
412221362Straszvoid prison_racct_free(struct prison_racct *prr);
41372786Srwatson
414143869Spjd#endif /* _KERNEL */
41546155Sphk#endif /* !_SYS_JAIL_H_ */
416