Changeset View
Changeset View
Standalone View
Standalone View
tools/tools/iwn/iwnstats/main.c
Context not available. | |||||
#include "iwnstats.h" | #include "iwnstats.h" | ||||
#include "iwn_ioctl.h" | #include "iwn_ioctl.h" | ||||
#define IWN_DEFAULT_IF "iwn0" | #define IWN_DEFAULT_IF "wlan0" | ||||
static struct iwnstats * | static struct iwnstats * | ||||
iwnstats_new(const char *ifname) | iwnstats_new(const char *ifname) | ||||
Context not available. | |||||
if (ifname) | if (ifname) | ||||
free(ifname); | free(ifname); | ||||
ifname = strdup(optarg); | ifname = strdup(optarg); | ||||
if (strncmp(ifname, "wlan", 4) == 0) { | |||||
free(ifname); | |||||
len = 0; | |||||
asprintf(&sysctlname, "net.wlan.%s.%%parent", ifname + 4); | |||||
ret = sysctlbyname(sysctlname, NULL, &len, NULL, 0); | |||||
if (ret != 0) | |||||
err(1, "sysctl failed"); | |||||
ifname = calloc(len, 1); | |||||
ret = sysctlbyname(sysctlname, ifname, &len, NULL, 0); | |||||
if (ret != 0) | |||||
err(1, "sysctl failed"); | |||||
free(sysctlname); | |||||
} | |||||
break; | break; | ||||
default: | default: | ||||
case '?': | case '?': | ||||
Context not available. |