1

I am creating a Wifi hotspot with hostapd and providing DHCP/DNS through dnsmasq on an Android 5.0.1 device. When a client connects to the Wifi hotspot it is subsequently unable to obtain an IP address through DHCP. The dnsmasq server claims to send a DHCP ACK response but no packet is seen in wireshark.

dnsmasq is started with the following options (formatted for viewing).

/system/bin/dnsmasq
--keep-in-foreground
--no-resolv
--no-poll
--dhcp-authoritative
--dhcp-option-force=43,ANDROID_METERED
--pid-file
--dhcp-range=2001::2, 2001::10, ra-stateless,infinite
--enable-ra
--dhcp-range=192.168.42.2,192.168.42.254,1h
--dhcp-range=192.168.43.2,192.168.43.254,1h
--dhcp-range=192.168.44.2,192.168.44.254,1h
--dhcp-range=192.168.45.2,192.168.45.254,1h
--dhcp-range=192.168.46.2,192.168.46.254,1h
--dhcp-range=192.168.47.2,192.168.47.254,1h
--dhcp-range=192.168.48.2,192.168.48.254,1h
--dhcp-range=192.168.49.2,192.168.49.254,1h

The dnsmasq logs show that dnsmasq receives the DHCP REQUEST from the client and attempts to respond with DHCP ACK.

I/dnsmasq (10989): started, version 2.62 cachesize 150
I/dnsmasq (10989): compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-scripts no-TFTP no-conntrack
W/dnsmasq (10989): warning: no upstream servers configured
I/dnsmasq (10989): IPv6 router advertisement enabled
I/dnsmasq (10989): DHCP, IP range 192.168.49.2 -- 192.168.49.254, lease time 1h
I/dnsmasq (10989): DHCP, IP range 192.168.48.2 -- 192.168.48.254, lease time 1h
I/dnsmasq (10989): DHCP, IP range 192.168.47.2 -- 192.168.47.254, lease time 1h
I/dnsmasq (10989): DHCP, IP range 192.168.46.2 -- 192.168.46.254, lease time 1h
I/dnsmasq (10989): DHCP, IP range 192.168.45.2 -- 192.168.45.254, lease time 1h
I/dnsmasq (10989): DHCP, IP range 192.168.44.2 -- 192.168.44.254, lease time 1h
I/dnsmasq (10989): DHCP, IP range 192.168.43.2 -- 192.168.43.254, lease time 1h
I/dnsmasq (10989): DHCP, IP range 192.168.42.2 -- 192.168.42.254, lease time 1h
I/dnsmasq (10989): stateless DHCPv6 on 2001::2
I/dnsmasq (10989): SLAAC on 2001:: prefix valid infinite
I/dnsmasq (10989): read /etc/hosts - 1 addresses
I/dnsmasq (10989): using nameserver 8.8.8.8#53
I/dnsmasq (10989): update ra:true|wlan0|rmnet0|97
I/dnsmasq (10989): internal inf is wlan0
I/dnsmasq (10989): external inf is rmnet0
I/dnsmasq (10989): set table number:97
I/dnsmasq (10989): update_ra count:0
I/dnsmasq (10989): link local address:wlan0
I/dnsmasq (10989): failed to send_ra: face_enumerate, parm.found_context
I/dnsmasq (10989): failed to update ra:send_ra
I/dnsmasq (10989): DHCPDISCOVER(wlan0) c0:bd:d1:4a:3a:0f 
I/dnsmasq (10989): DHCPOFFER(wlan0) 192.168.43.127 c0:bd:d1:4a:3a:0f 
I/dnsmasq (10989): DHCPREQUEST(wlan0) 192.168.43.127 c0:bd:d1:4a:3a:0f 
I/dnsmasq (10989): DHCPACK(wlan0) 192.168.43.127 c0:bd:d1:4a:3a:0f android-e55b7f59c0dfe96

Wireshark shows the reception of the DHCP REQUEST packet from the client but no DHCP ACK is ever sent. Instead, the host is issuing ARP requests for the offered IP address.

enter image description here

I cannot understand why the host is sending ARP requests for the offered IP address instead of sending the DHCP ACK. Can anyone help me understand what I am seeing and how it can be fixed? Thanks.

EDIT

The wifi hotspot was created by monitoring all commands sent to the netd socket during standard wifi hotspot creation through Android and replaying those commands with /system/bin/ndc.

ndc netd softap fwreload wlan0 AP
ndc netd softap set wlan0 Redskins wpa2-psk DanSnyderSucks
ndc netd softap startap
ndc netd interface getcfg wlan0
ndc netd interface setcfg wlan0 192.168.43.1 24 up multicast running broadcast
ndc netd tether interface add wlan0
ndc netd interface getcfg wlan0
ndc netd network interface add local wlan0
ndc netd network route add local wlan0 192.168.43.0/24
ndc netd ipfwd enable
ndc netd tether start 192.168.42.2 192.168.42.254 192.168.43.2 192.168.43.254 192.168.44.2 192.168.44.254 192.168.45.2 192.168.45.254 192.168.46.2 192.168.46.254 192.168.47.2 192.168.47.254 192.168.48.2 192.168.48.254 192.168.49.2 192.168.49.254
ndc netd tether dns set 501 8.8.8.8 8.8.4.4
ndc netd nat enable wlan0 rmnet0 1 192.168.43.0/24
ndc netd tether ra true wlan0 rmnet0

EDIT

Any suggestions or ideas on where to even begin debugging would be greatly appreciated. I have tried comparing logcat logs and kmsg logs but I have been unable to exact any useful information.

  • Could you mention the command(s) you used to create the hotspot? – Firelord Aug 7 '15 at 3:42
  • I logged all messages over the netd socket during WiFi hotspot creation through the standard Android menu and replayed them later using /system/bin/ndc. See the main edit for the list of commands. – bangelo Aug 7 '15 at 15:45
  • H Sir, i encountered the same issue as yours. did you solved it? could you share your light on this issue? my dnsmasque log indicate that it already sent DHCP offer packet, but in the tcpdump i just found the DHCP discovery packet, not have DHCP offer packet. is it linux network module drop it? appreciated that you can give some suggestion. thansk & Regards, xiangyun – user269379 Jul 22 '18 at 3:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.