Make ipx compile again after the network interface changes.

This commit is contained in:
John Hay 1997-05-01 06:21:31 +00:00
parent 47812774fd
commit a6eb92a6a4
9 changed files with 98 additions and 71 deletions

View File

@ -33,7 +33,7 @@
*
* @(#)ipx.c
*
* $Id: ipx.c,v 1.7 1997/02/22 09:41:51 peter Exp $
* $Id: ipx.c,v 1.8 1997/03/24 11:33:31 bde Exp $
*/
#include <sys/param.h>
@ -41,6 +41,7 @@
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/sockio.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/errno.h>
#include <sys/socket.h>
@ -62,11 +63,12 @@ int ipx_interfaces;
*/
/* ARGSUSED */
int
ipx_control(so, cmd, data, ifp)
ipx_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 ipx_aliasreq *ifra = (struct ipx_aliasreq *)data;
@ -110,8 +112,8 @@ ipx_control(so, cmd, data, ifp)
return (0);
}
if ((so->so_state & SS_PRIV) == 0)
return (EPERM);
if (p && (error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
switch (cmd) {
case SIOCAIFADDR:

View File

@ -33,7 +33,7 @@
*
* @(#)ipx.h
*
* $Id: ipx.h,v 1.9 1997/02/22 09:41:52 peter Exp $
* $Id: ipx.h,v 1.10 1997/04/05 20:05:07 jhay Exp $
*/
#ifndef _NETIPX_IPX_H_
@ -181,10 +181,10 @@ struct socket;
void ipx_abort __P((struct ipxpcb *ipxp));
u_short ipx_cksum __P((struct mbuf *m, int len));
int ipx_control __P((struct socket *so, int cmd, caddr_t data,
struct ifnet *ifp));
struct ifnet *ifp, struct proc *p));
void ipx_ctlinput __P((int cmd, struct sockaddr *arg_as_sa, void *dummy));
int ipx_ctloutput __P((int req, struct socket *so, int level, int name,
struct mbuf **value));
struct mbuf **value, struct proc *p));
int ipx_do_route __P((struct ipx_addr *src, struct route *ro));
void ipx_drop __P((struct ipxpcb *ipxp, int errno));
void ipx_forward __P((struct mbuf *m));

View File

@ -33,7 +33,7 @@
*
* @(#)ipx_ip.c
*
* $Id: ipx_ip.c,v 1.12 1997/02/22 09:41:54 peter Exp $
* $Id: ipx_ip.c,v 1.13 1997/03/24 11:33:33 bde Exp $
*/
/*
@ -46,11 +46,12 @@
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/errno.h>
#include <sys/sockio.h>
#include <sys/protosw.h>
#include <net/if.h>
#include <net/netisr.h>
@ -300,9 +301,10 @@ struct ifnet *ifp;
struct ifreq ifr_ipxip = {"ipxip0"};
int
ipxip_route(so, m)
ipxip_route(so, m, p)
struct socket *so;
register struct mbuf *m;
struct proc *p;
{
register struct ipxip_req *rq = mtod(m, struct ipxip_req *);
struct sockaddr_ipx *ipx_dst = (struct sockaddr_ipx *)&rq->rq_ipx;
@ -370,10 +372,10 @@ ipxip_route(so, m)
ifr_ipxip.ifr_name[4] = '0' + ipxipif.if_unit - 1;
ifr_ipxip.ifr_dstaddr = * (struct sockaddr *) ipx_dst;
(void)ipx_control(so, (int)SIOCSIFDSTADDR, (caddr_t)&ifr_ipxip,
(struct ifnet *)ifn);
(struct ifnet *)ifn, p);
satoipx_addr(ifr_ipxip.ifr_addr).x_host = ipx_thishost;
return (ipx_control(so, (int)SIOCSIFADDR, (caddr_t)&ifr_ipxip,
(struct ifnet *)ifn));
(struct ifnet *)ifn, p));
}
int

View File

@ -33,7 +33,7 @@
*
* @(#)ipxip.h
*
* $Id$
* $Id: ipx_ip.h,v 1.8 1997/02/22 09:41:55 peter Exp $
*/
#ifndef _NETIPX_IPXIP_H_
@ -62,7 +62,7 @@ void ipxip_input __P((struct mbuf *m, int hlen));
int ipxipioctl __P((struct ifnet *ifp, int cmd, caddr_t data));
int ipxipoutput __P((struct ifnet *ifp, struct mbuf *m,
struct sockaddr *dst, struct rtentry *rt));
int ipxip_route __P((struct socket *so, struct mbuf *m));
int ipxip_route __P((struct socket *so, struct mbuf *m, struct proc *p));
void ipxip_rtchange __P((struct in_addr *dst));
void ipxipstart __P((struct ifnet *ifp));

View File

@ -33,17 +33,18 @@
*
* @(#)ipx_pcb.c
*
* $Id$
* $Id: ipx_pcb.c,v 1.7 1997/02/22 09:41:56 peter Exp $
*/
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/errno.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/protosw.h>
#include <net/if.h>
#include <net/route.h>
@ -55,9 +56,10 @@
struct ipx_addr zeroipx_addr;
int
ipx_pcballoc(so, head)
ipx_pcballoc(so, head, p)
struct socket *so;
struct ipxpcb *head;
struct proc *p;
{
struct mbuf *m;
register struct ipxpcb *ipxp;
@ -73,9 +75,10 @@ ipx_pcballoc(so, head)
}
int
ipx_pcbbind(ipxp, nam)
ipx_pcbbind(ipxp, nam, p)
register struct ipxpcb *ipxp;
struct mbuf *nam;
struct proc *p;
{
register struct sockaddr_ipx *sipx;
u_short lport = 0;
@ -98,10 +101,11 @@ ipx_pcbbind(ipxp, nam)
lport = sipx->sipx_port;
if (lport) {
u_short aport = ntohs(lport);
int error;
if (aport < IPXPORT_MAX &&
(ipxp->ipxp_socket->so_state & SS_PRIV) == 0)
return (EACCES);
p && (error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
if (ipx_pcblookup(&zeroipx_addr, lport, 0))
return (EADDRINUSE);
}
@ -124,9 +128,10 @@ ipx_pcbbind(ipxp, nam)
* then pick one.
*/
int
ipx_pcbconnect(ipxp, nam)
ipx_pcbconnect(ipxp, nam, p)
struct ipxpcb *ipxp;
struct mbuf *nam;
struct proc *p;
{
struct ipx_ifaddr *ia;
register struct sockaddr_ipx *sipx = mtod(nam, struct sockaddr_ipx *);
@ -215,7 +220,7 @@ ipx_pcbconnect(ipxp, nam)
return (EADDRINUSE);
if (ipx_nullhost(ipxp->ipxp_laddr)) {
if (ipxp->ipxp_lport == 0)
(void) ipx_pcbbind(ipxp, (struct mbuf *)0);
(void) ipx_pcbbind(ipxp, (struct mbuf *)0, p);
ipxp->ipxp_laddr.x_host = ipx_thishost;
}
ipxp->ipxp_faddr = sipx->sipx_addr;

View File

@ -33,7 +33,7 @@
*
* @(#)ipx_pcb.h
*
* $Id$
* $Id: ipx_pcb.h,v 1.8 1997/02/22 09:41:56 peter Exp $
*/
#ifndef _NETIPX_IPX_PCB_H_
@ -81,9 +81,12 @@ struct ipxpcb {
#ifdef KERNEL
extern struct ipxpcb ipxpcb; /* head of list */
int ipx_pcballoc __P((struct socket *so, struct ipxpcb *head));
int ipx_pcbbind __P((struct ipxpcb *ipxp, struct mbuf *nam));
int ipx_pcbconnect __P((struct ipxpcb *ipxp, struct mbuf *nam));
int ipx_pcballoc __P((struct socket *so, struct ipxpcb *head,
struct proc *p));
int ipx_pcbbind __P((struct ipxpcb *ipxp, struct mbuf *nam,
struct proc *p));
int ipx_pcbconnect __P((struct ipxpcb *ipxp, struct mbuf *nam,
struct proc *p));
void ipx_pcbdetach __P((struct ipxpcb *ipxp));
void ipx_pcbdisconnect __P((struct ipxpcb *ipxp));
struct ipxpcb *

View File

@ -33,7 +33,7 @@
*
* @(#)ipx_usrreq.c
*
* $Id: ipx_usrreq.c,v 1.11 1997/02/22 09:41:57 peter Exp $
* $Id: ipx_usrreq.c,v 1.12 1997/04/05 20:05:09 jhay Exp $
*/
#include <sys/param.h>
@ -42,6 +42,7 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
@ -75,15 +76,15 @@ SYSCTL_INT(_net_ipx_ipx, OID_AUTO, ipxrecvspace, CTLFLAG_RW,
&ipxrecvspace, 0, "");
static int ipx_usr_abort(struct socket *so);
static int ipx_attach(struct socket *so, int proto);
static int ipx_bind(struct socket *so, struct mbuf *nam);
static int ipx_connect(struct socket *so, struct mbuf *nam);
static int ipx_attach(struct socket *so, int proto, struct proc *p);
static int ipx_bind(struct socket *so, struct mbuf *nam, struct proc *p);
static int ipx_connect(struct socket *so, struct mbuf *nam, struct proc *p);
static int ipx_detach(struct socket *so);
static int ipx_disconnect(struct socket *so);
static int ipx_send(struct socket *so, int flags, struct mbuf *m,
struct mbuf *addr, struct mbuf *control);
struct mbuf *addr, struct mbuf *control, struct proc *p);
static int ipx_shutdown(struct socket *so);
static int ripx_attach(struct socket *so, int proto);
static int ripx_attach(struct socket *so, int proto, struct proc *p);
struct pr_usrreqs ipx_usrreqs = {
ipx_usr_abort, pru_accept_notsupp, ipx_attach, ipx_bind,
@ -312,11 +313,12 @@ ipx_output(ipxp, m0)
/* ARGSUSED */
int
ipx_ctloutput(req, so, level, name, value)
ipx_ctloutput(req, so, level, name, value, p)
int req, level;
struct socket *so;
int name;
struct mbuf **value;
struct proc *p;
{
register struct mbuf *m;
struct ipxpcb *ipxp = sotoipxpcb(so);
@ -408,12 +410,12 @@ ipx_ctloutput(req, so, level, name, value)
break;
#ifdef IPXIP
case SO_IPXIP_ROUTE:
error = ipxip_route(so, *value);
error = ipxip_route(so, *value, p);
break;
#endif /* IPXIP */
#ifdef IPXTUNNEL
case SO_IPXTUNNEL_ROUTE
error = ipxtun_route(so, *value);
error = ipxtun_route(so, *value, p);
break;
#endif
default:
@ -442,9 +444,10 @@ ipx_usr_abort(so)
}
static int
ipx_attach(so, proto)
ipx_attach(so, proto, p)
struct socket *so;
int proto;
struct proc *p;
{
int error;
int s;
@ -453,7 +456,7 @@ ipx_attach(so, proto)
if (ipxp != NULL)
return (EINVAL);
s = splnet();
error = ipx_pcballoc(so, &ipxpcb);
error = ipx_pcballoc(so, &ipxpcb, p);
splx(s);
if (error == 0)
error = soreserve(so, ipxsendspace, ipxrecvspace);
@ -461,19 +464,21 @@ ipx_attach(so, proto)
}
static int
ipx_bind(so, nam)
ipx_bind(so, nam, p)
struct socket *so;
struct mbuf *nam;
struct proc *p;
{
struct ipxpcb *ipxp = sotoipxpcb(so);
return (ipx_pcbbind(ipxp, nam));
return (ipx_pcbbind(ipxp, nam, p));
}
static int
ipx_connect(so, nam)
ipx_connect(so, nam, p)
struct socket *so;
struct mbuf *nam;
struct proc *p;
{
int error;
int s;
@ -482,7 +487,7 @@ ipx_connect(so, nam)
if (!ipx_nullhost(ipxp->ipxp_faddr))
return (EISCONN);
s = splnet();
error = ipx_pcbconnect(ipxp, nam);
error = ipx_pcbconnect(ipxp, nam, p);
splx(s);
if (error == 0)
soisconnected(so);
@ -532,12 +537,13 @@ ipx_peeraddr(so, nam)
}
static int
ipx_send(so, flags, m, nam, control)
ipx_send(so, flags, m, nam, control, p)
struct socket *so;
int flags;
struct mbuf *m;
struct mbuf *nam;
struct mbuf *control;
struct proc *p;
{
int error;
struct ipxpcb *ipxp = sotoipxpcb(so);
@ -554,7 +560,7 @@ ipx_send(so, flags, m, nam, control)
* Must block input while temporarily connected.
*/
s = splnet();
error = ipx_pcbconnect(ipxp, nam);
error = ipx_pcbconnect(ipxp, nam, p);
if (error) {
splx(s);
goto send_release;
@ -600,18 +606,19 @@ ipx_sockaddr(so, nam)
}
static int
ripx_attach(so, proto)
ripx_attach(so, proto, p)
struct socket *so;
int proto;
struct proc *p;
{
int error = 0;
int s;
struct ipxpcb *ipxp = sotoipxpcb(so);
if (!(so->so_state & SS_PRIV) || (ipxp != NULL))
return (EINVAL);
if (p && (error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
s = splnet();
error = ipx_pcballoc(so, &ipxrawpcb);
error = ipx_pcballoc(so, &ipxrawpcb, p);
splx(s);
if (error)
return (error);

View File

@ -33,7 +33,7 @@
*
* @(#)spx.h
*
* $Id: spx.h,v 1.9 1997/02/22 09:41:58 peter Exp $
* $Id: spx.h,v 1.10 1997/04/05 20:05:10 jhay Exp $
*/
#ifndef _NETIPX_SPX_H_
@ -177,7 +177,7 @@ struct spxpcb *
spx_close __P((struct spxpcb *cb));
void spx_ctlinput __P((int cmd, struct sockaddr *arg_as_sa, void *dummy));
int spx_ctloutput __P((int req, struct socket *so, int level, int name,
struct mbuf **value));
struct mbuf **value, struct proc *p));
struct spxpcb *
spx_disconnect __P((struct spxpcb *cb));
struct spxpcb *

View File

@ -33,13 +33,14 @@
*
* @(#)spx_usrreq.h
*
* $Id: spx_usrreq.c,v 1.10 1997/02/22 09:42:00 peter Exp $
* $Id: spx_usrreq.c,v 1.11 1997/04/05 20:05:11 jhay Exp $
*/
#include <sys/param.h>
#include <sys/systm.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>
@ -74,18 +75,18 @@ u_short spx_iss;
static int spx_usr_abort(struct socket *so);
static int spx_accept(struct socket *so, struct mbuf *nam);
static int spx_attach(struct socket *so, int proto);
static int spx_bind(struct socket *so, struct mbuf *nam);
static int spx_connect(struct socket *so, struct mbuf *nam);
static int spx_attach(struct socket *so, int proto, struct proc *p);
static int spx_bind(struct socket *so, struct mbuf *nam, struct proc *p);
static int spx_connect(struct socket *so, struct mbuf *nam, struct proc *p);
static int spx_detach(struct socket *so);
static int spx_usr_disconnect(struct socket *so);
static int spx_listen(struct socket *so);
static int spx_listen(struct socket *so, struct proc *p);
static int spx_rcvd(struct socket *so, int flags);
static int spx_rcvoob(struct socket *so, struct mbuf *m, int flags);
static int spx_send(struct socket *so, int flags, struct mbuf *m,
struct mbuf *addr, struct mbuf *control);
struct mbuf *addr, struct mbuf *control, struct proc *p);
static int spx_shutdown(struct socket *so);
static int spx_sp_attach(struct socket *so, int proto);
static int spx_sp_attach(struct socket *so, int proto, struct proc *p);
struct pr_usrreqs spx_usrreqs = {
spx_usr_abort, spx_accept, spx_attach, spx_bind,
@ -210,7 +211,7 @@ spx_input(m, ipxp)
laddr = ipxp->ipxp_laddr;
if (ipx_nullhost(laddr))
ipxp->ipxp_laddr = si->si_dna;
if (ipx_pcbconnect(ipxp, am)) {
if (ipx_pcbconnect(ipxp, am, &proc0)) {
ipxp->ipxp_laddr = laddr;
(void) m_free(am);
spx_istat.noconn++;
@ -1173,11 +1174,12 @@ spx_setpersist(cb)
}
/*ARGSUSED*/
int
spx_ctloutput(req, so, level, name, value)
spx_ctloutput(req, so, level, name, value, p)
int req;
struct socket *so;
int level, name;
struct mbuf **value;
struct proc *p;
{
register struct mbuf *m;
struct ipxpcb *ipxp = sotoipxpcb(so);
@ -1187,7 +1189,7 @@ spx_ctloutput(req, so, level, name, value)
if (level != IPXPROTO_SPX) {
/* This will have to be changed when we do more general
stacking of protocols */
return (ipx_ctloutput(req, so, level, name, value));
return (ipx_ctloutput(req, so, level, name, value, p));
}
if (ipxp == NULL) {
error = EINVAL;
@ -1337,9 +1339,10 @@ spx_accept(so, nam)
}
static int
spx_attach(so, proto)
spx_attach(so, proto, p)
struct socket *so;
int proto;
struct proc *p;
{
int error;
int s;
@ -1354,7 +1357,7 @@ spx_attach(so, proto)
if (ipxp != NULL)
return (EISCONN);
s = splnet();
error = ipx_pcballoc(so, &ipxpcb);
error = ipx_pcballoc(so, &ipxpcb, p);
if (error)
goto spx_attach_end;
if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
@ -1403,15 +1406,16 @@ spx_attach(so, proto)
}
static int
spx_bind(so, nam)
spx_bind(so, nam, p)
struct socket *so;
struct mbuf *nam;
struct proc *p;
{
struct ipxpcb *ipxp;
ipxp = sotoipxpcb(so);
return (ipx_pcbbind(ipxp, nam));
return (ipx_pcbbind(ipxp, nam, p));
}
/*
@ -1421,9 +1425,10 @@ spx_bind(so, nam)
* Send initial system packet requesting connection.
*/
static int
spx_connect(so, nam)
spx_connect(so, nam, p)
struct socket *so;
struct mbuf *nam;
struct proc *p;
{
int error;
int s;
@ -1435,11 +1440,11 @@ spx_connect(so, nam)
s = splnet();
if (ipxp->ipxp_lport == 0) {
error = ipx_pcbbind(ipxp, (struct mbuf *)0);
error = ipx_pcbbind(ipxp, (struct mbuf *)0, p);
if (error)
goto spx_connect_end;
}
error = ipx_pcbconnect(ipxp, nam);
error = ipx_pcbconnect(ipxp, nam, p);
if (error)
goto spx_connect_end;
soisconnecting(so);
@ -1509,8 +1514,9 @@ spx_usr_disconnect(so)
}
static int
spx_listen(so)
spx_listen(so, p)
struct socket *so;
struct proc *p;
{
int error;
struct ipxpcb *ipxp;
@ -1521,7 +1527,7 @@ spx_listen(so)
cb = ipxtospxpcb(ipxp);
if (ipxp->ipxp_lport == 0)
error = ipx_pcbbind(ipxp, (struct mbuf *)0);
error = ipx_pcbbind(ipxp, (struct mbuf *)0, p);
if (error == 0)
cb->s_state = TCPS_LISTEN;
return (error);
@ -1573,12 +1579,13 @@ spx_rcvoob(so, m, flags)
}
static int
spx_send(so, flags, m, addr, controlp)
spx_send(so, flags, m, addr, controlp, p)
struct socket *so;
int flags;
struct mbuf *m;
struct mbuf *addr;
struct mbuf *controlp;
struct proc *p;
{
int error;
int s;
@ -1641,15 +1648,16 @@ spx_shutdown(so)
}
static int
spx_sp_attach(so, proto)
spx_sp_attach(so, proto, p)
struct socket *so;
int proto;
struct proc *p;
{
int error;
struct ipxpcb *ipxp;
struct spxpcb *cb;
error = spx_attach(so, proto);
error = spx_attach(so, proto, p);
if (error == 0) {
ipxp = sotoipxpcb(so);
((struct spxpcb *)ipxp->ipxp_pcb)->s_flags |=