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.88.8.3 retrieving revision 1.95 diff -u -p -r1.88.8.3 -r1.95 --- src/sys/netinet/raw_ip.c 2006/09/14 12:31:55 1.88.8.3 +++ src/sys/netinet/raw_ip.c 2007/02/17 22:34:12 1.95 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_ip.c,v 1.88.8.3 2006/09/14 12:31:55 yamt Exp $ */ +/* $NetBSD: raw_ip.c,v 1.95 2007/02/17 22:34:12 dyoung Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.88.8.3 2006/09/14 12:31:55 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.95 2007/02/17 22:34:12 dyoung Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -266,7 +266,7 @@ rip_pcbnotify(struct inpcbtable *table, } void * -rip_ctlinput(int cmd, struct sockaddr *sa, void *v) +rip_ctlinput(int cmd, const struct sockaddr *sa, void *v) { struct ip *ip = v; void (*notify)(struct inpcb *, int) = in_rtchange; @@ -285,12 +285,12 @@ rip_ctlinput(int cmd, struct sockaddr *s else if (errno == 0) return NULL; if (ip) { - rip_pcbnotify(&rawcbtable, satosin(sa)->sin_addr, + rip_pcbnotify(&rawcbtable, satocsin(sa)->sin_addr, ip->ip_src, ip->ip_p, errno, notify); /* XXX mapped address case */ } else - in_pcbnotifyall(&rawcbtable, satosin(sa)->sin_addr, errno, + in_pcbnotifyall(&rawcbtable, satocsin(sa)->sin_addr, errno, notify); return NULL; } @@ -516,14 +516,16 @@ rip_usrreq(struct socket *so, int req, return (in_control(so, (long)m, (caddr_t)nam, (struct ifnet *)control, l)); + s = splsoftnet(); + if (req == PRU_PURGEIF) { in_pcbpurgeif0(&rawcbtable, (struct ifnet *)control); in_purgeif((struct ifnet *)control); in_pcbpurgeif(&rawcbtable, (struct ifnet *)control); + splx(s); return (0); } - s = splsoftnet(); inp = sotoinpcb(so); #ifdef DIAGNOSTIC if (req != PRU_SEND && req != PRU_SENDOOB && control) @@ -541,13 +543,14 @@ rip_usrreq(struct socket *so, int req, error = EISCONN; break; } - if (l == 0 || (error = kauth_authorize_network(l->l_cred, - KAUTH_NETWORK_SOCKET, - (void *)KAUTH_REQ_NETWORK_SOCKET_RAWSOCK, so, NULL, - NULL))) { + + if (l == NULL) { error = EACCES; break; } + + /* XXX: raw socket permissions are checked in socreate() */ + if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { error = soreserve(so, rip_sendspace, rip_recvspace); if (error)