Page MenuHomeFreeBSD

D12555.id33601.diff
No OneTemporary

D12555.id33601.diff

Index: usr.sbin/wlandebug/Makefile
===================================================================
--- usr.sbin/wlandebug/Makefile
+++ usr.sbin/wlandebug/Makefile
@@ -3,6 +3,8 @@
PROG= wlandebug
MAN= wlandebug.8
+LIBADD+= ifconfig
+
WARNS?= 2
.include <bsd.prog.mk>
Index: usr.sbin/wlandebug/wlandebug.c
===================================================================
--- usr.sbin/wlandebug/wlandebug.c
+++ usr.sbin/wlandebug/wlandebug.c
@@ -43,6 +43,8 @@
#include <string.h>
#include <err.h>
+#include <libifconfig.h>
+
#define N(a) (sizeof(a)/sizeof(a[0]))
const char *progname;
@@ -160,6 +162,21 @@
#endif
}
+static void
+change_iface_unit(char *oid, size_t oid_size, char *name)
+{
+ struct ifconfig_handle *h;
+ char *orig_name;
+
+ h = ifconfig_open();
+ if (ifconfig_get_orig_name(h, name, &orig_name) < 0)
+ errc(1, ifconfig_err_errno(h), "cannot get interface number");
+
+ ifconfig_close(h);
+ setoid(oid, oid_size, orig_name);
+ free(orig_name);
+}
+
int
main(int argc, char *argv[])
{
@@ -179,9 +196,7 @@
} else if (strcmp(argv[1], "-i") == 0) {
if (argc <= 2)
errx(1, "missing interface name for -i option");
- if (strncmp(argv[2], "wlan", 4) != 0)
- errx(1, "expecting a wlan interface name");
- setoid(oid, sizeof(oid), argv[2]);
+ change_iface_unit(oid, sizeof(oid), argv[2]);
argc -= 2, argv += 2;
} else if (strcmp(argv[1], "-?") == 0)
usage();

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 22, 1:41 AM (10 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31945075
Default Alt Text
D12555.id33601.diff (1 KB)

Event Timeline