Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162630793
D52501.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D52501.diff
View Options
diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h
--- a/sbin/ifconfig/ifconfig.h
+++ b/sbin/ifconfig/ifconfig.h
@@ -249,7 +249,6 @@
const char *matchgroup; /* Group name to match */
const char *nogroup; /* Group name to exclude */
const struct afswtch *afp; /* AF we're operating on */
- const char *jail_name; /* Jail name or jail id specified */
};
struct option {
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -28,7 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd August 10, 2025
+.Dd September 12, 2025
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -36,7 +36,7 @@
.Nd configure network interface parameters
.Sh SYNOPSIS
.Nm
-.Op Fl j Ar jail
+.Op Fl j Ar jid
.Op Fl DkLmn
.Op Fl f Ar type Ns Cm \&: Ns Ar format
.Ar interface
@@ -50,11 +50,11 @@
.Oc
.Op Ar parameters
.Nm
-.Op Fl j Ar jail
+.Op Fl j Ar jid
.Ar interface
.Cm destroy
.Nm
-.Op Fl j Ar jail
+.Op Fl j Ar jid
.Fl a
.Op Fl dDkLmuv
.Op Fl f Ar type Ns Cm \&: Ns Ar format
@@ -64,16 +64,16 @@
.Nm
.Fl C
.Nm
-.Op Fl j Ar jail
+.Op Fl j Ar jid
.Fl g Ar groupname
.Nm
-.Op Fl j Ar jail
+.Op Fl j Ar jid
.Fl l
.Op Fl du
.Op Fl g Ar groupname
.Op Ar address_family
.Nm
-.Op Fl j Ar jail
+.Op Fl j Ar jid
.Op Fl dkLmuv
.Op Fl f Ar type Ns Cm \&: Ns Ar format
.Sh DESCRIPTION
@@ -257,22 +257,22 @@
to
.Cm all
selects all interfaces.
-.It Fl j Ar jail
-Perform the actions inside the
-.Ar jail .
+.It Fl j Ar jid
+Perform the actions inside the jail specified by
+.Ar jid ,
+which may be either a jail name or a numeric jail ID.
.Pp
The
-.Cm ifconfig
-will first attach to the
-.Ar jail
-(by jail id or jail name) before performing the effects.
-.Pp
-This allow network interfaces of
-.Ar jail
-to be configured even if the
-.Cm ifconfig
-binary is not available in
-.Ar jail .
+.Nm
+utility will attach to the specified jail immediately upon
+encountering the option on the command line.
+The option may be specified multiple times to attach to a nested jail
+(jail within a jail).
+.Pp
+This makes it possible to configure network interfaces within a vnet
+jail even if the
+.Nm
+binary is not available inside the jail.
.It Fl k
Print keying information for the
.Ar interface ,
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -463,6 +463,9 @@
{
char options[1024];
struct option *p;
+#ifdef JAIL
+ int jid;
+#endif
int c;
/* Parse leading line options */
@@ -494,7 +497,11 @@
#ifdef JAIL
if (optarg == NULL)
usage();
- args->jail_name = optarg;
+ jid = jail_getid(optarg);
+ if (jid == -1)
+ Perror("jail not found");
+ if (jail_attach(jid) != 0)
+ Perror("cannot attach to jail");
#else
Perror("not built with jail support");
#endif
@@ -611,9 +618,6 @@
{
char *envformat;
int flags;
-#ifdef JAIL
- int jid;
-#endif
struct ifconfig_args _args = {};
struct ifconfig_args *args = &_args;
@@ -638,16 +642,6 @@
args_parse(args, ac, av);
-#ifdef JAIL
- if (args->jail_name) {
- jid = jail_getid(args->jail_name);
- if (jid == -1)
- Perror("jail not found");
- if (jail_attach(jid) != 0)
- Perror("cannot attach to jail");
- }
-#endif
-
if (!args->all && !args->namesonly) {
/* not listing, need an argument */
args->ifname = args_pop(args);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 16, 6:43 AM (5 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35126819
Default Alt Text
D52501.diff (3 KB)
Attached To
Mode
D52501: ifconfig: Enter jail as soon as possible
Attached
Detach File
Event Timeline
Log In to Comment