summaryrefslogtreecommitdiffstats
path: root/sys/net/if_loop.c
diff options
context:
space:
mode:
authorzec <zec@FreeBSD.org>2009-05-23 21:43:44 +0000
committerzec <zec@FreeBSD.org>2009-05-23 21:43:44 +0000
commit48f748dc297cbf46f02ec8b61d47436d66d0d8b9 (patch)
tree488633605f2f07bbba417ff74314596b3bb04cf2 /sys/net/if_loop.c
parent40574d258ab1aec7b8c5ad9d5d9ee09d5e3f5296 (diff)
downloadFreeBSD-src-48f748dc297cbf46f02ec8b61d47436d66d0d8b9.zip
FreeBSD-src-48f748dc297cbf46f02ec8b61d47436d66d0d8b9.tar.gz
V_irtualize the if_clone framework, thus allowing for clonable ifnets
to optionally have overlapping unit numbers if attached in different vnets. At this stage if_loop is the only clonable ifnet class that has been extended to allow for such overlapping allocation of unit numbers, i.e. in each vnet it is possible to have a lo0 interface. Other clonable ifnet classes remain to operate with traditional semantics, i.e. each instance of a clonable ifnet will be assigned a globally unique unit number, regardless in which vnet such an ifnet becomes instantiated. While here, garbage collect unused _lo_list field in struct vnet_net, as well as improve indentation for #defines in sys/net/vnet.h. The layout of struct vnet_net has changed, therefore bump __FreeBSD_version. This change has no functional impact on nooptions VIMAGE kernel builds. Reviewed by: bz, brooks Approved by: julian (mentor)
Diffstat (limited to 'sys/net/if_loop.c')
-rw-r--r--sys/net/if_loop.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index 3319ed8..cc9251b 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -111,9 +111,14 @@ static int vnet_loif_iattach(const void *);
struct ifnet *loif; /* Used externally */
#endif
+#ifdef VIMAGE
+MALLOC_DEFINE(M_LO_CLONER, "lo_cloner", "lo_cloner");
+#endif
+
#ifndef VIMAGE_GLOBALS
static const vnet_modinfo_t vnet_loif_modinfo = {
.vmi_id = VNET_MOD_LOIF,
+ .vmi_dependson = VNET_MOD_IF_CLONE,
.vmi_name = "loif",
.vmi_iattach = vnet_loif_iattach
};
@@ -167,7 +172,15 @@ static int vnet_loif_iattach(const void *unused __unused)
INIT_VNET_NET(curvnet);
V_loif = NULL;
+
+#ifdef VIMAGE
+ V_lo_cloner = malloc(sizeof(*V_lo_cloner), M_LO_CLONER,
+ M_WAITOK | M_ZERO);
+ bcopy(&lo_cloner, V_lo_cloner, sizeof(*V_lo_cloner));
+ if_clone_attach(V_lo_cloner);
+#else
if_clone_attach(&lo_cloner);
+#endif
return (0);
}
OpenPOWER on IntegriCloud