wifiApTest not connecting clients


#1

Hi all,

I have started exploring wifi applications of legato. The WiFi client and client test seems to be working fine; but access point is acting up.

In both legato command line and test application I can create a discoverable WiFi access point; but when I try to connect with the access point with a device it is remaining at “connecting…” and is not proceeding further. I have set up the etc/dnsmasq.d/wifiAP.conf as specified by the wifiApTest.c.

Also while using command line to set up the wifi I execute the commands as specified in http://legato.io/legato-docs/latest/wifi_toolsTarget_wifi.html.

I am using a MangOH Green board with wp8548.


#2

Hi @codegit001,

So you’re trying to connect to the (mangOH) AP from a device (Another mangOH? PC? Smartphone?) and the device shows “Connecting …” ?

I wonder if the DHCP server is working properly. What’s the content of {{/etc/dnsmasq.d/wifiAP.conf}}?
Is dnsmasq running? With which args?


#3

I am trying to connect using my mobile phone.

I used logread -f | grep wifi and it says peer didnot ack 100 packets and is disconnecting. I have the logs, but it seems I cannot attach files to my comments yet.

From the logs dnsmasq is up and running with the values from wifiAp.conf; which contains:
dhcp-range=wlan0,192.168.10.10,192.168.10.199,24h


#4

Have you tried with another device?
Eventually one where you can set a static IP just to get that out of the way, even though that doesn’t seem to be the problem here.
Your wlan0 ip is something like 129.168.10.1 right?


#5

wlan0 ip: 192.168.10.1

Made a laptop running Windows 7 as the client with::
static IP: 192.168.10.2 | mask: 255.255.255.0 | default gateway: 192.168.10.1

The lap says "Connection was unsuccessful The computer currently has limited connectivity to "

I had run the ‘cm data connect’ with a successfull connection to my service provider and successful ping.

The ‘logread -f’ returns the following:

Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa_wifi_ap_ti.c pa_wifiAp_Start() 597 | Start Access Point Cmd: /bin/hostapd /tmp/hostapd.conf
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085] | WIFIAP_HOSTAPD_START
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa_wifi_ap_ti.c pa_wifiAp_Start() 606 | WiFi Access Point Command OK:wlan0 WIFIAP_HOSTAPD_START
Nov 23 12:05:20 swi-mdm9x15 user.debug Legato: DBUG | wifiService[2085]/framework T=main | le_wifiAp_server.c Handle_le_wifiAp_Start() 512 | Sending response to client session 0x27dfc : 4 bytes sent
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi_novice.c Testle_wifiApStart() 212 | Start OK
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi_novice.c RunSystemCommand() 92 | Success: ifconfig wlan0 192.168.10.1 up
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi_novice.c RunSystemCommand() 92 | Success: echo 1 > /proc/sys/net/ipv4/ip_forward
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi_novice.c RunSystemCommand() 92 | Success: modprobe ipt_MASQUERADE
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi_novice.c RunSystemCommand() 92 | Success: iptables -A POSTROUTING -t nat -o rmnet0 -j MASQUERADE
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi_novice.c RunSystemCommand() 92 | Success: iptables -A FORWARD --match state --state RELATED,ESTABLISHED --jump ACCEPT
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi_novice.c RunSystemCommand() 92 | Success: iptables -A FORWARD -i wlan0 --destination 192.168.0.0/24 --match state --state NEW --jump ACCEPT
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi_novice.c RunSystemCommand() 92 | Success: iptables -A INPUT -s 192.168.0.0/24 --jump ACCEPT
Nov 23 12:05:20 swi-mdm9x15 user.debug Legato: DBUG | wifiApTest[2299]/framework T=main | le_wifiAp_client.c le_wifiAp_SetIpRange() 1552 | Sending message to server and waiting for response : 50 bytes sent
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa_wifi_ap_ti.c pa_wifiAp_SetIpRange() 1032 | @AP=c0a80a01, @APstart=c0a80a0a, @APstop=c0a80a14
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa_wifi_ap_ti.c pa_wifiAp_SetIpRange() 1068 | Creation of dnsmasq configuration file (/tmp/dnsmasq.wlan.conf)
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa_wifi_ap_ti.c pa_wifiAp_SetIpRange() 1089 | @AP=192.168.10.1, @APstart=192.168.10.10, @APstop=192.168.10.20
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085] | stopping DNS forwarder and DHCP server: dnsmasq…
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085] | no /usr/bin/dnsmasq found; none killed
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085] | starting DNS forwarder and DHCP server: dnsmasq…
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: started, version 2.71 cachesize 150
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth no-DNSSEC
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq-dhcp[2369]: DHCP, IP range 192.168.10.10 – 192.168.10.20, lease time 1d
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq-dhcp[2369]: DHCP, IP range 192.168.2.3 – 192.168.2.3, lease time 12h
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq-dhcp[2369]: DHCP, IP range 192.168.10.10 – 192.168.10.199, lease time 1d
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: reading /etc/resolv.conf
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | supervisor[469]/supervisor T=main | supervisor.c SigChildHandler() 680 | Reaping unconfigured child process 2368.
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085] | done.
Nov 23 12:05:20 swi-mdm9x15 user.debug Legato: DBUG | wifiService[2085]/framework T=main | le_wifiAp_server.c Handle_le_wifiAp_SetIpRange() 997 | Sending response to client session 0x27dfc : 4 bytes sent
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: using nameserver 192.168.1.41#53
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: using nameserver 192.168.1.40#53
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: using nameserver 8.8.8.8#53
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: using nameserver 218.248.112.65#53
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: using nameserver 218.248.112.1#53
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: read /etc/hosts - 1 addresses
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=WifiApPaThread | pa_wifi_ap_ti.c WifiApPaThreadMain() 247 | PARSING:wlan0 (phy #0): mgmt TX status (cookie cea6a540): acked : len:56
Nov 23 12:05:24 swi-mdm9x15 daemon.info hostapd: wlan0: STA b0:c0:90:bc:9d:d7 IEEE 802.11: authenticated
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=WifiApPaThread | pa_wifi_ap_ti.c WifiApPaThreadMain() 247 | PARSING:wlan0: new station b0:c0:90:bc:9d:d7 : len:37
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=WifiApPaThread | pa_wifi_ap_ti.c WifiApPaThreadMain() 250 | FOUND new station
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=WifiApPaThread | pa_wifi_ap_ti.c WifiApPaThreadMain() 253 | InternalWifiApStateEvent event: 0
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa_wifi_ap_ti.c FirstLayerWifiApEventHandler() 207 | Event: 0
Nov 23 12:05:24 swi-mdm9x15 user.debug Legato: DBUG | wifiService[2085]/daemon T=main | le_wifiAp.c PaEventApHandler() 37 | Event: 0
Nov 23 12:05:24 swi-mdm9x15 user.debug Legato: DBUG | wifiService[2085]/daemon T=main | le_wifiAp.c FirstLayerWifiApEventHandler() 60 | Event: 0
Nov 23 12:05:24 swi-mdm9x15 user.debug Legato: DBUG | wifiService[2085]/framework T=main | le_wifiAp_server.c AsyncResponse_le_wifiAp_AddNewEventHandler() 326 | Sending message to client session 0x27dfc : 8 bytes sent
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi_novice.c myMsgHandler() 163 | WiFi access point event received
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi_novice.c myMsgHandler() 169 | LE_WIFIAP_EVENT_CLIENT_CONNECTED
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=WifiApPaThread | pa_wifi_ap_ti.c WifiApPaThreadMain() 247 | PARSING:wlan0 (phy #0): mgmt TX status (cookie cc60fb40): acked : len:56
Nov 23 12:05:24 swi-mdm9x15 daemon.info hostapd: wlan0: STA b0:c0:90:bc:9d:d7 IEEE 802.11: associated (aid 1)
Nov 23 12:05:24 swi-mdm9x15 daemon.info hostapd: wlan0: STA b0:c0:90:bc:9d:d7 WPA: pairwise key handshake completed (RSN)
Nov 23 12:06:03 swi-mdm9x15 daemon.info dnsmasq-dhcp[2369]: DHCPINFORM(usb0) 192.168.2.3 02:d1:26:94:69:55
Nov 23 12:06:03 swi-mdm9x15 daemon.info dnsmasq-dhcp[2369]: DHCPACK(usb0) 192.168.2.3 02:d1:26:94:69:55 BLR-DTDL3P1MXJ2


#6

I have made the change from eth0 to rmnet0 in the code.


#7

Also BLR-DTDL3P1MXJ2 is the workstation from which the ssh is connecting to the board. Why is that popping up with reference to dnsmasq-dhcp[2369]: DHCPACK(usb0) and dnsmasq-dhcp[2369]: DHCPINFORM(usb0)


#8

I’m really surprised to see some 192.168.0.0/24 in there.
Seems like the subnet is wrong, as it should be 192.168.10.0/24.
It’s the case in the doc but not in wifiApTest.c.
Could you see if that fixes the connectivity issue?

Thanks


#9

Now the laptop promptly display “Connected”; but even though I am able to ping data quite easily using my board, the connected device seems unable to do so.

Also this is using static IP. Is there any way I can still use actual DHCP ?


#10

The issue is now the fact that the board is not transferring data to its client. How can I use something like TFTP with the existing connection ? I enabled tftp client in my Windows 7 client, but the connections are timing out.

tftp -l file.txt -p 192.168.10.1
tftp: timeout


#11

Is there a tftp server on your target? There is none by default.

Easiest way would be to use SSH (& SCP), but you would also need to open access to the target ssh port from wlan0.

This would be something like:

# Allow SSH, PING and DHCP over WiFi interface
LAN_IF=wlan0
iptables -A INPUT -i @LAN_IF@ -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -i @LAN_IF@ -p icmp -m icmp --icmp-type 8 -j ACCEPT
iptables -A INPUT -i @LAN_IF@ -p udp --dport 67:68 --sport 67:68 -j ACCEPT

(adapted from meta-swi/meta-swi-mdm9xxx/recipes-core/init-ifupdown/files/rules.v4)


#12

Any solutions on why the data cannot reach the client ? I am able to ping sites using the board; but the connected clients declare the Access Point as “No Internet Connection”.


#13

@CoRfr after some snooping around, dropping the IP Tables just before resetting the modprob masquerade seems to do the trick; I was busy with another project, so I couldn’t pay attention to this. Cheers.