Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet/raw_ip.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/netinet/raw_ip.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.22 retrieving revision 1.26 diff -u -p -r1.22 -r1.26 --- src/sys/netinet/raw_ip.c 1995/11/30 16:42:18 1.22 +++ src/sys/netinet/raw_ip.c 1996/05/22 13:55:31 1.26 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_ip.c,v 1.22 1995/11/30 16:42:18 pk Exp $ */ +/* $NetBSD: raw_ip.c,v 1.26 1996/05/22 13:55:31 mycroft Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1993 @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -53,6 +54,9 @@ #include #include #include +#include + +#include struct inpcbtable rawcbtable; @@ -73,7 +77,7 @@ void rip_init() { - in_pcbinit(&rawcbtable); + in_pcbinit(&rawcbtable, 1); } struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; @@ -83,8 +87,13 @@ struct sockaddr_in ripsrc = { sizeof(rip * mbuf chain. */ void -rip_input(m) +#if __STDC__ +rip_input(struct mbuf *m, ...) +#else +rip_input(m, va_alist) struct mbuf *m; + va_dcl +#endif { register struct ip *ip = mtod(m, struct ip *); register struct inpcb *inp; @@ -104,7 +113,7 @@ rip_input(m) continue; if (last) { struct mbuf *n; - if (n = m_copy(m, 0, (int)M_COPYALL)) { + if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { if (sbappendaddr(&last->so_rcv, sintosa(&ripsrc), n, (struct mbuf *)0) == 0) @@ -134,15 +143,29 @@ rip_input(m) * Tack on options user may have setup with control call. */ int -rip_output(m, so, dst) - register struct mbuf *m; +#if __STDC__ +rip_output(struct mbuf *m, ...) +#else +rip_output(m, va_alist) + struct mbuf *m; + va_dcl +#endif +{ struct socket *so; u_long dst; -{ register struct ip *ip; - register struct inpcb *inp = sotoinpcb(so); + register struct inpcb *inp; struct mbuf *opts; - int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST; + int flags; + va_list ap; + + va_start(ap, m); + so = va_arg(ap, struct socket *); + dst = va_arg(ap, u_long); + va_end(ap); + + inp = sotoinpcb(so); + flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST; /* * If the user handed us a complete IP packet, use it. @@ -182,7 +205,9 @@ rip_ctloutput(op, so, level, optname, m) struct mbuf **m; { register struct inpcb *inp = sotoinpcb(so); - register int error; +#ifdef MROUTING + int error; +#endif if (level != IPPROTO_IP) { if (m != 0 && *m != 0) @@ -245,10 +270,11 @@ u_long rip_recvspace = RIPRCVQ; /*ARGSUSED*/ int -rip_usrreq(so, req, m, nam, control) +rip_usrreq(so, req, m, nam, control, p) register struct socket *so; int req; struct mbuf *m, *nam, *control; + struct proc *p; { register int error = 0; register struct inpcb *inp = sotoinpcb(so); @@ -257,7 +283,7 @@ rip_usrreq(so, req, m, nam, control) #endif if (req == PRU_CONTROL) return (in_control(so, (long)m, (caddr_t)nam, - (struct ifnet *)control)); + (struct ifnet *)control, p)); if (inp == NULL && req != PRU_ATTACH) { error = EINVAL; @@ -269,7 +295,7 @@ rip_usrreq(so, req, m, nam, control) case PRU_ATTACH: if (inp) panic("rip_attach"); - if ((so->so_state & SS_PRIV) == 0) { + if (p == 0 || (error = suser(p->p_ucred, &p->p_acflag))) { error = EACCES; break; }