Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F169170723
D59060.id184616.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
D59060.id184616.diff
View Options
diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile
--- a/sbin/ifconfig/Makefile
+++ b/sbin/ifconfig/Makefile
@@ -43,6 +43,10 @@
LIBADD+= 80211
.endif
+.if ${MK_USB} != "no"
+SRCS+= ifue.c
+.endif
+
SRCS+= carp.c # SIOC[GS]VH support
SRCS+= ifgroup.c # ...
.if ${MK_PF} != "no"
diff --git a/sbin/ifconfig/ifue.c b/sbin/ifconfig/ifue.c
new file mode 100644
--- /dev/null
+++ b/sbin/ifconfig/ifue.c
@@ -0,0 +1,70 @@
+/*-
+ * Copyright (c) 2026 The FreeBSD Foundation
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * This software was developed by Li-Wen Hsu <lwhsu@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+
+#include <net/if.h>
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "ifconfig.h"
+
+#define UE_DRIVER_NAME "ue"
+
+static void
+ue_status(if_ctx *ctx)
+{
+ char mibname[32]; /* "net.ue.<unit>.%parent" */
+ char parent[IFNAMSIZ];
+ char *drivername;
+ const char *unit;
+ size_t parentlen;
+
+ /* Use the orig name so it keeps working after interface renaming. */
+ if (ifconfig_get_orig_name(lifh, ctx->ifname, &drivername) != 0)
+ return;
+ unit = drivername + sizeof(UE_DRIVER_NAME) - 1;
+ if (strncmp(drivername, UE_DRIVER_NAME,
+ sizeof(UE_DRIVER_NAME) - 1) != 0 || unit[0] == '\0')
+ goto out;
+ for (const char *p = unit; *p != '\0'; p++) {
+ if (!isdigit((unsigned char)*p))
+ goto out;
+ }
+
+ if (snprintf(mibname, sizeof(mibname), "net.%s.%s.%%parent",
+ UE_DRIVER_NAME, unit) >= (int)sizeof(mibname))
+ goto out;
+
+ parentlen = sizeof(parent);
+ if (sysctlbyname(mibname, parent, &parentlen, NULL, 0) != 0)
+ goto out;
+ parent[sizeof(parent) - 1] = '\0';
+
+ printf("\tparent interface: %s\n", parent);
+out:
+ free(drivername);
+}
+
+static struct afswtch af_ue = {
+ .af_name = "af_ue",
+ .af_af = AF_UNSPEC,
+ .af_other_status = ue_status,
+};
+
+static __constructor void
+ue_ctor(void)
+{
+ af_register(&af_ue);
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 1, 4:34 PM (9 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37724972
Default Alt Text
D59060.id184616.diff (1 KB)
Attached To
Mode
D59060: ifconfig(8): show parent device for USB Ethernet interfaces
Attached
Detach File
Event Timeline
Log In to Comment