2 * Wireless network adapter utilities (linux-specific)
4 * Copyright 2004, Broadcom Corporation
7 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
19 #include <sys/ioctl.h>
27 wl_ioctl(char *name, int cmd, void *buf, int len)
34 /* open socket to kernel */
35 if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
44 strncpy(ifr.ifr_name, name, IFNAMSIZ);
45 ifr.ifr_data = (caddr_t) &ioc;
46 if ((ret = ioctl(s, SIOCDEVPRIVATE, &ifr)) < 0)
47 if (cmd != WLC_GET_MAGIC)
56 wl_hwaddr(char *name, unsigned char *hwaddr)
62 /* open socket to kernel */
63 if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
69 strncpy(ifr.ifr_name, name, IFNAMSIZ);
70 if ((ret = ioctl(s, SIOCGIFHWADDR, &ifr)) == 0)
71 memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);