summaryrefslogtreecommitdiffstats
path: root/sys/netinet/raw_ip.c
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1997-04-27 20:01:29 +0000
committerwollman <wollman@FreeBSD.org>1997-04-27 20:01:29 +0000
commit6afbf203bd570424ecf3f9d9d9ced17f82c81adc (patch)
tree41103dcf8addc8e73880fc79975713ce1e6ba14c /sys/netinet/raw_ip.c
parentced78602fea5284de7f4cb1673405ad3f3ad57ce (diff)
downloadFreeBSD-src-6afbf203bd570424ecf3f9d9d9ced17f82c81adc.zip
FreeBSD-src-6afbf203bd570424ecf3f9d9d9ced17f82c81adc.tar.gz
The long-awaited mega-massive-network-code- cleanup. Part I.
This commit includes the following changes: 1) Old-style (pr_usrreq()) protocols are no longer supported, the compatibility glue for them is deleted, and the kernel will panic on boot if any are compiled in. 2) Certain protocol entry points are modified to take a process structure, so they they can easily tell whether or not it is possible to sleep, and also to access credentials. 3) SS_PRIV is no more, and with it goes the SO_PRIVSTATE setsockopt() call. Protocols should use the process pointer they are now passed. 4) The PF_LOCAL and PF_ROUTE families have been updated to use the new style, as has the `raw' skeleton family. 5) PF_LOCAL sockets now obey the process's umask when creating a socket in the filesystem. As a result, LINT is now broken. I'm hoping that some enterprising hacker with a bit more time will either make the broken bits work (should be easy for netipx) or dike them out.
Diffstat (limited to 'sys/netinet/raw_ip.c')
-rw-r--r--sys/netinet/raw_ip.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 1e3a35d..1320913 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
- * $Id: raw_ip.c,v 1.43 1997/03/03 09:23:35 davidg Exp $
+ * $Id: raw_ip.c,v 1.44 1997/04/03 05:14:43 davidg Exp $
*/
#include <sys/param.h>
@@ -40,6 +40,7 @@
#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
+#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/queue.h>
#include <sys/socket.h>
@@ -220,11 +221,12 @@ rip_output(m, so, dst)
* Raw IP socket option processing.
*/
int
-rip_ctloutput(op, so, level, optname, m)
+rip_ctloutput(op, so, level, optname, m, p)
int op;
struct socket *so;
int level, optname;
struct mbuf **m;
+ struct proc *p;
{
register struct inpcb *inp = sotoinpcb(so);
register int error;
@@ -313,7 +315,7 @@ rip_ctloutput(op, so, level, optname, m)
error = EINVAL;
return (error);
}
- return (ip_ctloutput(op, so, level, optname, m));
+ return (ip_ctloutput(op, so, level, optname, m, p));
}
/*
@@ -387,7 +389,7 @@ SYSCTL_INT(_net_inet_raw, OID_AUTO, recvspace, CTLFLAG_RW, &rip_recvspace,
0, "");
static int
-rip_attach(struct socket *so, int proto)
+rip_attach(struct socket *so, int proto, struct proc *p)
{
struct inpcb *inp;
int error;
@@ -395,11 +397,11 @@ rip_attach(struct socket *so, int proto)
inp = sotoinpcb(so);
if (inp)
panic("rip_attach");
- if ((so->so_state & SS_PRIV) == 0)
- return EACCES;
+ if (p && (error = suser(p->p_ucred, &p->p_acflag)) != 0)
+ return error;
if ((error = soreserve(so, rip_sendspace, rip_recvspace)) ||
- (error = in_pcballoc(so, &ripcbinfo)))
+ (error = in_pcballoc(so, &ripcbinfo, p)))
return error;
inp = (struct inpcb *)so->so_pcb;
inp->inp_ip_p = proto;
@@ -439,7 +441,7 @@ rip_disconnect(struct socket *so)
}
static int
-rip_bind(struct socket *so, struct mbuf *nam)
+rip_bind(struct socket *so, struct mbuf *nam, struct proc *p)
{
struct inpcb *inp = sotoinpcb(so);
struct sockaddr_in *addr = mtod(nam, struct sockaddr_in *);
@@ -457,7 +459,7 @@ rip_bind(struct socket *so, struct mbuf *nam)
}
static int
-rip_connect(struct socket *so, struct mbuf *nam)
+rip_connect(struct socket *so, struct mbuf *nam, struct proc *p)
{
struct inpcb *inp = sotoinpcb(so);
struct sockaddr_in *addr = mtod(nam, struct sockaddr_in *);
@@ -483,7 +485,7 @@ rip_shutdown(struct socket *so)
static int
rip_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
- struct mbuf *control)
+ struct mbuf *control, struct proc *p)
{
struct inpcb *inp = sotoinpcb(so);
register u_long dst;
@@ -509,5 +511,5 @@ struct pr_usrreqs rip_usrreqs = {
pru_connect2_notsupp, in_control, rip_detach, rip_disconnect,
pru_listen_notsupp, in_setpeeraddr, pru_rcvd_notsupp,
pru_rcvoob_notsupp, rip_send, pru_sense_null, rip_shutdown,
- in_setsockaddr
+ in_setsockaddr, sosend, soreceive, soselect
};
OpenPOWER on IntegriCloud