Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162226945
D42721.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D42721.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
@@ -231,6 +231,7 @@
bool supmedia; /* Supported media */
bool printkeys; /* Print security keys */
bool allfamilies; /* Print all families */
+ bool drivername; /* Print driver name */
int verbose; /* verbosity level */
int argc;
char **argv;
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -34,7 +34,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl j Ar jail
-.Op Fl kLmn
+.Op Fl DkLmn
.Op Fl f Ar type Ns Cm \&: Ns Ar format
.Ar interface
.Op Cm create
@@ -53,7 +53,7 @@
.Nm
.Op Fl j Ar jail
.Fl a
-.Op Fl dkLmuv
+.Op Fl dDkLmuv
.Op Fl f Ar type Ns Cm \&: Ns Ar format
.Op Fl G Ar groupname
.Op Fl g Ar groupname
@@ -102,6 +102,12 @@
Use of this flag is mutually exclusive with all other flags and commands.
.It Fl d
Display only the interfaces that are down.
+.It Fl D
+Include the driver name and unit number of the interface in the output.
+This is normally the original name of the interface,
+even if it has been renamed; it may differ from the original name
+in some cases, such as
+.Xr epair 4 .
.It Fl f Xo
.Ar type Ns Cm \&: Ns Ar format Ns
.Op Cm \&, Ns Ar type Ns Cm \&: Ns Ar format Ar ...
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -456,7 +456,7 @@
int c;
/* Parse leading line options */
- strlcpy(options, "G:adf:j:klmnuv", sizeof(options));
+ strlcpy(options, "G:adDf: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) {
@@ -467,6 +467,9 @@
case 'd': /* restrict scan to "down" interfaces */
args->downonly = true;
break;
+ case 'D': /* Print driver name */
+ args->drivername = true;
+ break;
case 'f':
if (optarg == NULL)
usage();
diff --git a/sbin/ifconfig/ifconfig_netlink.c b/sbin/ifconfig/ifconfig_netlink.c
--- a/sbin/ifconfig/ifconfig_netlink.c
+++ b/sbin/ifconfig/ifconfig_netlink.c
@@ -388,6 +388,7 @@
{
if_link_t *link = &iface->link;
struct ifconfig_args *args = ctx->args;
+ char *drivername = NULL;
printf("%s: ", link->ifla_ifname);
@@ -432,6 +433,22 @@
args->afp->af_other_status(ctx);
print_ifstatus(ctx);
+ if (args->drivername || args->verbose) {
+ if (ifconfig_get_orig_name(lifh, link->ifla_ifname,
+ &drivername) != 0) {
+ if (ifconfig_err_errtype(lifh) == OTHER)
+ fprintf(stderr, "get original name: %s\n",
+ strerror(ifconfig_err_errno(lifh)));
+ else
+ fprintf(stderr,
+ "get original name: error type %d\n",
+ ifconfig_err_errtype(lifh));
+ exit_code = 1;
+ }
+ if (drivername != NULL)
+ printf("\tdrivername: %s\n", drivername);
+ free(drivername);
+ }
if (args->verbose > 0)
sfp_status(ctx);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jul 12, 2:14 AM (9 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34983615
Default Alt Text
D42721.diff (2 KB)
Attached To
Mode
D42721: ifconfig: add -D option to print driver name for interface
Attached
Detach File
Event Timeline
Log In to Comment