summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c18
-rw-r--r--sys/net/if.h2
2 files changed, 18 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:
diff --git a/sys/net/if.h b/sys/net/if.h
index b73b46f..857ab7f 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -296,6 +296,7 @@ struct ifreq {
struct sockaddr ifru_broadaddr;
short ifru_flags[2];
short ifru_index;
+ int ifru_jid;
int ifru_metric;
int ifru_mtu;
int ifru_phys;
@@ -308,6 +309,7 @@ struct ifreq {
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
#define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */
#define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */
+#define ifr_jid ifr_ifru.ifru_jid /* jail/vnet */
#define ifr_metric ifr_ifru.ifru_metric /* metric */
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
#define ifr_phys ifr_ifru.ifru_phys /* physical wire */
OpenPOWER on IntegriCloud