1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-04-21 12:27:27 +03:00

remove lots of useless junk from the nvram package

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@6177 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd
2007-01-22 14:46:37 +00:00
parent e1f02e37b7
commit b5faddf0c3
18 changed files with 274 additions and 3099 deletions

View File

@@ -11,11 +11,68 @@
*
* $Id$
*/
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <typedefs.h>
#include <wlutils.h>
int
wl_ioctl(char *name, int cmd, void *buf, int len)
{
struct ifreq ifr;
wl_ioctl_t ioc;
int ret = 0;
int s;
/* open socket to kernel */
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("socket");
return errno;
}
/* do it */
ioc.cmd = cmd;
ioc.buf = buf;
ioc.len = len;
strncpy(ifr.ifr_name, name, IFNAMSIZ);
ifr.ifr_data = (caddr_t) &ioc;
if ((ret = ioctl(s, SIOCDEVPRIVATE, &ifr)) < 0)
if (cmd != WLC_GET_MAGIC)
perror(ifr.ifr_name);
/* cleanup */
close(s);
return ret;
}
int
wl_hwaddr(char *name, unsigned char *hwaddr)
{
struct ifreq ifr;
int ret = 0;
int s;
/* open socket to kernel */
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("socket");
return errno;
}
/* do it */
strncpy(ifr.ifr_name, name, IFNAMSIZ);
if ((ret = ioctl(s, SIOCGIFHWADDR, &ifr)) == 0)
memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
/* cleanup */
close(s);
return ret;
}
int
wl_probe(char *name)
{