aboutsummaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2002-07-31 16:16:03 +0000
committerRobert Watson <rwatson@FreeBSD.org>2002-07-31 16:16:03 +0000
commite70cd263665d5f635f8926dca025d448392edb67 (patch)
tree5c4dc5b26b9646131455f0ea9494cd21638f9b10 /sys/net
parentdb9b8e5474abcda98618fd059b7c8c4dc6bd6585 (diff)
downloadsrc-e70cd263665d5f635f8926dca025d448392edb67.tar.gz
src-e70cd263665d5f635f8926dca025d448392edb67.zip
Introduce support for Mandatory Access Control and extensible
kernel access control. Instrument the interface management code so that MAC labels are properly maintained on network interfaces (struct ifnet). In particular, invoke entry points when interfaces are created and removed. MAC policies may initialized the label interface based on a variety of factors, including the interface name. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
Notes
Notes: svn path=/head/; revision=101079
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index d737bb2c9d46..e34aecc21886 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -37,9 +37,11 @@
#include "opt_compat.h"
#include "opt_inet6.h"
#include "opt_inet.h"
+#include "opt_mac.h"
#include <sys/param.h>
#include <sys/conf.h>
+#include <sys/mac.h>
#include <sys/malloc.h>
#include <sys/bus.h>
#include <sys/mbuf.h>
@@ -386,6 +388,12 @@ if_attach(ifp)
TAILQ_INIT(&ifp->if_multiaddrs);
SLIST_INIT(&ifp->if_klist);
getmicrotime(&ifp->if_lastchange);
+
+#ifdef MAC
+ mac_init_ifnet(ifp);
+ mac_create_ifnet(ifp);
+#endif
+
ifp->if_index = if_findindex(ifp);
if (ifp->if_index > if_index)
if_index = ifp->if_index;
@@ -522,6 +530,9 @@ if_detach(ifp)
/* Announce that the interface is gone. */
rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
+#ifdef MAC
+ mac_destroy_ifnet(ifp);
+#endif /* MAC */
KNOTE(&ifp->if_klist, NOTE_EXIT);
TAILQ_REMOVE(&ifnet, ifp, if_link);
mtx_destroy(&ifp->if_snd.ifq_mtx);