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: releng/10.3/sys/sys/jail.h 295951 2016-02-24 02:34:11Z araujo $
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
152124882Srwatson *   (d) set only during destruction of jail, no mutex needed
15346155Sphk */
15446155Sphkstruct prison {
155191673Sjamie	TAILQ_ENTRY(prison) pr_list;			/* (a) all prisons */
156113275Smike	int		 pr_id;				/* (c) prison id */
15787275Srwatson	int		 pr_ref;			/* (p) refcount */
158191673Sjamie	int		 pr_uref;			/* (p) user (alive) refcount */
159191673Sjamie	unsigned	 pr_flags;			/* (p) PR_* flags */
160194842Sjamie	LIST_HEAD(, prison) pr_children;		/* (a) list of child jails */
161194842Sjamie	LIST_ENTRY(prison) pr_sibling;			/* (a) next in parent's list */
162192895Sjamie	struct prison	*pr_parent;			/* (c) containing jail */
163194842Sjamie	struct mtx	 pr_mtx;
164124882Srwatson	struct task	 pr_task;			/* (d) destroy task */
165185029Spjd	struct osd	 pr_osd;			/* (p) additional data */
166194842Sjamie	struct cpuset	*pr_cpuset;			/* (p) cpuset */
167194842Sjamie	struct vnet	*pr_vnet;			/* (c) network stack */
168194842Sjamie	struct vnode	*pr_root;			/* (c) vnode to rdir */
169191673Sjamie	int		 pr_ip4s;			/* (p) number of v4 IPs */
170194842Sjamie	int		 pr_ip6s;			/* (p) number of v6 IPs */
171191673Sjamie	struct in_addr	*pr_ip4;			/* (p) v4 IPs of jail */
172191673Sjamie	struct in6_addr	*pr_ip6;			/* (p) v6 IPs of jail */
173221362Strasz	struct prison_racct *pr_prison_racct;		/* (c) racct jail proxy */
174220137Strasz	void		*pr_sparep[3];
175194762Sjamie	int		 pr_childcount;			/* (a) number of child jails */
176194842Sjamie	int		 pr_childmax;			/* (p) maximum child jails */
177192895Sjamie	unsigned	 pr_allow;			/* (p) PR_ALLOW_* flags */
178194842Sjamie	int		 pr_securelevel;		/* (p) securelevel */
179192895Sjamie	int		 pr_enforce_statfs;		/* (p) statfs permission */
180231267Smm	int		 pr_devfs_rsnum;		/* (p) devfs ruleset */
181280632Sian	int		 pr_spare[3];
182280632Sian	int		 pr_osreldate;			/* (c) kern.osreldate value */
183194842Sjamie	unsigned long	 pr_hostid;			/* (p) jail hostid */
184194842Sjamie	char		 pr_name[MAXHOSTNAMELEN];	/* (p) admin jail name */
185194842Sjamie	char		 pr_path[MAXPATHLEN];		/* (c) chroot path */
186194842Sjamie	char		 pr_hostname[MAXHOSTNAMELEN];	/* (p) jail hostname */
187194118Sjamie	char		 pr_domainname[MAXHOSTNAMELEN];	/* (p) jail domainname */
188194118Sjamie	char		 pr_hostuuid[HOSTUUIDLEN];	/* (p) jail hostuuid */
189280632Sian	char		 pr_osrelease[OSRELEASELEN];	/* (c) kern.osrelease value */
19046155Sphk};
191221362Strasz
192221362Straszstruct prison_racct {
193221362Strasz	LIST_ENTRY(prison_racct) prr_next;
194221362Strasz	char		prr_name[MAXHOSTNAMELEN];
195221362Strasz	u_int		prr_refcount;
196221362Strasz	struct racct	*prr_racct;
197221362Strasz};
198143869Spjd#endif /* _KERNEL || _WANT_PRISON */
19946155Sphk
200143869Spjd#ifdef _KERNEL
201192895Sjamie/* Flag bits set via options */
202191673Sjamie#define	PR_PERSIST	0x00000001	/* Can exist without processes */
203193066Sjamie#define	PR_HOST		0x00000002	/* Virtualize hostname et al */
204195870Sjamie#define	PR_IP4_USER	0x00000004	/* Restrict IPv4 addresses */
205195870Sjamie#define	PR_IP6_USER	0x00000008	/* Restrict IPv6 addresses */
206194251Sjamie#define	PR_VNET		0x00000010	/* Virtual network stack */
207195870Sjamie#define	PR_IP4_DISABLE	0x00000020	/* Disable IPv4 */
208195870Sjamie#define	PR_IP6_DISABLE	0x00000040	/* Disable IPv6 */
209202468Sbz#define	PR_IP4_SADDRSEL	0x00000080	/* Do IPv4 src addr sel. or use the */
210202468Sbz					/* primary jail address. */
211202468Sbz#define	PR_IP6_SADDRSEL	0x00000100	/* Do IPv6 src addr sel. or use the */
212202468Sbz					/* primary jail address. */
213192895Sjamie
214192895Sjamie/* Internal flag bits */
215191673Sjamie#define	PR_REMOVE	0x01000000	/* In process of being removed */
216195870Sjamie#define	PR_IP4		0x02000000	/* IPv4 restricted or disabled */
217195870Sjamie					/* by this jail or an ancestor */
218195870Sjamie#define	PR_IP6		0x04000000	/* IPv6 restricted or disabled */
219195870Sjamie					/* by this jail or an ancestor */
220191673Sjamie
221192895Sjamie/* Flags for pr_allow */
222192895Sjamie#define	PR_ALLOW_SET_HOSTNAME		0x0001
223192895Sjamie#define	PR_ALLOW_SYSVIPC		0x0002
224192895Sjamie#define	PR_ALLOW_RAW_SOCKETS		0x0004
225192895Sjamie#define	PR_ALLOW_CHFLAGS		0x0008
226192895Sjamie#define	PR_ALLOW_MOUNT			0x0010
227192895Sjamie#define	PR_ALLOW_QUOTAS			0x0020
228194762Sjamie#define	PR_ALLOW_SOCKET_AF		0x0040
229232059Smm#define	PR_ALLOW_MOUNT_DEVFS		0x0080
230232059Smm#define	PR_ALLOW_MOUNT_NULLFS		0x0100
231232186Smm#define	PR_ALLOW_MOUNT_ZFS		0x0200
232232278Smm#define	PR_ALLOW_MOUNT_PROCFS		0x0400
233254741Sdelphij#define	PR_ALLOW_MOUNT_TMPFS		0x0800
234277985Sjamie#define	PR_ALLOW_MOUNT_FDESCFS		0x1000
235295951Saraujo#define	PR_ALLOW_MOUNT_LINPROCFS	0x2000
236295951Saraujo#define	PR_ALLOW_MOUNT_LINSYSFS		0x4000
237295951Saraujo#define	PR_ALLOW_ALL			0x7fff
238192895Sjamie
239191673Sjamie/*
240191673Sjamie * OSD methods
241191673Sjamie */
242191673Sjamie#define	PR_METHOD_CREATE	0
243191673Sjamie#define	PR_METHOD_GET		1
244191673Sjamie#define	PR_METHOD_SET		2
245191673Sjamie#define	PR_METHOD_CHECK		3
246191673Sjamie#define	PR_METHOD_ATTACH	4
247191806Sjamie#define	PR_MAXMETHOD		5
248191673Sjamie
249191673Sjamie/*
250192895Sjamie * Lock/unlock a prison.
251192895Sjamie * XXX These exist not so much for general convenience, but to be useable in
252192895Sjamie *     the FOREACH_PRISON_DESCENDANT_LOCKED macro which can't handle them in
253192895Sjamie *     non-function form as currently defined.
25457119Srwatson */
255192895Sjamiestatic __inline void
256192895Sjamieprison_lock(struct prison *pr)
257192895Sjamie{
25857119Srwatson
259192895Sjamie	mtx_lock(&pr->pr_mtx);
260192895Sjamie}
261192895Sjamie
262192895Sjamiestatic __inline void
263192895Sjamieprison_unlock(struct prison *pr)
264192895Sjamie{
265192895Sjamie
266192895Sjamie	mtx_unlock(&pr->pr_mtx);
267192895Sjamie}
268192895Sjamie
269192895Sjamie/* Traverse a prison's immediate children. */
270192895Sjamie#define	FOREACH_PRISON_CHILD(ppr, cpr)					\
271192895Sjamie	LIST_FOREACH(cpr, &(ppr)->pr_children, pr_sibling)
272192895Sjamie
273192895Sjamie/*
274192895Sjamie * Preorder traversal of all of a prison's descendants.
275192895Sjamie * This ugly loop allows the macro to be followed by a single block
276192895Sjamie * as expected in a looping primitive.
277192895Sjamie */
278192895Sjamie#define	FOREACH_PRISON_DESCENDANT(ppr, cpr, descend)			\
279192895Sjamie	for ((cpr) = (ppr), (descend) = 1;				\
280192895Sjamie	    ((cpr) = (((descend) && !LIST_EMPTY(&(cpr)->pr_children))	\
281192895Sjamie	      ? LIST_FIRST(&(cpr)->pr_children)				\
282192895Sjamie	      : ((cpr) == (ppr)						\
283192895Sjamie		 ? NULL							\
284192895Sjamie		 : (((descend) = LIST_NEXT(cpr, pr_sibling) != NULL)	\
285192895Sjamie		    ? LIST_NEXT(cpr, pr_sibling)			\
286192895Sjamie		    : (cpr)->pr_parent))));)				\
287192895Sjamie		if (!(descend))						\
288192895Sjamie			;						\
289192895Sjamie		else
290192895Sjamie
291192895Sjamie/*
292192895Sjamie * As above, but lock descendants on the way down and unlock on the way up.
293192895Sjamie */
294192895Sjamie#define	FOREACH_PRISON_DESCENDANT_LOCKED(ppr, cpr, descend)		\
295192895Sjamie	for ((cpr) = (ppr), (descend) = 1;				\
296192895Sjamie	    ((cpr) = (((descend) && !LIST_EMPTY(&(cpr)->pr_children))	\
297192895Sjamie	      ? LIST_FIRST(&(cpr)->pr_children)				\
298192895Sjamie	      : ((cpr) == (ppr)						\
299192895Sjamie		 ? NULL							\
300192895Sjamie		 : ((prison_unlock(cpr),				\
301192895Sjamie		    (descend) = LIST_NEXT(cpr, pr_sibling) != NULL)	\
302192895Sjamie		    ? LIST_NEXT(cpr, pr_sibling)			\
303192895Sjamie		    : (cpr)->pr_parent))));)				\
304192895Sjamie		if ((descend) ? (prison_lock(cpr), 0) : 1)		\
305192895Sjamie			;						\
306192895Sjamie		else
307192895Sjamie
308192895Sjamie/*
309194762Sjamie * As above, but also keep track of the level descended to.
310194762Sjamie */
311194762Sjamie#define	FOREACH_PRISON_DESCENDANT_LOCKED_LEVEL(ppr, cpr, descend, level)\
312194762Sjamie	for ((cpr) = (ppr), (descend) = 1, (level) = 0;			\
313194762Sjamie	    ((cpr) = (((descend) && !LIST_EMPTY(&(cpr)->pr_children))	\
314194762Sjamie	      ? (level++, LIST_FIRST(&(cpr)->pr_children))		\
315194762Sjamie	      : ((cpr) == (ppr)						\
316194762Sjamie		 ? NULL							\
317194762Sjamie		 : ((prison_unlock(cpr),				\
318194762Sjamie		    (descend) = LIST_NEXT(cpr, pr_sibling) != NULL)	\
319194762Sjamie		    ? LIST_NEXT(cpr, pr_sibling)			\
320194762Sjamie		    : (level--, (cpr)->pr_parent)))));)			\
321194762Sjamie		if ((descend) ? (prison_lock(cpr), 0) : 1)		\
322194762Sjamie			;						\
323194762Sjamie		else
324194762Sjamie
325194762Sjamie/*
326192895Sjamie * Attributes of the physical system, and the root of the jail tree.
327192895Sjamie */
328192895Sjamieextern struct	prison prison0;
329192895Sjamie
330191673SjamieTAILQ_HEAD(prisonlist, prison);
331113275Smikeextern struct	prisonlist allprison;
332168401Spjdextern struct	sx allprison_lock;
333113275Smike
33472786Srwatson/*
335191673Sjamie * Sysctls to describe jail parameters.
336191673Sjamie */
337191673SjamieSYSCTL_DECL(_security_jail_param);
338191673Sjamie
339191673Sjamie#define	SYSCTL_JAIL_PARAM(module, param, type, fmt, descr)		\
340191673Sjamie    SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\
341191673Sjamie	(type) | CTLFLAG_MPSAFE, NULL, 0, sysctl_jail_param, fmt, descr)
342191673Sjamie#define	SYSCTL_JAIL_PARAM_STRING(module, param, access, len, descr)	\
343191673Sjamie    SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\
344191673Sjamie	CTLTYPE_STRING | CTLFLAG_MPSAFE | (access), NULL, len,		\
345191673Sjamie	sysctl_jail_param, "A", descr)
346191673Sjamie#define	SYSCTL_JAIL_PARAM_STRUCT(module, param, access, len, fmt, descr)\
347191673Sjamie    SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\
348191673Sjamie	CTLTYPE_STRUCT | CTLFLAG_MPSAFE | (access), NULL, len,		\
349191673Sjamie	sysctl_jail_param, fmt, descr)
350191673Sjamie#define	SYSCTL_JAIL_PARAM_NODE(module, descr)				\
351195870Sjamie    SYSCTL_NODE(_security_jail_param, OID_AUTO, module, 0, 0, descr)
352232059Smm#define	SYSCTL_JAIL_PARAM_SUBNODE(parent, module, descr)		\
353232059Smm    SYSCTL_NODE(_security_jail_param_##parent, OID_AUTO, module, 0, 0, descr)
354195870Sjamie#define	SYSCTL_JAIL_PARAM_SYS_NODE(module, access, descr)		\
355195870Sjamie    SYSCTL_JAIL_PARAM_NODE(module, descr);				\
356195870Sjamie    SYSCTL_JAIL_PARAM(_##module, , CTLTYPE_INT | (access), "E,jailsys",	\
357195870Sjamie	descr)
358191673Sjamie
359191673Sjamie/*
36072786Srwatson * Kernel support functions for jail().
36172786Srwatson */
36272786Srwatsonstruct ucred;
363125804Srwatsonstruct mount;
36472786Srwatsonstruct sockaddr;
365147185Spjdstruct statfs;
36692719Salfredint jailed(struct ucred *cred);
367200473Sbzint jailed_without_vnet(struct ucred *);
368194090Sjamievoid getcredhostname(struct ucred *, char *, size_t);
369194090Sjamievoid getcreddomainname(struct ucred *, char *, size_t);
370194090Sjamievoid getcredhostuuid(struct ucred *, char *, size_t);
371194090Sjamievoid getcredhostid(struct ucred *, unsigned long *);
372280632Sianvoid prison0_init(void);
373192895Sjamieint prison_allow(struct ucred *, unsigned);
37492719Salfredint prison_check(struct ucred *cred1, struct ucred *cred2);
375196176Sbzint prison_owns_vnet(struct ucred *);
376147185Spjdint prison_canseemount(struct ucred *cred, struct mount *mp);
377147185Spjdvoid prison_enforce_statfs(struct ucred *cred, struct mount *mp,
378147185Spjd    struct statfs *sp);
379168399Spjdstruct prison *prison_find(int prid);
380192895Sjamiestruct prison *prison_find_child(struct prison *, int);
381192895Sjamiestruct prison *prison_find_name(struct prison *, const char *);
382192895Sjamieint prison_flag(struct ucred *, unsigned);
38392719Salfredvoid prison_free(struct prison *pr);
384185029Spjdvoid prison_free_locked(struct prison *pr);
38592719Salfredvoid prison_hold(struct prison *pr);
386185029Spjdvoid prison_hold_locked(struct prison *pr);
387185435Sbzvoid prison_proc_hold(struct prison *);
388185435Sbzvoid prison_proc_free(struct prison *);
389192895Sjamieint prison_ischild(struct prison *, struct prison *);
390192895Sjamieint prison_equal_ip4(struct prison *, struct prison *);
391187684Sbzint prison_get_ip4(struct ucred *cred, struct in_addr *ia);
392185435Sbzint prison_local_ip4(struct ucred *cred, struct in_addr *ia);
393185435Sbzint prison_remote_ip4(struct ucred *cred, struct in_addr *ia);
394185435Sbzint prison_check_ip4(struct ucred *cred, struct in_addr *ia);
395202468Sbzint prison_saddrsel_ip4(struct ucred *, struct in_addr *);
396185435Sbz#ifdef INET6
397192895Sjamieint prison_equal_ip6(struct prison *, struct prison *);
398187684Sbzint prison_get_ip6(struct ucred *, struct in6_addr *);
399185435Sbzint prison_local_ip6(struct ucred *, struct in6_addr *, int);
400185435Sbzint prison_remote_ip6(struct ucred *, struct in6_addr *);
401185435Sbzint prison_check_ip6(struct ucred *, struct in6_addr *);
402202468Sbzint prison_saddrsel_ip6(struct ucred *, struct in6_addr *);
403185435Sbz#endif
404188146Sjamieint prison_check_af(struct ucred *cred, int af);
40592719Salfredint prison_if(struct ucred *cred, struct sockaddr *sa);
406192895Sjamiechar *prison_name(struct prison *, struct prison *);
407164032Srwatsonint prison_priv_check(struct ucred *cred, int priv);
408219819Sjeffint sysctl_jail_param(SYSCTL_HANDLER_ARGS);
409220137Straszvoid prison_racct_foreach(void (*callback)(struct racct *racct,
410220137Strasz    void *arg2, void *arg3), void *arg2, void *arg3);
411221362Straszstruct prison_racct *prison_racct_find(const char *name);
412221362Straszvoid prison_racct_hold(struct prison_racct *prr);
413221362Straszvoid prison_racct_free(struct prison_racct *prr);
41472786Srwatson
415143869Spjd#endif /* _KERNEL */
41646155Sphk#endif /* !_SYS_JAIL_H_ */
417