wlandebug(8): allow fallback to old behavior + improve name checks.
- Treat passed interface name as original if ifconfig_get_orig_name() fails. - Reject interface name if it does not start from "wlan".
This commit is contained in:
parent
d12546572d
commit
e989c74331
@ -169,15 +169,19 @@ get_orig_iface_name(char *oid, size_t oid_size, char *name)
|
||||
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 name");
|
||||
if (ifconfig_get_orig_name(h, name, &orig_name) < 0) {
|
||||
/* check for original interface name. */
|
||||
orig_name = name;
|
||||
}
|
||||
|
||||
if (strlen(orig_name) < strlen("wlan") + 1)
|
||||
if (strlen(orig_name) < strlen("wlan") + 1 ||
|
||||
strncmp(orig_name, "wlan", 4) != 0)
|
||||
errx(1, "expecting a wlan interface name");
|
||||
|
||||
ifconfig_close(h);
|
||||
setoid(oid, oid_size, orig_name);
|
||||
free(orig_name);
|
||||
if (orig_name != name)
|
||||
free(orig_name);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user