# hostapd connection breaks



## kAldown (May 11, 2015)

Hello there.

Today I noticed some wired behavior from my asus phone, every couple minutes there is no connection with FreeBSD as host based AP.


```
interface=wlan0
debug=2
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
ssid=someSSIDap
wpa=1
wpa_passphrase=PASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP
```


```
% cat /usr/local/etc/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#


ddns-update-style none;
authoritative;
#log-facility local7;

subnet 192.168.40.0 netmask 255.255.255.252 {
  range 192.168.40.2;
  option routers 192.168.40.1;
  option domain-name-servers 109.194.160.1, 109.194.161.1;
  default-lease-time 600;
  max-lease-time 7200;
}
```


```
%cat /etc/rc.conf

wlans_ath0="wlan0"
create_args_wlan0="wlanmode hostap"
ifconfig_wlan0="inet 192.168.40.1 netmask 255.255.255.252 ssid freebsdap mode 11g channel 1"

gateway_enable="YES"
hostapd_enable="YES"

dhcpd_enable="YES"
dhcpd_ifaces="wlan0"
```


```
% ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 90:48:9a:2f:ba:db
    inet 192.168.40.1 netmask 0xfffffffc broadcast 192.168.40.3
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
    status: running
    ssid someSSIDap channel 1 (2412 MHz 11g) bssid 90:48:9a:2f:ba:db
    regdomain 96 indoor ecm authmode WPA privacy MIXED deftxkey 2
    TKIP 2:128-bit TKIP 3:128-bit txpower 20 scanvalid 60 protmode CTS wme
    burst dtimperiod 1 -dfs
```

After deleting leases:

```
sudo rm /var/db/dhcpd/dhcpd.leases*
sudo service isc-dhcpd restart
```


```
% tail -F /var/db/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.3.2

server-duid "\000\001\000\001\034\343\242\333\220H\232/\272\333";

lease 192.168.40.2 {
  starts 1 2015/05/11 17:27:27;
  ends 1 2015/05/11 17:37:27;
  cltt 1 2015/05/11 17:27:27;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 38:2c:4a:31:f2:df;
  set vendor-class-identifier = "dhcpcd-5.5.6";
  client-hostname "android-2ecfdfe8e3914a5a";
}
lease 192.168.40.2 {
  starts 1 2015/05/11 17:30:29;
  ends 1 2015/05/11 17:40:29;
  cltt 1 2015/05/11 17:30:29;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 38:2c:4a:31:f2:df;
  set vendor-class-identifier = "dhcpcd-5.5.6";
  client-hostname "android-2ecfdfe8e3914a5a";
}
```


```
%tail -F /var/log/messages

May 11 22:27:03 d15 kernel: wlan0: ieee80211_new_state_locked: pending RUN -> SCAN transition lost
```

Questions:

What's wrong with, because there was internet on my phone for a months, and now there is a problem, but I didn't change anything, even no port upgrades?
Why net/isc-dhcpd tries to apply same ip to one device couple times?
How to debug more deep, /var/log/messages shows at least nothing?

P.S. I have another device (ipod) which act the same way - breaks connection sometimes.
P.S.2 If i will ping to device, there would be tunnel, as long as ping goes.


----------



## kAldown (May 11, 2015)

Ok. Resetting phone factory solve the problem.


----------



## kAldown (May 13, 2015)

and it's back again


----------



## kAldown (Jun 14, 2015)

Please, somebody help, or give an advice at least.


----------



## kAldown (Aug 1, 2015)

Sorry for being rude, making this thread, but I can't understand, why my configuration on previous system working well, and breaks for new-installed system with same configure.
Thread hostapd-connection-breaks.51580/


----------

