Modify

Opened 3 years ago

Last modified 3 years ago

#17394 new defect

iwinfo wifi scan bug

Reported by: xzm2@… Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: iwinfo Cc:

Description

OpenWrt Version: BARRIER BREAKER (14.07, r41988)
root@OpenWrt:~# iwinfo radio0 scan
Cell 01 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 02 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 03 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 04 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 05 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 06 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 07 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 08 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 09 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 10 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 11 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 12 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 13 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 14 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 15 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 16 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 17 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 18 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 19 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

Cell 20 - Address: 00:00:00:00:00:00

ESSID: unknown
Mode: Unknown Channel: unknown
Signal: -256 dBm Quality: 0/0
Encryption: none

#############################################
Bug Description:
./package/network/utils/iwinfo/src/iwinfo_cli.c
static void print_scanlist(const struct iwinfo_ops *iw, const char *ifname)
{

int i, x, len = 0; len must be initial to 0
char buf[IWINFO_BUFSIZE];
struct iwinfo_scanlist_entry *e;

if (iw->scanlist(ifname, buf, &len))
{

printf("Scanning not possible\n\n");
return;

}
else if (len <= 0)
{

printf("No scan results\n\n");
return;

}

./package/network/utils/iwinfo/src/iwinfo_nl80211.c
static char * nl80211_phy2ifname(const char *ifname)
{

int fd, ifidx = -1, cifidx = -1, phyidx = -1;
char buffer[64];
static char nif[IFNAMSIZ] = { 0 }; static var

DIR *d;
struct dirent *e;

if (!ifname)

return NULL;

else if (!strncmp(ifname, "phy", 3))

phyidx = atoi(&ifname[3]);

else if (!strncmp(ifname, "radio", 5))

phyidx = atoi(&ifname[5]);

memset(nif, 0, sizeof(nif)); bug here, ifname may pointer to nif

####################################################
Code test, modify nl80211_phy2ifname function, print ifname:
static char * nl80211_phy2ifname(const char *ifname)
{

int fd, ifidx = -1, cifidx = -1, phyidx = -1;
char buffer[64];
static char nif[IFNAMSIZ] = { 0 };

DIR *d;
struct dirent *e;

if (!ifname)

return NULL;

else if (!strncmp(ifname, "phy", 3))

phyidx = atoi(&ifname[3]);

else if (!strncmp(ifname, "radio", 5))

phyidx = atoi(&ifname[5]);

printf("1. ifname=[%p:%s] nif=[%p:%s]\n", ifname, ifname, nif, nif) ;
memset(nif, 0, sizeof(nif));
printf("2. ifname=[%p:%s] nif=[%p:%s]\n", ifname, ifname, nif, nif) ;

####################################################
root@OpenWrt:/tmp# ./iwinfo radio0 scan

  1. ifname=[0x7fbdef05:radio0] nif=[0x7769b770:]
  2. ifname=[0x7fbdef05:radio0] nif=[0x7769b770:]
  3. ifname=[0x7769b770:wlan0] nif=[0x7769b770:wlan0]
  4. ifname=[0x7769b770:] nif=[0x7769b770:]

No scan results

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by hauke

What wifi driver are you using?

I tried it with b43 and OpenWrt trunk and there it worked like expected

Last edited 3 years ago by hauke (previous) (diff)

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.