libiwinfo: major changes
[project/luci.git] / contrib / package / iwinfo / src / iwinfo_wl.c
index 81df81faf4a5488456b45250096dd6caa0bf79e3..b3227918d4b1355c11659523325201e3c17a69fb 100644 (file)
  * This code is based on the wlc.c utility published by OpenWrt.org .
  */
 
-#include "iwinfo_wl.h"
-#include "iwinfo_wext.h"
-
-static int ioctl_socket = -1;
+#include "iwinfo/wl.h"
+#include "iwinfo/wext.h"
 
 static int wl_ioctl(const char *name, int cmd, void *buf, int len)
 {
        struct ifreq ifr;
        wl_ioctl_t ioc;
 
-       /* prepare socket */
-       if( ioctl_socket == -1 )
-       {
-               ioctl_socket = socket(AF_INET, SOCK_DGRAM, 0);
-               fcntl(ioctl_socket, F_SETFD, fcntl(ioctl_socket, F_GETFD) | FD_CLOEXEC);
-       }
-
        /* do it */
        ioc.cmd = cmd;
        ioc.buf = buf;
        ioc.len = len;
+
        strncpy(ifr.ifr_name, name, IFNAMSIZ);
        ifr.ifr_data = (caddr_t) &ioc;
 
-       return ioctl(ioctl_socket, SIOCDEVPRIVATE, &ifr);
+       return iwinfo_ioctl(SIOCDEVPRIVATE, &ifr);
 }
 
 static struct wl_maclist * wl_read_assoclist(const char *ifname)
@@ -75,6 +67,11 @@ int wl_probe(const char *ifname)
        return 0;
 }
 
+void wl_close(void)
+{
+       /* Nop */
+}
+
 int wl_get_mode(const char *ifname, char *buf)
 {
        int ret = -1;
@@ -538,6 +535,11 @@ int wl_get_countrylist(const char *ifname, char *buf, int *len)
        return -1;
 }
 
+int wl_get_hwmodelist(const char *ifname, int *buf)
+{
+       return wext_get_hwmodelist(ifname, buf);
+}
+
 int wl_get_mbssid_support(const char *ifname, int *buf)
 {
        wlc_rev_info_t revinfo;