]>
git.ipfire.org Git - thirdparty/iw.git/blob - util.c
1 #include <linux/nl80211.h>
4 int mac_addr_n2a(char *mac_addr
, unsigned char *arg
)
9 for (i
= 0; i
< ETH_ALEN
; i
++) {
11 sprintf(mac_addr
+l
, "%02x", arg
[i
]);
14 sprintf(mac_addr
+l
, ":%02x", arg
[i
]);
21 int mac_addr_a2n(unsigned char *mac_addr
, char *arg
)
25 for (i
= 0; i
< ETH_ALEN
; i
++) {
27 char *cp
= strchr(arg
, ':');
32 if (sscanf(arg
, "%x", &temp
) != 1)
34 if (temp
< 0 || temp
> 255)
48 static const char *ifmodes
[NL80211_IFTYPE_MAX
+ 1] = {
59 static char modebuf
[100];
61 const char *iftype_name(enum nl80211_iftype iftype
)
63 if (iftype
<= NL80211_IFTYPE_MAX
)
64 return ifmodes
[iftype
];
65 sprintf(modebuf
, "Unknown mode (%d)", iftype
);