2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
26 char pr_path[MAXPATHLEN];
27 char pr_host[MAXHOSTNAMELEN];
30 #define XPRISON_VERSION 1
34 int jail(struct jail *);
39 #include <sys/queue.h>
40 #include <sys/_lock.h>
41 #include <sys/_mutex.h>
43 #define JAIL_MAX 999999
46 MALLOC_DECLARE(M_PRISON);
50 * This structure describes a prison. It is pointed to by all struct
51 * ucreds's of the inmates. pr_ref keeps track of them and is used to
52 * delete the struture when the last inmate is dead.
56 * (p) locked by pr_mutex
57 * (c) set only during creation before the structure is shared, no mutex
62 LIST_ENTRY(prison) pr_list; /* (a) all prisons */
63 int pr_id; /* (c) prison id */
64 int pr_ref; /* (p) refcount */
65 char pr_path[MAXPATHLEN]; /* (c) chroot path */
66 struct vnode *pr_root; /* (c) vnode to rdir */
67 char pr_host[MAXHOSTNAMELEN]; /* (p) jail hostname */
68 u_int32_t pr_ip; /* (c) ip addr host */
69 void *pr_linux; /* (p) linux abi */
70 int pr_securelevel; /* (p) securelevel */
75 * Sysctl-set variables that determine global jail policy
77 * XXX MIB entries will need to be protected by a mutex.
79 extern int jail_set_hostname_allowed;
80 extern int jail_socket_unixiproute_only;
81 extern int jail_sysvipc_allowed;
83 LIST_HEAD(prisonlist, prison);
84 extern struct prisonlist allprison;
87 * Kernel support functions for jail().
91 int jailed(struct ucred *cred);
92 void getcredhostname(struct ucred *cred, char *, size_t);
93 int prison_check(struct ucred *cred1, struct ucred *cred2);
94 void prison_free(struct prison *pr);
95 u_int32_t prison_getip(struct ucred *cred);
96 void prison_hold(struct prison *pr);
97 int prison_if(struct ucred *cred, struct sockaddr *sa);
98 int prison_ip(struct ucred *cred, int flag, u_int32_t *ip);
99 void prison_remote_ip(struct ucred *cred, int flags, u_int32_t *ip);
101 #endif /* !_KERNEL */
102 #endif /* !_SYS_JAIL_H_ */