diff options
author | Jamie Gritton <jamie@FreeBSD.org> | 2009-06-24 18:21:37 +0000 |
---|---|---|
committer | Jamie Gritton <jamie@FreeBSD.org> | 2009-06-24 18:21:37 +0000 |
commit | 5061de23fa8552cbbb923a6bb1affd5bcbaab533 (patch) | |
tree | 64fae747524b876a567b23c9085d45d1c3982f56 | |
parent | 29d08a6da6a931f205f59d7479407b60d230ae76 (diff) | |
download | src-test2-5061de23fa8552cbbb923a6bb1affd5bcbaab533.tar.gz src-test2-5061de23fa8552cbbb923a6bb1affd5bcbaab533.zip |
Notes
-rw-r--r-- | rescue/rescue/Makefile | 2 | ||||
-rw-r--r-- | sbin/ifconfig/Makefile | 4 | ||||
-rw-r--r-- | sbin/ifconfig/ifconfig.8 | 15 | ||||
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 31 |
4 files changed, 48 insertions, 4 deletions
diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile index c1400c488054..afb15b09404a 100644 --- a/rescue/rescue/Makefile +++ b/rescue/rescue/Makefile @@ -143,7 +143,7 @@ CRUNCH_LIBS+= -lipx .if ${MK_ZFS} != "no" CRUNCH_LIBS+= -lzfs -lnvpair -luutil -lavl .endif -CRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv -lmd -lreadline -lsbuf -lufs -lz +CRUNCH_LIBS+= -lgeom -lbsdxml -ljail -lkiconv -lmd -lreadline -lsbuf -lufs -lz .if ${MACHINE_ARCH} == "i386" CRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile index c97f14d66399..e5b78af3d837 100644 --- a/sbin/ifconfig/Makefile +++ b/sbin/ifconfig/Makefile @@ -27,8 +27,8 @@ SRCS+= ifgre.c # GRE keys etc SRCS+= ifgif.c # GIF reversed header workaround SRCS+= ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support -DPADD+= ${LIBBSDXML} ${LIBSBUF} -LDADD+= -lbsdxml -lsbuf +DPADD+= ${LIBBSDXML} ${LIBSBUF} ${LIBJAIL} +LDADD+= -lbsdxml -ljail -lsbuf SRCS+= ifcarp.c # SIOC[GS]VH support SRCS+= ifgroup.c # ... diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index d27bed873774..5f571f83973f 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd January 7, 2009 +.Dd June 24, 2009 .Dt IFCONFIG 8 .Os .Sh NAME @@ -417,6 +417,18 @@ If the driver offers user-configurable VLAN support, disable reception of extended frames, tag processing in hardware, or frame filtering in hardware, respectively. +.It Cm vnet Ar jail +Move the interface to the +.Xr jail 8 , +specified by name or JID. +If the jail has a virtual network stack, the interface will disappear +from the current environment and become visible to the jail. +.It Fl vnet Ar jail +Reclaim the interface from the +.Xr jail 8 , +specified by name or JID. +If the jail has a virtual network stack, the interface will disappear +from the jail, and become visible to the current network environment. .It Cm polling Turn on .Xr polling 4 @@ -2367,6 +2379,7 @@ tried to alter an interface's configuration. .\" .Xr eon 5 , .Xr rc 8 , .Xr routed 8 , +.Xr jail 8 , .Xr sysctl 8 .Sh HISTORY The diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index b90adf0d4e2e..12c64d6bacbe 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -67,6 +67,7 @@ static const char rcsid[] = #include <err.h> #include <errno.h> #include <fcntl.h> +#include <jail.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -629,6 +630,34 @@ deletetunnel(const char *vname, int param, int s, const struct afswtch *afp) } static void +setifvnet(const char *jname, int dummy __unused, int s, + const struct afswtch *afp) +{ + struct ifreq my_ifr; + + memcpy(&my_ifr, &ifr, sizeof(my_ifr)); + ifr.ifr_jid = jail_getid(jname); + if (ifr.ifr_jid < 0) + errx(1, "%s", jail_errmsg); + if (ioctl(s, SIOCSIFVNET, &ifr) < 0) + err(1, "SIOCSIFVNET"); +} + +static void +setifrvnet(const char *jname, int dummy __unused, int s, + const struct afswtch *afp) +{ + struct ifreq my_ifr; + + memcpy(&my_ifr, &ifr, sizeof(my_ifr)); + ifr.ifr_jid = jail_getid(jname); + if (ifr.ifr_jid < 0) + errx(1, "%s", jail_errmsg); + if (ioctl(s, SIOCSIFRVNET, &ifr) < 0) + err(1, "SIOCSIFRVNET"); +} + +static void setifnetmask(const char *addr, int dummy __unused, int s, const struct afswtch *afp) { @@ -1012,6 +1041,8 @@ static struct cmd basic_cmds[] = { DEF_CMD_ARG2("tunnel", settunnel), DEF_CMD("-tunnel", 0, deletetunnel), DEF_CMD("deletetunnel", 0, deletetunnel), + DEF_CMD_ARG("vnet", setifvnet), + DEF_CMD_ARG("-vnet", setifrvnet), DEF_CMD("link0", IFF_LINK0, setifflags), DEF_CMD("-link0", -IFF_LINK0, setifflags), DEF_CMD("link1", IFF_LINK1, setifflags), |