Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F141180870
D40213.id122241.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D40213.id122241.diff
View Options
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -42,6 +42,9 @@
#include <sys/param.h>
#include <sys/ioctl.h>
+#ifdef JAIL
+#include <sys/jail.h>
+#endif
#include <sys/module.h>
#include <sys/linker.h>
#include <sys/nv.h>
@@ -184,12 +187,12 @@
}
fprintf(stderr,
- "usage: ifconfig [-f type:format] %sinterface address_family\n"
+ "usage: ifconfig [-j jail] [-f type:format] %sinterface address_family\n"
" [address [dest_address]] [parameters]\n"
- " ifconfig interface create\n"
- " ifconfig -a %s[-d] [-m] [-u] [-v] [address_family]\n"
- " ifconfig -l [-d] [-u] [address_family]\n"
- " ifconfig %s[-d] [-m] [-u] [-v]\n",
+ " ifconfig [-j jail] interface create\n"
+ " ifconfig [-j jail] -a %s[-d] [-m] [-u] [-v] [address_family]\n"
+ " ifconfig [-j jail] -l [-d] [-u] [address_family]\n"
+ " ifconfig [-j jail] %s[-d] [-m] [-u] [-v]\n",
options, options, options);
exit(1);
}
@@ -435,9 +438,11 @@
char options[1024];
struct option *p;
int c;
-
+#ifdef JAIL
+ int jid;
+#endif
/* Parse leading line options */
- strlcpy(options, "G:adf:klmnuv", sizeof(options));
+ strlcpy(options, "G:adf:j:klmnuv", sizeof(options));
for (p = opts; p != NULL; p = p->next)
strlcat(options, p->opt, sizeof(options));
while ((c = getopt(argc, argv, options)) != -1) {
@@ -458,6 +463,17 @@
usage();
args->nogroup = optarg;
break;
+ case 'j':
+#ifdef JAIL
+ if (optarg == NULL)
+ usage();
+ jid = jail_getid(optarg);
+ if (jid == -1)
+ Perror("jail not found");
+ if (jail_attach(jid) != 0)
+ Perror("cannot attach to jail");
+#endif
+ break;
case 'k':
args->printkeys = true;
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 3, 12:03 AM (18 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27465032
Default Alt Text
D40213.id122241.diff (1 KB)
Attached To
Mode
D40213: Teach ifconfig to attach and run itself in a jail.
Attached
Detach File
Event Timeline
Log In to Comment