summaryrefslogtreecommitdiffstats
path: root/sys/netinet
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
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')
-rw-r--r--sys/netinet/in.c14
-rw-r--r--sys/netinet/in_pcb.c19
-rw-r--r--sys/netinet/in_pcb.h8
-rw-r--r--sys/netinet/in_proto.c6
-rw-r--r--sys/netinet/in_var.h5
-rw-r--r--sys/netinet/ip_output.c5
-rw-r--r--sys/netinet/ip_var.h8
-rw-r--r--sys/netinet/raw_ip.c24
-rw-r--r--sys/netinet/tcp_input.c5
-rw-r--r--sys/netinet/tcp_reass.c5
-rw-r--r--sys/netinet/tcp_usrreq.c46
-rw-r--r--sys/netinet/tcp_var.h5
-rw-r--r--sys/netinet/udp_usrreq.c27
13 files changed, 99 insertions, 78 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 17e8a88..4586c22 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in.c 8.4 (Berkeley) 1/9/95
- * $Id: in.c,v 1.32 1997/02/22 09:41:27 peter Exp $
+ * $Id: in.c,v 1.33 1997/03/24 11:33:25 bde Exp $
*/
#include <sys/param.h>
@@ -40,6 +40,7 @@
#include <sys/sockio.h>
#include <sys/errno.h>
#include <sys/malloc.h>
+#include <sys/proc.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/kernel.h>
@@ -140,11 +141,12 @@ static int in_interfaces; /* number of external internet interfaces */
*/
/* ARGSUSED */
int
-in_control(so, cmd, data, ifp)
+in_control(so, cmd, data, ifp, p)
struct socket *so;
int cmd;
caddr_t data;
register struct ifnet *ifp;
+ struct proc *p;
{
register struct ifreq *ifr = (struct ifreq *)data;
register struct in_ifaddr *ia = 0, *iap;
@@ -200,8 +202,8 @@ in_control(so, cmd, data, ifp)
case SIOCSIFADDR:
case SIOCSIFNETMASK:
case SIOCSIFDSTADDR:
- if ((so->so_state & SS_PRIV) == 0)
- return (EPERM);
+ if (p && (error = suser(p->p_ucred, &p->p_acflag)) != 0)
+ return error;
if (ifp == 0)
panic("in_control");
@@ -237,8 +239,8 @@ in_control(so, cmd, data, ifp)
break;
case SIOCSIFBRDADDR:
- if ((so->so_state & SS_PRIV) == 0)
- return (EPERM);
+ if (p && (error = suser(p->p_ucred, &p->p_acflag)) != 0)
+ return error;
/* FALLTHROUGH */
case SIOCGIFADDR:
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index d7136aa..6ae7e85 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_pcb.c 8.4 (Berkeley) 5/24/95
- * $Id: in_pcb.c,v 1.29 1997/03/24 11:24:50 bde Exp $
+ * $Id: in_pcb.c,v 1.30 1997/04/03 05:14:40 davidg Exp $
*/
#include <sys/param.h>
@@ -112,14 +112,16 @@ SYSCTL_PROC(_net_inet_ip_portrange, OID_AUTO, hilast, CTLTYPE_INT|CTLFLAG_RW,
&ipport_hilastauto, 0, &sysctl_net_ipport_check, "I", "");
int
-in_pcballoc(so, pcbinfo)
+in_pcballoc(so, pcbinfo, p)
struct socket *so;
struct inpcbinfo *pcbinfo;
+ struct proc *p;
{
register struct inpcb *inp;
int s;
- MALLOC(inp, struct inpcb *, sizeof(*inp), M_PCB, M_NOWAIT);
+ MALLOC(inp, struct inpcb *, sizeof(*inp), M_PCB,
+ p ? M_WAITOK : M_NOWAIT);
if (inp == NULL)
return (ENOBUFS);
bzero((caddr_t)inp, sizeof(*inp));
@@ -134,14 +136,14 @@ in_pcballoc(so, pcbinfo)
}
int
-in_pcbbind(inp, nam)
+in_pcbbind(inp, nam, p)
register struct inpcb *inp;
struct mbuf *nam;
+ struct proc *p;
{
register struct socket *so = inp->inp_socket;
unsigned short *lastport;
struct sockaddr_in *sin;
- struct proc *p = curproc; /* XXX */
u_short lport = 0;
int wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
int error;
@@ -208,7 +210,7 @@ in_pcbbind(inp, nam)
lastport = &inp->inp_pcbinfo->lasthi;
} else if (inp->inp_flags & INP_LOWPORT) {
if (error = suser(p->p_ucred, &p->p_acflag))
- return (EACCES);
+ return error;
first = ipport_lowfirstauto; /* 1023 */
last = ipport_lowlastauto; /* 600 */
lastport = &inp->inp_pcbinfo->lastlow;
@@ -391,9 +393,10 @@ in_pcbladdr(inp, nam, plocal_sin)
* then pick one.
*/
int
-in_pcbconnect(inp, nam)
+in_pcbconnect(inp, nam, p)
register struct inpcb *inp;
struct mbuf *nam;
+ struct proc *p;
{
struct sockaddr_in *ifaddr;
register struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
@@ -411,7 +414,7 @@ in_pcbconnect(inp, nam)
return (EADDRINUSE);
if (inp->inp_laddr.s_addr == INADDR_ANY) {
if (inp->inp_lport == 0)
- (void)in_pcbbind(inp, (struct mbuf *)0);
+ (void)in_pcbbind(inp, (struct mbuf *)0, p);
inp->inp_laddr = ifaddr->sin_addr;
}
inp->inp_faddr = sin->sin_addr;
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 5a5d69d..6d6cdc6 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_pcb.h 8.1 (Berkeley) 6/10/93
- * $Id: in_pcb.h,v 1.19 1997/03/03 09:23:34 davidg Exp $
+ * $Id: in_pcb.h,v 1.20 1997/04/03 05:14:41 davidg Exp $
*/
#ifndef _NETINET_IN_PCB_H_
@@ -101,9 +101,9 @@ struct inpcbinfo {
#ifdef KERNEL
void in_losing __P((struct inpcb *));
-int in_pcballoc __P((struct socket *, struct inpcbinfo *));
-int in_pcbbind __P((struct inpcb *, struct mbuf *));
-int in_pcbconnect __P((struct inpcb *, struct mbuf *));
+int in_pcballoc __P((struct socket *, struct inpcbinfo *, struct proc *));
+int in_pcbbind __P((struct inpcb *, struct mbuf *, struct proc *));
+int in_pcbconnect __P((struct inpcb *, struct mbuf *, struct proc *));
void in_pcbdetach __P((struct inpcb *));
void in_pcbdisconnect __P((struct inpcb *));
int in_pcbladdr __P((struct inpcb *, struct mbuf *,
diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c
index b07d8a5..eeaf2f4 100644
--- a/sys/netinet/in_proto.c
+++ b/sys/netinet/in_proto.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_proto.c 8.2 (Berkeley) 2/9/95
- * $Id$
+ * $Id: in_proto.c,v 1.38 1997/02/18 20:46:22 wollman Exp $
*/
#include <sys/param.h>
@@ -96,12 +96,14 @@ void iplinit();
extern struct domain inetdomain;
+static struct pr_usrreqs nousrreqs;
struct protosw inetsw[] = {
{ 0, &inetdomain, 0, 0,
0, 0, 0, 0,
0,
- ip_init, 0, ip_slowtimo, ip_drain
+ ip_init, 0, ip_slowtimo, ip_drain,
+ &nousrreqs
},
{ SOCK_DGRAM, &inetdomain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR,
udp_input, 0, udp_ctlinput, ip_ctloutput,
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index 516a875..f61a26d 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_var.h 8.2 (Berkeley) 1/9/95
- * $Id$
+ * $Id: in_var.h,v 1.25 1997/02/22 09:41:30 peter Exp $
*/
#ifndef _NETINET_IN_VAR_H_
@@ -216,7 +216,8 @@ do { \
struct in_multi *in_addmulti __P((struct in_addr *, struct ifnet *));
void in_delmulti __P((struct in_multi *));
-int in_control __P((struct socket *, int, caddr_t, struct ifnet *));
+int in_control __P((struct socket *, int, caddr_t, struct ifnet *,
+ struct proc *));
void in_rtqdrain __P((void));
void ip_input __P((struct mbuf *));
int in_ifadown __P((struct ifaddr *ifa));
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 40a1b4a..4b989fc 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_output.c 8.3 (Berkeley) 1/21/94
- * $Id: ip_output.c,v 1.1.1.2 1997/04/03 10:39:32 darrenr Exp $
+ * $Id: ip_output.c,v 1.54 1997/04/03 10:47:12 darrenr Exp $
*/
#define _IP_VHL
@@ -623,11 +623,12 @@ ip_optcopy(ip, jp)
* IP socket option processing.
*/
int
-ip_ctloutput(op, so, level, optname, mp)
+ip_ctloutput(op, so, level, optname, mp, p)
int op;
struct socket *so;
int level, optname;
struct mbuf **mp;
+ struct proc *p;
{
register struct inpcb *inp = sotoinpcb(so);
register struct mbuf *m = *mp;
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h
index 8875197..e71c0d2 100644
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_var.h 8.2 (Berkeley) 1/9/95
- * $Id$
+ * $Id: ip_var.h,v 1.31 1997/02/22 09:41:36 peter Exp $
*/
#ifndef _NETINET_IP_VAR_H_
@@ -172,7 +172,8 @@ extern u_long (*ip_mcast_src) __P((int));
extern int rsvp_on;
extern struct pr_usrreqs rip_usrreqs;
-int ip_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
+int ip_ctloutput __P((int, struct socket *, int, int, struct mbuf **,
+ struct proc *));
void ip_drain __P((void));
void ip_freemoptions __P((struct ip_moptions *));
void ip_init __P((void));
@@ -186,7 +187,8 @@ void ip_slowtimo __P((void));
struct mbuf *
ip_srcroute __P((void));
void ip_stripoptions __P((struct mbuf *, struct mbuf *));
-int rip_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
+int rip_ctloutput __P((int, struct socket *, int, int, struct mbuf **,
+ struct proc *p));
void rip_ctlinput __P((int, struct sockaddr *, void *));
void rip_init __P((void));
void rip_input __P((struct mbuf *, int));
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
};
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 0aefb25..f76526e 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
- * $Id$
+ * $Id: tcp_input.c,v 1.57 1997/02/22 09:41:40 peter Exp $
*/
#ifndef TUBA_INCLUDE
@@ -42,6 +42,7 @@
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
+#include <sys/proc.h> /* for proc0 declaration */
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
@@ -652,7 +653,7 @@ findpcb:
laddr = inp->inp_laddr;
if (inp->inp_laddr.s_addr == INADDR_ANY)
inp->inp_laddr = ti->ti_dst;
- if (in_pcbconnect(inp, am)) {
+ if (in_pcbconnect(inp, am, &proc0)) { /* XXX creds */
inp->inp_laddr = laddr;
(void) m_free(am);
goto drop;
diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c
index 0aefb25..f76526e 100644
--- a/sys/netinet/tcp_reass.c
+++ b/sys/netinet/tcp_reass.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
- * $Id$
+ * $Id: tcp_input.c,v 1.57 1997/02/22 09:41:40 peter Exp $
*/
#ifndef TUBA_INCLUDE
@@ -42,6 +42,7 @@
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
+#include <sys/proc.h> /* for proc0 declaration */
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
@@ -652,7 +653,7 @@ findpcb:
laddr = inp->inp_laddr;
if (inp->inp_laddr.s_addr == INADDR_ANY)
inp->inp_laddr = ti->ti_dst;
- if (in_pcbconnect(inp, am)) {
+ if (in_pcbconnect(inp, am, &proc0)) { /* XXX creds */
inp->inp_laddr = laddr;
(void) m_free(am);
goto drop;
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index fbed6af..6946c08 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94
- * $Id$
+ * $Id: tcp_usrreq.c,v 1.30 1997/02/21 16:30:31 wollman Exp $
*/
#include <sys/param.h>
@@ -71,8 +71,9 @@
*/
extern char *tcpstates[]; /* XXX ??? */
-static int tcp_attach __P((struct socket *));
-static int tcp_connect __P((struct tcpcb *, struct mbuf *));
+static int tcp_attach __P((struct socket *, struct proc *));
+static int tcp_connect __P((struct tcpcb *, struct mbuf *,
+ struct proc *));
static struct tcpcb *
tcp_disconnect __P((struct tcpcb *));
static struct tcpcb *
@@ -94,7 +95,7 @@ static struct tcpcb *
* and an internet control block.
*/
static int
-tcp_usr_attach(struct socket *so, int proto)
+tcp_usr_attach(struct socket *so, int proto, struct proc *p)
{
int s = splnet();
int error;
@@ -108,7 +109,7 @@ tcp_usr_attach(struct socket *so, int proto)
goto out;
}
- error = tcp_attach(so);
+ error = tcp_attach(so, p);
if (error)
goto out;
@@ -170,7 +171,7 @@ tcp_usr_detach(struct socket *so)
* Give the socket an address.
*/
static int
-tcp_usr_bind(struct socket *so, struct mbuf *nam)
+tcp_usr_bind(struct socket *so, struct mbuf *nam, struct proc *p)
{
int s = splnet();
int error = 0;
@@ -190,7 +191,7 @@ tcp_usr_bind(struct socket *so, struct mbuf *nam)
error = EAFNOSUPPORT;
goto out;
}
- error = in_pcbbind(inp, nam);
+ error = in_pcbbind(inp, nam, p);
if (error)
goto out;
COMMON_END(PRU_BIND);
@@ -201,7 +202,7 @@ tcp_usr_bind(struct socket *so, struct mbuf *nam)
* Prepare to accept connections.
*/
static int
-tcp_usr_listen(struct socket *so)
+tcp_usr_listen(struct socket *so, struct proc *p)
{
int s = splnet();
int error = 0;
@@ -210,7 +211,7 @@ tcp_usr_listen(struct socket *so)
COMMON_START();
if (inp->inp_lport == 0)
- error = in_pcbbind(inp, NULL);
+ error = in_pcbbind(inp, (struct mbuf *)0, p);
if (error == 0)
tp->t_state = TCPS_LISTEN;
COMMON_END(PRU_LISTEN);
@@ -224,7 +225,7 @@ tcp_usr_listen(struct socket *so)
* Send initial segment on connection.
*/
static int
-tcp_usr_connect(struct socket *so, struct mbuf *nam)
+tcp_usr_connect(struct socket *so, struct mbuf *nam, struct proc *p)
{
int s = splnet();
int error = 0;
@@ -244,7 +245,7 @@ tcp_usr_connect(struct socket *so, struct mbuf *nam)
goto out;
}
- if ((error = tcp_connect(tp, nam)) != 0)
+ if ((error = tcp_connect(tp, nam, p)) != 0)
goto out;
error = tcp_output(tp);
COMMON_END(PRU_CONNECT);
@@ -333,7 +334,7 @@ tcp_usr_rcvd(struct socket *so, int flags)
*/
static int
tcp_usr_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
- struct mbuf *control)
+ struct mbuf *control, struct proc *p)
{
int s = splnet();
int error = 0;
@@ -357,7 +358,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
* initialize maxseg/maxopd using peer's cached
* MSS.
*/
- error = tcp_connect(tp, nam);
+ error = tcp_connect(tp, nam, p);
if (error)
goto out;
tp->snd_wnd = TTCP_CLIENT_SND_WND;
@@ -396,7 +397,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *nam,
* initialize maxseg/maxopd using peer's cached
* MSS.
*/
- error = tcp_connect(tp, nam);
+ error = tcp_connect(tp, nam, p);
if (error)
goto out;
tp->snd_wnd = TTCP_CLIENT_SND_WND;
@@ -463,7 +464,7 @@ struct pr_usrreqs tcp_usrreqs = {
tcp_usr_connect, pru_connect2_notsupp, in_control, tcp_usr_detach,
tcp_usr_disconnect, tcp_usr_listen, in_setpeeraddr, tcp_usr_rcvd,
tcp_usr_rcvoob, tcp_usr_send, pru_sense_null, tcp_usr_shutdown,
- in_setsockaddr
+ in_setsockaddr, sosend, soreceive, soselect
};
/*
@@ -477,9 +478,10 @@ struct pr_usrreqs tcp_usrreqs = {
* Initialize connection parameters and enter SYN-SENT state.
*/
static int
-tcp_connect(tp, nam)
+tcp_connect(tp, nam, p)
register struct tcpcb *tp;
struct mbuf *nam;
+ struct proc *p;
{
struct inpcb *inp = tp->t_inpcb, *oinp;
struct socket *so = inp->inp_socket;
@@ -491,7 +493,7 @@ tcp_connect(tp, nam)
struct rmxp_tao tao_noncached;
if (inp->inp_lport == 0) {
- error = in_pcbbind(inp, NULL);
+ error = in_pcbbind(inp, (struct mbuf *)0, p);
if (error)
return error;
}
@@ -564,11 +566,12 @@ tcp_connect(tp, nam)
}
int
-tcp_ctloutput(op, so, level, optname, mp)
+tcp_ctloutput(op, so, level, optname, mp, p)
int op;
struct socket *so;
int level, optname;
struct mbuf **mp;
+ struct proc *p;
{
int error = 0, s;
struct inpcb *inp;
@@ -585,7 +588,7 @@ tcp_ctloutput(op, so, level, optname, mp)
return (ECONNRESET);
}
if (level != IPPROTO_TCP) {
- error = ip_ctloutput(op, so, level, optname, mp);
+ error = ip_ctloutput(op, so, level, optname, mp, p);
splx(s);
return (error);
}
@@ -684,8 +687,9 @@ SYSCTL_INT(_net_inet_tcp, TCPCTL_RECVSPACE, recvspace,
* bufer space, and entering LISTEN state if to accept connections.
*/
static int
-tcp_attach(so)
+tcp_attach(so, p)
struct socket *so;
+ struct proc *p;
{
register struct tcpcb *tp;
struct inpcb *inp;
@@ -696,7 +700,7 @@ tcp_attach(so)
if (error)
return (error);
}
- error = in_pcballoc(so, &tcbinfo);
+ error = in_pcballoc(so, &tcbinfo, p);
if (error)
return (error);
inp = sotoinpcb(so);
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 8e63a2c..a9a9b36 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_var.h 8.4 (Berkeley) 5/24/95
- * $Id$
+ * $Id: tcp_var.h,v 1.38 1997/02/22 09:41:43 peter Exp $
*/
#ifndef _NETINET_TCP_VAR_H_
@@ -337,7 +337,8 @@ void tcp_canceltimers __P((struct tcpcb *));
struct tcpcb *
tcp_close __P((struct tcpcb *));
void tcp_ctlinput __P((int, struct sockaddr *, void *));
-int tcp_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
+int tcp_ctloutput __P((int, struct socket *, int, int, struct mbuf **,
+ struct proc *));
struct tcpcb *
tcp_drop __P((struct tcpcb *, int));
void tcp_drain __P((void));
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index fe1a8fc..108bea5 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95
- * $Id: udp_usrreq.c,v 1.36 1997/03/03 09:23:37 davidg Exp $
+ * $Id: udp_usrreq.c,v 1.37 1997/04/03 05:14:45 davidg Exp $
*/
#include <sys/param.h>
@@ -91,7 +91,7 @@ SYSCTL_STRUCT(_net_inet_udp, UDPCTL_STATS, stats, CTLFLAG_RD,
static struct sockaddr_in udp_in = { sizeof(udp_in), AF_INET };
static int udp_output __P((struct inpcb *, struct mbuf *, struct mbuf *,
- struct mbuf *));
+ struct mbuf *, struct proc *));
static void udp_notify __P((struct inpcb *, int));
void
@@ -360,10 +360,11 @@ udp_ctlinput(cmd, sa, vip)
}
static int
-udp_output(inp, m, addr, control)
+udp_output(inp, m, addr, control, p)
register struct inpcb *inp;
register struct mbuf *m;
struct mbuf *addr, *control;
+ struct proc *p;
{
register struct udpiphdr *ui;
register int len = m->m_pkthdr.len;
@@ -388,7 +389,7 @@ udp_output(inp, m, addr, control)
* Must block input while temporarily connected.
*/
s = splnet();
- error = in_pcbconnect(inp, addr);
+ error = in_pcbconnect(inp, addr, p);
if (error) {
splx(s);
goto release;
@@ -480,7 +481,7 @@ udp_abort(struct socket *so)
}
static int
-udp_attach(struct socket *so, int proto)
+udp_attach(struct socket *so, int proto, struct proc *p)
{
struct inpcb *inp;
int s, error;
@@ -490,7 +491,7 @@ udp_attach(struct socket *so, int proto)
return EINVAL;
s = splnet();
- error = in_pcballoc(so, &udbinfo);
+ error = in_pcballoc(so, &udbinfo, p);
splx(s);
if (error)
return error;
@@ -502,7 +503,7 @@ udp_attach(struct socket *so, int proto)
}
static int
-udp_bind(struct socket *so, struct mbuf *nam)
+udp_bind(struct socket *so, struct mbuf *nam, struct proc *p)
{
struct inpcb *inp;
int s, error;
@@ -511,13 +512,13 @@ udp_bind(struct socket *so, struct mbuf *nam)
if (inp == 0)
return EINVAL;
s = splnet();
- error = in_pcbbind(inp, nam);
+ error = in_pcbbind(inp, nam, p);
splx(s);
return error;
}
static int
-udp_connect(struct socket *so, struct mbuf *nam)
+udp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
{
struct inpcb *inp;
int s, error;
@@ -528,7 +529,7 @@ udp_connect(struct socket *so, struct mbuf *nam)
if (inp->inp_faddr.s_addr != INADDR_ANY)
return EISCONN;
s = splnet();
- error = in_pcbconnect(inp, nam);
+ error = in_pcbconnect(inp, nam, p);
splx(s);
if (error == 0)
soisconnected(so);
@@ -572,7 +573,7 @@ udp_disconnect(struct socket *so)
static int
udp_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *addr,
- struct mbuf *control)
+ struct mbuf *control, struct proc *p)
{
struct inpcb *inp;
@@ -581,7 +582,7 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct mbuf *addr,
m_freem(m);
return EINVAL;
}
- return udp_output(inp, m, addr, control);
+ return udp_output(inp, m, addr, control, p);
}
static int
@@ -601,5 +602,5 @@ struct pr_usrreqs udp_usrreqs = {
pru_connect2_notsupp, in_control, udp_detach, udp_disconnect,
pru_listen_notsupp, in_setpeeraddr, pru_rcvd_notsupp,
pru_rcvoob_notsupp, udp_send, pru_sense_null, udp_shutdown,
- in_setsockaddr
+ in_setsockaddr, sosend, soreceive, soselect
};
OpenPOWER on IntegriCloud