summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in.c
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1997-04-27 20:01:29 +0000
committerwollman <wollman@FreeBSD.org>1997-04-27 20:01:29 +0000
commit6afbf203bd570424ecf3f9d9d9ced17f82c81adc (patch)
tree41103dcf8addc8e73880fc79975713ce1e6ba14c /sys/netinet/in.c
parentced78602fea5284de7f4cb1673405ad3f3ad57ce (diff)
downloadFreeBSD-src-6afbf203bd570424ecf3f9d9d9ced17f82c81adc.zip
FreeBSD-src-6afbf203bd570424ecf3f9d9d9ced17f82c81adc.tar.gz
The long-awaited mega-massive-network-code- cleanup. Part I.
This commit includes the following changes: 1) Old-style (pr_usrreq()) protocols are no longer supported, the compatibility glue for them is deleted, and the kernel will panic on boot if any are compiled in. 2) Certain protocol entry points are modified to take a process structure, so they they can easily tell whether or not it is possible to sleep, and also to access credentials. 3) SS_PRIV is no more, and with it goes the SO_PRIVSTATE setsockopt() call. Protocols should use the process pointer they are now passed. 4) The PF_LOCAL and PF_ROUTE families have been updated to use the new style, as has the `raw' skeleton family. 5) PF_LOCAL sockets now obey the process's umask when creating a socket in the filesystem. As a result, LINT is now broken. I'm hoping that some enterprising hacker with a bit more time will either make the broken bits work (should be easy for netipx) or dike them out.
Diffstat (limited to 'sys/netinet/in.c')
-rw-r--r--sys/netinet/in.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 17e8a88..4586c22 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in.c 8.4 (Berkeley) 1/9/95
- * $Id: in.c,v 1.32 1997/02/22 09:41:27 peter Exp $
+ * $Id: in.c,v 1.33 1997/03/24 11:33:25 bde Exp $
*/
#include <sys/param.h>
@@ -40,6 +40,7 @@
#include <sys/sockio.h>
#include <sys/errno.h>
#include <sys/malloc.h>
+#include <sys/proc.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/kernel.h>
@@ -140,11 +141,12 @@ static int in_interfaces; /* number of external internet interfaces */
*/
/* ARGSUSED */
int
-in_control(so, cmd, data, ifp)
+in_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 in_ifaddr *ia = 0, *iap;
@@ -200,8 +202,8 @@ in_control(so, cmd, data, ifp)
case SIOCSIFADDR:
case SIOCSIFNETMASK:
case SIOCSIFDSTADDR:
- if ((so->so_state & SS_PRIV) == 0)
- return (EPERM);
+ if (p && (error = suser(p->p_ucred, &p->p_acflag)) != 0)
+ return error;
if (ifp == 0)
panic("in_control");
@@ -237,8 +239,8 @@ in_control(so, cmd, data, ifp)
break;
case SIOCSIFBRDADDR:
- if ((so->so_state & SS_PRIV) == 0)
- return (EPERM);
+ if (p && (error = suser(p->p_ucred, &p->p_acflag)) != 0)
+ return error;
/* FALLTHROUGH */
case SIOCGIFADDR:
OpenPOWER on IntegriCloud