version 1.88.4.1, 2006/02/05 03:03:09 |
version 1.93, 2006/10/05 17:35:19 |
Line 77 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 77 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#include <sys/errno.h> |
#include <sys/errno.h> |
#include <sys/systm.h> |
#include <sys/systm.h> |
#include <sys/proc.h> |
#include <sys/proc.h> |
|
#include <sys/kauth.h> |
|
|
#include <net/if.h> |
#include <net/if.h> |
#include <net/route.h> |
#include <net/route.h> |
Line 140 rip_input(struct mbuf *m, ...) |
|
Line 141 rip_input(struct mbuf *m, ...) |
|
{ |
{ |
int proto; |
int proto; |
struct ip *ip = mtod(m, struct ip *); |
struct ip *ip = mtod(m, struct ip *); |
|
struct inpcb_hdr *inph; |
struct inpcb *inp; |
struct inpcb *inp; |
struct inpcb *last = 0; |
struct inpcb *last = 0; |
struct mbuf *opts = 0; |
struct mbuf *opts = 0; |
Line 165 rip_input(struct mbuf *m, ...) |
|
Line 167 rip_input(struct mbuf *m, ...) |
|
ip->ip_len = ntohs(ip->ip_len) - (ip->ip_hl << 2); |
ip->ip_len = ntohs(ip->ip_len) - (ip->ip_hl << 2); |
NTOHS(ip->ip_off); |
NTOHS(ip->ip_off); |
|
|
CIRCLEQ_FOREACH(inp, &rawcbtable.inpt_queue, inp_queue) { |
CIRCLEQ_FOREACH(inph, &rawcbtable.inpt_queue, inph_queue) { |
|
inp = (struct inpcb *)inph; |
if (inp->inp_af != AF_INET) |
if (inp->inp_af != AF_INET) |
continue; |
continue; |
if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != proto) |
if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != proto) |
Line 503 rip_usrreq(struct socket *so, int req, |
|
Line 506 rip_usrreq(struct socket *so, int req, |
|
struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) |
struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) |
{ |
{ |
struct inpcb *inp; |
struct inpcb *inp; |
struct proc *p; |
|
int s; |
int s; |
int error = 0; |
int error = 0; |
#ifdef MROUTING |
#ifdef MROUTING |
extern struct socket *ip_mrouter; |
extern struct socket *ip_mrouter; |
#endif |
#endif |
|
|
p = l ? l->l_proc : NULL; |
|
if (req == PRU_CONTROL) |
if (req == PRU_CONTROL) |
return (in_control(so, (long)m, (caddr_t)nam, |
return (in_control(so, (long)m, (caddr_t)nam, |
(struct ifnet *)control, p)); |
(struct ifnet *)control, l)); |
|
|
|
s = splsoftnet(); |
|
|
if (req == PRU_PURGEIF) { |
if (req == PRU_PURGEIF) { |
in_pcbpurgeif0(&rawcbtable, (struct ifnet *)control); |
in_pcbpurgeif0(&rawcbtable, (struct ifnet *)control); |
in_purgeif((struct ifnet *)control); |
in_purgeif((struct ifnet *)control); |
in_pcbpurgeif(&rawcbtable, (struct ifnet *)control); |
in_pcbpurgeif(&rawcbtable, (struct ifnet *)control); |
|
splx(s); |
return (0); |
return (0); |
} |
} |
|
|
s = splsoftnet(); |
|
inp = sotoinpcb(so); |
inp = sotoinpcb(so); |
#ifdef DIAGNOSTIC |
#ifdef DIAGNOSTIC |
if (req != PRU_SEND && req != PRU_SENDOOB && control) |
if (req != PRU_SEND && req != PRU_SENDOOB && control) |
Line 540 rip_usrreq(struct socket *so, int req, |
|
Line 543 rip_usrreq(struct socket *so, int req, |
|
error = EISCONN; |
error = EISCONN; |
break; |
break; |
} |
} |
if (p == 0 || (error = suser(p->p_ucred, &p->p_acflag))) { |
if (l == 0 || (error = kauth_authorize_network(l->l_cred, |
|
KAUTH_NETWORK_SOCKET, |
|
KAUTH_REQ_NETWORK_SOCKET_RAWSOCK, so, NULL, |
|
NULL))) { |
error = EACCES; |
error = EACCES; |
break; |
break; |
} |
} |