version 1.88.6.1, 2006/06/01 22:38:47 |
version 1.94.4.2, 2007/03/12 05:59:38 |
Line 157 rip_input(struct mbuf *m, ...) |
|
Line 157 rip_input(struct mbuf *m, ...) |
|
ripsrc.sin_len = sizeof(struct sockaddr_in); |
ripsrc.sin_len = sizeof(struct sockaddr_in); |
ripsrc.sin_addr = ip->ip_src; |
ripsrc.sin_addr = ip->ip_src; |
ripsrc.sin_port = 0; |
ripsrc.sin_port = 0; |
bzero((caddr_t)ripsrc.sin_zero, sizeof(ripsrc.sin_zero)); |
bzero((void *)ripsrc.sin_zero, sizeof(ripsrc.sin_zero)); |
|
|
/* |
/* |
* XXX Compatibility: programs using raw IP expect ip_len |
* XXX Compatibility: programs using raw IP expect ip_len |
Line 266 rip_pcbnotify(struct inpcbtable *table, |
|
Line 266 rip_pcbnotify(struct inpcbtable *table, |
|
} |
} |
|
|
void * |
void * |
rip_ctlinput(int cmd, struct sockaddr *sa, void *v) |
rip_ctlinput(int cmd, const struct sockaddr *sa, void *v) |
{ |
{ |
struct ip *ip = v; |
struct ip *ip = v; |
void (*notify)(struct inpcb *, int) = in_rtchange; |
void (*notify)(struct inpcb *, int) = in_rtchange; |
Line 285 rip_ctlinput(int cmd, struct sockaddr *s |
|
Line 285 rip_ctlinput(int cmd, struct sockaddr *s |
|
else if (errno == 0) |
else if (errno == 0) |
return NULL; |
return NULL; |
if (ip) { |
if (ip) { |
rip_pcbnotify(&rawcbtable, satosin(sa)->sin_addr, |
rip_pcbnotify(&rawcbtable, satocsin(sa)->sin_addr, |
ip->ip_src, ip->ip_p, errno, notify); |
ip->ip_src, ip->ip_p, errno, notify); |
|
|
/* XXX mapped address case */ |
/* XXX mapped address case */ |
} else |
} else |
in_pcbnotifyall(&rawcbtable, satosin(sa)->sin_addr, errno, |
in_pcbnotifyall(&rawcbtable, satocsin(sa)->sin_addr, errno, |
notify); |
notify); |
return NULL; |
return NULL; |
} |
} |
Line 506 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, (void *)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 543 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 = kauth_authorize_generic(p->p_cred, |
|
KAUTH_GENERIC_ISSUSER, &p->p_acflag))) { |
if (l == NULL) { |
error = EACCES; |
error = EACCES; |
break; |
break; |
} |
} |
|
|
|
/* XXX: raw socket permissions are checked in socreate() */ |
|
|
if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { |
if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { |
error = soreserve(so, rip_sendspace, rip_recvspace); |
error = soreserve(so, rip_sendspace, rip_recvspace); |
if (error) |
if (error) |