2 This file is part of Wi-viz (http://wiviz.natetrue.com).
4 Wi-viz is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License v2 as published by
6 the Free Software Foundation.
8 Wi-viz is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with Wi-viz; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <sys/ioctl.h>
24 #include "wl_access.h"
26 int wl_ioctl(char *name, int cmd, void *buf, int len)
33 /* open socket to kernel */
34 if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
43 strncpy(ifr.ifr_name, name, IFNAMSIZ);
44 ifr.ifr_data = (caddr_t) &ioc;
45 ret = ioctl(s, SIOCDEVPRIVATE, &ifr);
52 int get_mac(char *name, void *buf)
58 /* open socket to kernel */
59 if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
64 strncpy(ifr.ifr_name, name, IFNAMSIZ);
65 //ifr.ifr_data = (caddr_t) buf;
66 if ((ret = ioctl(s, SIOCGIFHWADDR, &ifr)) < 0)
71 memcpy(buf, &ifr.ifr_hwaddr.sa_data, 6);