summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorzec <zec@FreeBSD.org>2008-11-26 22:32:07 +0000
committerzec <zec@FreeBSD.org>2008-11-26 22:32:07 +0000
commit95a15f5c8435d206ae030c1ed698f4fca6afdeae (patch)
tree92dfba43d59635c80de0299501512e8472dbe130 /sys/net
parent7beb3e535d23cc0fe9278167a9c3dc67220250fd (diff)
downloadFreeBSD-src-95a15f5c8435d206ae030c1ed698f4fca6afdeae.zip
FreeBSD-src-95a15f5c8435d206ae030c1ed698f4fca6afdeae.tar.gz
Merge more of currently non-functional (i.e. resolving to
whitespace) macros from p4/vimage branch. Do a better job at enclosing all instantiations of globals scheduled for virtualization in #ifdef VIMAGE_GLOBALS blocks. De-virtualize and mark as const saorder_state_alive and saorder_state_any arrays from ipsec code, given that they are never updated at runtime, so virtualizing them would be pointless. Reviewed by: bz, julian Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bpf.c7
-rw-r--r--sys/net/if.c1
-rw-r--r--sys/net/if_loop.c4
-rw-r--r--sys/net/route.c1
4 files changed, 12 insertions, 1 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 6eb58f7..3a7ec7f 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sockio.h>
#include <sys/ttycom.h>
#include <sys/uio.h>
+#include <sys/vimage.h>
#include <sys/event.h>
#include <sys/file.h>
@@ -566,7 +567,9 @@ bpf_detachd(struct bpf_d *d)
*/
if (d->bd_promisc) {
d->bd_promisc = 0;
+ CURVNET_SET(ifp->if_vnet);
error = ifpromisc(ifp, 0);
+ CURVNET_RESTORE();
if (error != 0 && error != ENXIO) {
/*
* ENXIO can happen if a pccard is unplugged
@@ -872,7 +875,9 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag)
#ifdef MAC
BPFD_LOCK(d);
+ CURVNET_SET(ifp->if_vnet);
mac_bpfdesc_create_mbuf(d, m);
+ CURVNET_RESTORE();
if (mc != NULL)
mac_bpfdesc_create_mbuf(d, mc);
BPFD_UNLOCK(d);
@@ -993,6 +998,7 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
return (EPERM);
}
}
+ CURVNET_SET(TD_TO_VNET(td));
switch (cmd) {
default:
@@ -1322,6 +1328,7 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
case BIOCROTZBUF:
return (bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr));
}
+ CURVNET_RESTORE();
return (error);
}
diff --git a/sys/net/if.c b/sys/net/if.c
index 02ad6c6..203a75f 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -192,7 +192,6 @@ ifnet_setbyindex(u_short idx, struct ifnet *ifp)
struct ifaddr *
ifaddr_byindex(u_short idx)
{
- INIT_VNET_NET(curvnet);
struct ifaddr *ifa;
IFNET_RLOCK();
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index ba49d76..ab5bda7 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -105,6 +105,9 @@ IFC_SIMPLE_DECLARE(lo, 1);
static void
lo_clone_destroy(struct ifnet *ifp)
{
+#ifdef INVARIANTS
+ INIT_VNET_NET(ifp->if_vnet);
+#endif
/* XXX: destroying lo0 will lead to panics. */
KASSERT(V_loif != ifp, ("%s: destroying lo0", __func__));
@@ -141,6 +144,7 @@ lo_clone_create(struct if_clone *ifc, int unit, caddr_t params)
static int
loop_modevent(module_t mod, int type, void *data)
{
+ INIT_VNET_NET(curvnet);
switch (type) {
case MOD_LOAD:
diff --git a/sys/net/route.c b/sys/net/route.c
index de45ff8..f97c077 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -145,6 +145,7 @@ SYSCTL_PROC(_net, OID_AUTO, my_fibnum, CTLTYPE_INT|CTLFLAG_RD,
static void
route_init(void)
{
+ INIT_VNET_INET(curvnet);
int table;
struct domain *dom;
int fam;
OpenPOWER on IntegriCloud