summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorjamie <jamie@FreeBSD.org>2009-06-15 18:59:29 +0000
committerjamie <jamie@FreeBSD.org>2009-06-15 18:59:29 +0000
commit5675a54fb1a409499766ce55a009367c043fdc28 (patch)
treeda42c35580b92c97206bed1ad724ceb513e4c024 /sys/net/if.c
parentbaa4ed1428ed6b464714b55aadcbc3a97c2887c7 (diff)
downloadFreeBSD-src-5675a54fb1a409499766ce55a009367c043fdc28.zip
FreeBSD-src-5675a54fb1a409499766ce55a009367c043fdc28.tar.gz
Manage vnets via the jail system. If a jail is given the boolean
parameter "vnet" when it is created, a new vnet instance will be created along with the jail. Networks interfaces can be moved between prisons with an ioctl similar to the one that moves them between vimages. For now vnets will co-exist under both jails and vimages, but soon struct vimage will be going away. Reviewed by: zec, julian Approved by: bz (mentor)
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index baf6939..2679be3 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2127,6 +2127,15 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
break;
+#ifdef VIMAGE
+ case SIOCSIFVNET:
+ error = priv_check(td, PRIV_NET_SETIFVNET);
+ if (error)
+ return (error);
+ error = vi_if_move(td, ifp, ifr->ifr_name, ifr->ifr_jid, NULL);
+ break;
+#endif
+
case SIOCSIFMETRIC:
error = priv_check(td, PRIV_NET_SETIFMETRIC);
if (error)
@@ -2313,14 +2322,19 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td)
switch (cmd) {
#ifdef VIMAGE
+ case SIOCSIFRVNET:
+ error = priv_check(td, PRIV_NET_SETIFVNET);
+ if (error)
+ return (error);
+ return (vi_if_move(td, NULL, ifr->ifr_name, ifr->ifr_jid,
+ NULL));
/*
* XXX vnet creation will be implemented through the new jail
* framework - this is just a temporary hack for testing the
* vnet create / destroy mechanisms.
*/
case SIOCSIFVIMAGE:
- error = vi_if_move((struct vi_req *) data, NULL,
- TD_TO_VIMAGE(td));
+ error = vi_if_move(td, NULL, NULL, 0, (struct vi_req *) data);
return (error);
case SIOCSPVIMAGE:
case SIOCGPVIMAGE:
OpenPOWER on IntegriCloud