FreeBSD/Linux Kernel Cross Reference
sys/sys/jail.h
1 /*
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 * ----------------------------------------------------------------------------
8 *
9 * $FreeBSD: releng/5.0/sys/sys/jail.h 96090 2002-05-06 03:13:08Z bde $
10 *
11 */
12
13 #ifndef _SYS_JAIL_H_
14 #define _SYS_JAIL_H_
15
16 struct jail {
17 u_int32_t version;
18 char *path;
19 char *hostname;
20 u_int32_t ip_number;
21 };
22
23 #ifndef _KERNEL
24
25 int jail(struct jail *);
26
27 #else /* _KERNEL */
28
29 #include <sys/queue.h>
30 #include <sys/_lock.h>
31 #include <sys/_mutex.h>
32
33 #ifdef MALLOC_DECLARE
34 MALLOC_DECLARE(M_PRISON);
35 #endif
36
37 /*
38 * This structure describes a prison. It is pointed to by all struct
39 * ucreds's of the inmates. pr_ref keeps track of them and is used to
40 * delete the struture when the last inmate is dead.
41 *
42 * Lock key:
43 * (p) locked by pr_mutex
44 * (c) set only during creation before the structure is shared, no mutex
45 * required to read
46 */
47 struct mtx;
48 struct prison {
49 int pr_ref; /* (p) refcount */
50 char pr_host[MAXHOSTNAMELEN]; /* (p) jail hostname */
51 u_int32_t pr_ip; /* (c) ip addr host */
52 void *pr_linux; /* (p) linux abi */
53 int pr_securelevel; /* (p) securelevel */
54 struct mtx pr_mtx;
55 };
56
57 /*
58 * Sysctl-set variables that determine global jail policy
59 *
60 * XXX MIB entries will need to be protected by a mutex.
61 */
62 extern int jail_set_hostname_allowed;
63 extern int jail_socket_unixiproute_only;
64 extern int jail_sysvipc_allowed;
65
66 /*
67 * Kernel support functions for jail().
68 */
69 struct ucred;
70 struct sockaddr;
71 int jailed(struct ucred *cred);
72 void getcredhostname(struct ucred *cred, char *, size_t);
73 int prison_check(struct ucred *cred1, struct ucred *cred2);
74 void prison_free(struct prison *pr);
75 u_int32_t prison_getip(struct ucred *cred);
76 void prison_hold(struct prison *pr);
77 int prison_if(struct ucred *cred, struct sockaddr *sa);
78 int prison_ip(struct ucred *cred, int flag, u_int32_t *ip);
79 void prison_remote_ip(struct ucred *cred, int flags, u_int32_t *ip);
80
81 #endif /* !_KERNEL */
82 #endif /* !_SYS_JAIL_H_ */
Cache object: 9d089448cfbbba11392dec90e7716921
|