summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2001-02-21 06:39:57 +0000
committerrwatson <rwatson@FreeBSD.org>2001-02-21 06:39:57 +0000
commitab5676fc870d2d819cf41120313443182db079cf (patch)
tree3ed13007d645ee25bab52d52b6aba08f7f0bcf1e /sys/netinet/tcp_usrreq.c
parent17bdecb1829f632354d48f743f10ff707edded9c (diff)
downloadFreeBSD-src-ab5676fc870d2d819cf41120313443182db079cf.zip
FreeBSD-src-ab5676fc870d2d819cf41120313443182db079cf.tar.gz
o Move per-process jail pointer (p->pr_prison) to inside of the subject
credential structure, ucred (cr->cr_prison). o Allow jail inheritence to be a function of credential inheritence. o Abstract prison structure reference counting behind pr_hold() and pr_free(), invoked by the similarly named credential reference management functions, removing this code from per-ABI fork/exit code. o Modify various jail() functions to use struct ucred arguments instead of struct proc arguments. o Introduce jailed() function to determine if a credential is jailed, rather than directly checking pointers all over the place. o Convert PRISON_CHECK() macro to prison_check() function. o Move jail() function prototypes to jail.h. o Emulate the P_JAILED flag in fill_kinfo_proc() and no longer set the flag in the process flags field itself. o Eliminate that "const" qualifier from suser/p_can/etc to reflect mutex use. Notes: o Some further cleanup of the linux/jail code is still required. o It's now possible to consider resolving some of the process vs credential based permission checking confusion in the socket code. o Mutex protection of struct prison is still not present, and is required to protect the reference count plus some fields in the structure. Reviewed by: freebsd-arch Obtained from: TrustedBSD Project
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index ac1eee9..1d64581 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -49,6 +49,8 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/protosw.h>
+#include <sys/proc.h>
+#include <sys/jail.h>
#include <net/if.h>
#include <net/route.h>
@@ -328,7 +330,8 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
goto out;
}
- prison_remote_ip(p, 0, &sinp->sin_addr.s_addr);
+ if (p && jailed(p->p_ucred))
+ prison_remote_ip(p->p_ucred, 0, &sinp->sin_addr.s_addr);
if ((error = tcp_connect(tp, nam, p)) != 0)
goto out;
OpenPOWER on IntegriCloud