summaryrefslogtreecommitdiff
path: root/package/network
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2018-09-16 19:25:03 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2018-09-16 19:25:03 +0200
commitbe049529e6a883601fd47303a05165a6a0b9a4a5 (patch)
tree15fdc7425a736cf8511a629a1437383f67d20fb5 /package/network
parent57aefc18e4f86130ce66e3c4cdd728ad836aa961 (diff)
downloadmtk-20170518-be049529e6a883601fd47303a05165a6a0b9a4a5.zip
mtk-20170518-be049529e6a883601fd47303a05165a6a0b9a4a5.tar.gz
mtk-20170518-be049529e6a883601fd47303a05165a6a0b9a4a5.tar.bz2
package/network/utils: probably from OpenWRT
Diffstat (limited to 'package/network')
-rw-r--r--package/network/utils/comgt/Makefile5
-rwxr-xr-xpackage/network/utils/comgt/files/directip-stop.gcom16
-rwxr-xr-xpackage/network/utils/comgt/files/directip.gcom55
-rwxr-xr-xpackage/network/utils/comgt/files/directip.sh92
-rw-r--r--package/network/utils/curl/Makefile4
-rw-r--r--package/network/utils/curl/patches/001-cyassl-Use-error-ssl.h-when-available.patch45
-rw-r--r--package/network/utils/curl/patches/100-check_long_long.patch2
-rw-r--r--package/network/utils/curl/patches/200-no_docs_tests.patch8
-rw-r--r--package/network/utils/curl/patches/400-hugehelp.patch13
-rw-r--r--package/network/utils/iwinfo/Makefile7
-rwxr-xr-xpackage/network/utils/iwinfo/src/api/mtk.h62
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_nl80211.c72
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_wext.c13
13 files changed, 321 insertions, 73 deletions
diff --git a/package/network/utils/comgt/Makefile b/package/network/utils/comgt/Makefile
index 9fbc7f9..2546706 100644
--- a/package/network/utils/comgt/Makefile
+++ b/package/network/utils/comgt/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=comgt
PKG_VERSION:=0.32
-PKG_RELEASE:=22
+PKG_RELEASE:=23
PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
PKG_SOURCE_URL:=@SF/comgt
@@ -59,10 +59,13 @@ define Package/comgt/install
$(INSTALL_DATA) ./files/getcarrier.gcom $(1)/etc/gcom/getcarrier.gcom
$(INSTALL_DATA) ./files/getcnum.gcom $(1)/etc/gcom/getcnum.gcom
$(INSTALL_DATA) ./files/getimsi.gcom $(1)/etc/gcom/getimsi.gcom
+ $(INSTALL_DATA) ./files/directip.gcom $(1)/etc/gcom/directip.gcom
+ $(INSTALL_DATA) ./files/directip-stop.gcom $(1)/etc/gcom/directip-stop.gcom
$(INSTALL_DIR) $(1)/etc/hotplug.d/tty
$(INSTALL_DATA) ./files/3g.usb $(1)/etc/hotplug.d/tty/30-3g
$(INSTALL_DIR) $(1)/lib/netifd/proto
$(INSTALL_BIN) ./files/3g.sh $(1)/lib/netifd/proto/3g.sh
+ $(INSTALL_BIN) ./files/directip.sh $(1)/lib/netifd/proto/directip.sh
endef
$(eval $(call BuildPackage,comgt))
diff --git a/package/network/utils/comgt/files/directip-stop.gcom b/package/network/utils/comgt/files/directip-stop.gcom
new file mode 100755
index 0000000..1c14863
--- /dev/null
+++ b/package/network/utils/comgt/files/directip-stop.gcom
@@ -0,0 +1,16 @@
+opengt
+set com 115200n81
+set comecho off
+set senddelay 0.05
+waitquiet 1 0.2
+
+:start
+ send "AT!SCACT=0,3^m"
+ waitfor 5 "OK"
+ if % = 0 goto hangupok
+ print "WWAN error. Hangup failed.\r\n"
+ exit 1
+
+:hangupok
+ print "WWAN connection established.\r\n"
+ exit 0
diff --git a/package/network/utils/comgt/files/directip.gcom b/package/network/utils/comgt/files/directip.gcom
new file mode 100755
index 0000000..afaaacf
--- /dev/null
+++ b/package/network/utils/comgt/files/directip.gcom
@@ -0,0 +1,55 @@
+opengt
+set com 115200n81
+set comecho off
+set senddelay 0.05
+waitquiet 1 0.2
+
+:start
+ if $env("USE_AUTH") = "0" goto connect
+ send "AT$QCPDPP=3,"
+ send $env("USE_AUTH")
+ send ",\""
+ if $env("USE_USER") <> "" send $env("USE_USER")
+ send "\",\""
+ if $env("USE_PASS") <> "" send $env("USE_PASS")
+ send "\"^m"
+ waitfor 5 "OK"
+ if % = 0 goto connect
+ print "WWAN error. Auth failed.\r\n"
+ exit 1
+
+:connect
+ send "AT+CFUN=1^m"
+ send "AT+CGDCONT=3,\"IP\",\""
+ send $env("USE_APN")
+ send "\"^m"
+ waitfor 5 "OK"
+ if % = 0 goto connok
+ print "WWAN error. Connection failed.\r\n"
+ exit 1
+
+:connok
+ let c=1
+:loop
+ sleep 2
+ send "AT+CGATT?^m"
+ waitfor 5 "+CGATT: 1"
+ if % = 0 goto carrierok
+ if c > 10 goto carriererr
+ inc c
+ goto loop
+
+carriererr:
+ print "WWAN error. No carrier.\r\n"
+ exit 1
+
+:carrierok
+ send "AT!SCACT=1,3^m"
+ waitfor 5 "OK"
+ if % = 0 goto dialok
+ print "WWAN error. Dialing failed.\r\n"
+ exit 1
+
+:dialok
+ print "WWAN connection established.\r\n"
+ exit 0
diff --git a/package/network/utils/comgt/files/directip.sh b/package/network/utils/comgt/files/directip.sh
new file mode 100755
index 0000000..c6073f0
--- /dev/null
+++ b/package/network/utils/comgt/files/directip.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. ../netifd-proto.sh
+init_proto "$@"
+
+proto_directip_init_config() {
+ available=1
+ proto_config_add_string "device:device"
+ proto_config_add_string "ifname"
+ proto_config_add_string "apn"
+ proto_config_add_string "pincode"
+ proto_config_add_string "auth"
+ proto_config_add_string "username"
+ proto_config_add_string "password"
+}
+
+proto_directip_setup() {
+ local interface="$1"
+ local chat
+
+ local device apn pincode ifname auth username password
+ json_get_vars device apn pincode ifname auth username password
+
+ [ -e "$device" ] || {
+ proto_notify_error "$interface" NO_DEVICE
+ proto_set_available "$interface" 0
+ return 1
+ }
+
+ [ -n "$ifname" ] || {
+ proto_notify_error "$interface" NO_IFNAME
+ proto_set_available "$interface" 0
+ return 1
+ }
+
+ cardinfo=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom)
+ [ -n $(echo "$cardinfo" | grep -q "Sierra Wireless") ] || {
+ proto_notify_error "$interface" BAD_DEVICE
+ proto_block_restart "$interface"
+ return 1
+ }
+
+ if [ -n "$pincode" ]; then
+ PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
+ proto_notify_error "$interface" PIN_FAILED
+ proto_block_restart "$interface"
+ return 1
+ }
+ fi
+ # wait for carrier to avoid firmware stability bugs
+ gcom -d "$device" -s /etc/gcom/getcarrier.gcom || return 1
+
+ local auth_type=0
+ [ -z "$auth" ] && case $auth in
+ pap) auth_type=1;;
+ chap) auth_type=1;;
+ esac
+
+ USE_APN="$apn" USE_USER="$username" USE_PASS="$password" USE_AUTH="$auth_type" \
+ gcom -d "$device" -s /etc/gcom/directip.gcom || {
+ proto_notify_error "$interface" CONNECT_FAILED
+ proto_block_restart "$interface"
+ return 1
+ }
+
+ logger -p daemon.info -t "directip[$$]" "Connected, starting DHCP"
+ proto_init_update "*" 1
+ proto_send_update "$interface"
+
+ json_init
+ json_add_string name "${interface}_dhcp"
+ json_add_string ifname "@$interface"
+ json_add_string proto "dhcp"
+ ubus call network add_dynamic "$(json_dump)"
+
+ return 0
+}
+
+proto_directip_teardown() {
+ local interface="$1"
+
+ local device
+ json_get_vars device
+
+ gcom -d "$device" -s /etc/gcom/directip-stop.gcom || proto_notify_error "$interface" CONNECT_FAILED
+
+ proto_init_update "*" 0
+ proto_send_update "$interface"
+}
+
+add_protocol directip
diff --git a/package/network/utils/curl/Makefile b/package/network/utils/curl/Makefile
index d1a8fc5..0bb8323 100644
--- a/package/network/utils/curl/Makefile
+++ b/package/network/utils/curl/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=curl
-PKG_VERSION:=7.36.0
+PKG_VERSION:=7.38.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
@@ -18,7 +18,7 @@ PKG_SOURCE_URL:=http://curl.haxx.se/download/ \
ftp://ftp.planetmirror.com/pub/curl/ \
http://www.mirrormonster.com/curl/download/ \
http://curl.mirrors.cyberservers.net/download/
-PKG_MD5SUM:=e6d1f9d1b59da5062109ffe14e0569a4
+PKG_MD5SUM:=af6b3c299bd891f43cb5f76c4091b7b4
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYING
diff --git a/package/network/utils/curl/patches/001-cyassl-Use-error-ssl.h-when-available.patch b/package/network/utils/curl/patches/001-cyassl-Use-error-ssl.h-when-available.patch
deleted file mode 100644
index d7190af..0000000
--- a/package/network/utils/curl/patches/001-cyassl-Use-error-ssl.h-when-available.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 0204e17bc656e6c59b4010283e67f9251eb12c41 Mon Sep 17 00:00:00 2001
-From: Dan Fandrich <dan@coneharvesters.com>
-Date: Wed, 23 Apr 2014 11:01:30 +0200
-Subject: [PATCH] cyassl: Use error-ssl.h when available
-
-Versions since at least 2.9.4 renamed error.h to error-ssl.h, so use
-whichever one is available.
----
- configure.ac | 3 +++
- lib/vtls/cyassl.c | 9 +++++++--
- 2 files changed, 10 insertions(+), 2 deletions(-)
-
---- a/configure.ac
-+++ b/configure.ac
-@@ -2003,6 +2003,9 @@ if test "$curl_ssl_msg" = "$init_ssl_msg
- dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
- AC_CHECK_SIZEOF(long long)
-
-+ dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
-+ AC_CHECK_HEADERS(cyassl/error-ssl.h)
-+
- LIBS="-lcyassl -lm $LIBS"
-
- if test -n "$cyassllib"; then
---- a/lib/vtls/cyassl.c
-+++ b/lib/vtls/cyassl.c
-@@ -47,11 +47,16 @@
- #define _MPRINTF_REPLACE /* use our functions only */
- #include <curl/mprintf.h>
- #include "curl_memory.h"
--/* The last #include file should be: */
--#include "memdebug.h"
-+
- #include <cyassl/ssl.h>
-+#ifdef HAVE_CYASSL_ERROR_SSL_H
-+#include <cyassl/error-ssl.h>
-+#else
- #include <cyassl/error.h>
-+#endif
-
-+/* The last #include file should be: */
-+#include "memdebug.h"
-
- static Curl_recv cyassl_recv;
- static Curl_send cyassl_send;
diff --git a/package/network/utils/curl/patches/100-check_long_long.patch b/package/network/utils/curl/patches/100-check_long_long.patch
index 7e014cd..05fb1bf 100644
--- a/package/network/utils/curl/patches/100-check_long_long.patch
+++ b/package/network/utils/curl/patches/100-check_long_long.patch
@@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
-@@ -2904,6 +2904,7 @@ CURL_VERIFY_RUNTIMELIBS
+@@ -2877,6 +2877,7 @@ CURL_VERIFY_RUNTIMELIBS
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(long)
diff --git a/package/network/utils/curl/patches/200-no_docs_tests.patch b/package/network/utils/curl/patches/200-no_docs_tests.patch
index 2287215..42619a3 100644
--- a/package/network/utils/curl/patches/200-no_docs_tests.patch
+++ b/package/network/utils/curl/patches/200-no_docs_tests.patch
@@ -1,6 +1,6 @@
--- a/Makefile.am
+++ b/Makefile.am
-@@ -66,7 +66,7 @@ CLEANFILES = $(VC6LIBDSP) $(VC8LIBPRJ)
+@@ -128,7 +128,7 @@ CLEANFILES = $(VC6_LIBDSP) $(VC6_SRCDSP)
bin_SCRIPTS = curl-config
SUBDIRS = lib src include
@@ -11,12 +11,12 @@
pkgconfig_DATA = libcurl.pc
--- a/Makefile.in
+++ b/Makefile.in
-@@ -506,7 +506,7 @@ EXTRA_DIST = CHANGES COPYING maketgz Mak
- CLEANFILES = $(VC6LIBDSP) $(VC8LIBPRJ)
+@@ -574,7 +574,7 @@ CLEANFILES = $(VC6_LIBDSP) $(VC6_SRCDSP)
+
bin_SCRIPTS = curl-config
SUBDIRS = lib src include
-DIST_SUBDIRS = $(SUBDIRS) tests packages docs
+DIST_SUBDIRS = $(SUBDIRS) packages
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libcurl.pc
- VSOURCES = vtls/openssl.c vtls/gtls.c vtls/vtls.c vtls/nss.c vtls/qssl.c \
+ LIB_VTLS_CFILES = vtls/openssl.c vtls/gtls.c vtls/vtls.c vtls/nss.c \
diff --git a/package/network/utils/curl/patches/400-hugehelp.patch b/package/network/utils/curl/patches/400-hugehelp.patch
deleted file mode 100644
index 312792b..0000000
--- a/package/network/utils/curl/patches/400-hugehelp.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/src/tool_hugehelp.h
-+++ b/src/tool_hugehelp.h
-@@ -23,6 +23,10 @@
- ***************************************************************************/
- #include "tool_setup.h"
-
-+#ifdef USE_MANUAL
- void hugehelp(void);
-+#else
-+#define hugehelp() Curl_nop_stmt
-+#endif
-
- #endif /* HEADER_CURL_TOOL_HUGEHELP_H */
diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile
index e4ee73a..955011a 100644
--- a/package/network/utils/iwinfo/Makefile
+++ b/package/network/utils/iwinfo/Makefile
@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libiwinfo
-PKG_RELEASE:=50
+PKG_RELEASE:=51
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_CONFIG_DEPENDS := \
@@ -24,7 +24,7 @@ define Package/libiwinfo
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Generalized Wireless Information Library (iwinfo)
- DEPENDS:=+PACKAGE_kmod-mac80211:libnl-tiny
+ DEPENDS:=+PACKAGE_kmod-mac80211:libnl-tiny +libnl-tiny
ABI_VERSION:=$(PKG_RELEASE)
MAINTAINER:=Jo-Philipp Wich <xm@subsignal.org>
endef
@@ -76,7 +76,8 @@ IWINFO_BACKENDS := \
$(if $(CONFIG_PACKAGE_kmod-brcm-wl-mini),wl) \
$(if $(CONFIG_PACKAGE_kmod-brcm-wl-mimo),wl) \
$(if $(CONFIG_PACKAGE_kmod-madwifi),madwifi) \
- $(if $(CONFIG_PACKAGE_kmod-mac80211),nl80211)
+ $(if $(CONFIG_PACKAGE_kmod-mac80211),nl80211) \
+ nl80211
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include/libnl-tiny \
diff --git a/package/network/utils/iwinfo/src/api/mtk.h b/package/network/utils/iwinfo/src/api/mtk.h
new file mode 100755
index 0000000..ca5dbe4
--- /dev/null
+++ b/package/network/utils/iwinfo/src/api/mtk.h
@@ -0,0 +1,62 @@
+#ifndef __MTK_H__
+#define __MTK_H__
+
+#define MAC_ADDR_LENGTH 6
+#define MAX_NUMBER_OF_MAC 32
+typedef unsigned char UCHAR;
+typedef char CHAR;
+typedef unsigned int UINT32;
+typedef unsigned short USHORT;
+typedef short SHORT;
+typedef unsigned long ULONG;
+
+#if WIRELESS_EXT <= 11
+#ifndef SIOCDEVPRIVATE
+#define SIOCDEVPRIVATE 0x8BE0
+#endif
+#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
+#endif
+
+#define RTPRIV_IOCTL_GET_MAC_TABLE (SIOCIWFIRSTPRIV + 0x0F)
+#define RTPRIV_IOCTL_GET_MAC_TABLE_STRUCT (SIOCIWFIRSTPRIV + 0x1F) /* modified by Red@Ralink, 2009/09/30 */
+
+
+/* MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! */
+typedef union _MACHTTRANSMIT_SETTING {
+ struct {
+ USHORT MCS:7; /* MCS */
+ USHORT BW:1; /*channel bandwidth 20MHz or 40 MHz */
+ USHORT ShortGI:1;
+ USHORT STBC:2; /*SPACE */
+ USHORT rsv:3;
+ USHORT MODE:2; /* Use definition MODE_xxx. */
+ } field;
+ USHORT word;
+} MACHTTRANSMIT_SETTING, *PMACHTTRANSMIT_SETTING;
+
+typedef struct _RT_802_11_MAC_ENTRY {
+ UCHAR ApIdx;
+ UCHAR Addr[MAC_ADDR_LENGTH];
+ UCHAR Aid;
+ UCHAR Psm; /* 0:PWR_ACTIVE, 1:PWR_SAVE */
+ UCHAR MimoPs; /* 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled */
+ CHAR AvgRssi0;
+ CHAR AvgRssi1;
+ CHAR AvgRssi2;
+ UINT32 ConnectedTime;
+ MACHTTRANSMIT_SETTING TxRate;
+ UINT32 LastRxRate;
+ SHORT StreamSnr[3]; /* BF SNR from RXWI. Units=0.25 dB. 22 dB offset removed */
+ SHORT SoundingRespSnr[3]; /* SNR from Sounding Response. Units=0.25 dB. 22 dB offset removed */
+/* SHORT TxPER; */ /* TX PER over the last second. Percent */
+/* SHORT reserved;*/
+} RT_802_11_MAC_ENTRY, *PRT_802_11_MAC_ENTRY;
+
+typedef struct _RT_802_11_MAC_TABLE {
+ ULONG Num;
+ RT_802_11_MAC_ENTRY Entry[MAX_NUMBER_OF_MAC];
+} RT_802_11_MAC_TABLE, *PRT_802_11_MAC_TABLE;
+
+
+#endif // __MTK_H__
+
diff --git a/package/network/utils/iwinfo/src/iwinfo_nl80211.c b/package/network/utils/iwinfo/src/iwinfo_nl80211.c
index 33c6238..d69dc3d 100644
--- a/package/network/utils/iwinfo/src/iwinfo_nl80211.c
+++ b/package/network/utils/iwinfo/src/iwinfo_nl80211.c
@@ -1146,6 +1146,7 @@ static void nl80211_fill_signal(const char *ifname, struct nl80211_rssi_rate *r)
static int nl80211_get_bitrate(const char *ifname, int *buf)
{
+#if 0
struct nl80211_rssi_rate rr;
nl80211_fill_signal(ifname, &rr);
@@ -1157,10 +1158,14 @@ static int nl80211_get_bitrate(const char *ifname, int *buf)
}
return -1;
+#endif
+ return wext_ops.bitrate(ifname, buf);
+
}
static int nl80211_get_signal(const char *ifname, int *buf)
{
+#if 0
struct nl80211_rssi_rate rr;
nl80211_fill_signal(ifname, &rr);
@@ -1172,6 +1177,8 @@ static int nl80211_get_signal(const char *ifname, int *buf)
}
return -1;
+#endif
+ return wext_ops.signal(ifname, buf);
}
static int nl80211_get_noise_cb(struct nl_msg *msg, void *arg)
@@ -1881,11 +1888,70 @@ static int nl80211_get_scanlist_nl(const char *ifname, char *buf, int *len)
return *len ? 0 : -1;
}
+static int wpasupp_ssid_decode(const char *in, char *out, int outlen)
+{
+#define hex(x) \
+ (((x) >= 'a') ? ((x) - 'a' + 10) : \
+ (((x) >= 'A') ? ((x) - 'A' + 10) : ((x) - '0')))
+
+ int len = 0;
+
+ while (*in)
+ {
+ if (len + 1 >= outlen)
+ break;
+
+ switch (*in)
+ {
+ case '\\':
+ in++;
+ switch (*in)
+ {
+ case 'n':
+ out[len++] = '\n'; in++;
+ break;
+
+ case 'r':
+ out[len++] = '\r'; in++;
+ break;
+
+ case 't':
+ out[len++] = '\t'; in++;
+ break;
+
+ case 'e':
+ out[len++] = '\e'; in++;
+ break;
+
+ case 'x':
+ if (isxdigit(*(in+1)) && isxdigit(*(in+2)))
+ out[len++] = hex(*(in+1)) * 16 + hex(*(in+2));
+ in += 3;
+ break;
+
+ default:
+ out[len++] = *in++;
+ break;
+ }
+ break;
+
+ default:
+ out[len++] = *in++;
+ break;
+ }
+ }
+
+ if (outlen > len)
+ out[len] = '\0';
+
+ return len;
+}
+
static int nl80211_get_scanlist(const char *ifname, char *buf, int *len)
{
int freq, rssi, qmax, count, mode;
char *res;
- char ssid[128] = { 0 };
+ char ssid[129] = { 0 };
char bssid[18] = { 0 };
char cipher[256] = { 0 };
@@ -1930,7 +1996,7 @@ static int nl80211_get_scanlist(const char *ifname, char *buf, int *len)
count++;
goto nextline;
}
- if (sscanf(res, "%17s %d %d %255s%*[ \t]%127[^\n]\n",
+ if (sscanf(res, "%17s %d %d %255s%*[ \t]%128[^\n]\n",
bssid, &freq, &rssi, cipher, ssid) < 5)
{
/* skip malformed lines */
@@ -1945,7 +2011,7 @@ static int nl80211_get_scanlist(const char *ifname, char *buf, int *len)
e->mac[5] = strtol(&bssid[15], NULL, 16);
/* SSID */
- memcpy(e->ssid, ssid, min(strlen(ssid), sizeof(e->ssid) - 1));
+ wpasupp_ssid_decode(ssid, e->ssid, sizeof(e->ssid));
/* Mode (assume master) */
if (strstr(cipher,"[MESH]"))
diff --git a/package/network/utils/iwinfo/src/iwinfo_wext.c b/package/network/utils/iwinfo/src/iwinfo_wext.c
index a6cc516..a4b94e3 100644
--- a/package/network/utils/iwinfo/src/iwinfo_wext.c
+++ b/package/network/utils/iwinfo/src/iwinfo_wext.c
@@ -123,7 +123,16 @@ static int wext_get_bssid(const char *ifname, char *buf)
{
struct iwreq wrq;
- if(wext_ioctl(ifname, SIOCGIWAP, &wrq) >= 0)
+ char cmd[256];
+ FILE *fp = NULL;
+
+ memset(cmd, 0, sizeof(cmd));
+ sprintf(cmd, "ifconfig %s | grep UP", ifname);
+ fp = popen(cmd, "r");
+ fscanf(fp, "%s\n", buf);
+ pclose(fp);
+
+ if(strlen(buf)>=2 && wext_ioctl(ifname, SIOCGIWAP, &wrq) >= 0)
{
sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",
(uint8_t)wrq.u.ap_addr.sa_data[0], (uint8_t)wrq.u.ap_addr.sa_data[1],
@@ -132,6 +141,8 @@ static int wext_get_bssid(const char *ifname, char *buf)
return 0;
}
+ else
+ sprintf(buf, "00:00:00:00:00:00");
return -1;
}