WLAN unknown deconfig event
Closed this issue · 2 comments
Environment
- Elixir version (
elixir -v
): 1.8.1 - Nerves environment: (
mix nerves.env --info
)
Nerves environment
MIX_TARGET: rpi3
MIX_ENV: dev
|nerves_bootstrap| Environment Variable List
target: rpi3
toolchain: /Users/nico/.nerves/artifacts/nerves_toolchain_arm_unknown_linux_gnueabihf-darwin_x86_64-1.1.0
system: /Users/nico/.nerves/artifacts/kit_rpi3-portable-1.2.0
app: /Users/nico/Uptime/bricksburg/kit_os
- Additional information about your host, target hardware or environment that
may help
Hardware: Raspberry PI 3
Network: Both wifi(wlan0) and lan(eth0) configured
Current behavior
I received this error from one of our Raspberry Pi's running Nerves. I've not been able to reproduce it, unfortunately.
Hope it can be of some use to you anyway. Let me know if not, and I'll investigate further.
[error] GenServer :"Nerves.Network.Interface.wlan0" terminating
** (FunctionClauseError) no function clause matching in Nerves.Network.WiFiManager.consume/3
(nerves_network) lib/nerves_network/wifi_manager.ex:279: Nerves.Network.WiFiManager.consume(:up, {:deconfig, %{ifname: "wlan0"}}, %Nerves.Network.WiFiManager{context: :up, current_id: 0, dhcp_pid: #PID<0.2090.0>, dhcpd_pid: nil, ifname: "wlan0", ip_settings: %{0 => %{ipv4_address_method: :dhcp}}, settings: %{networks: [%{ipv4_address_method: :dhcp, key_mgmt: :"WPA-PSK", priority: 1000, psk: "uptime2011", ssid: "uptime.dk"}]}, wpa_pid: #PID<0.2088.0>, wpa_settings: %{0 => %{key_mgmt: :"WPA-PSK", priority: 1000, psk: "uptime2011", ssid: "uptime.dk"}}})
(nerves_network) lib/nerves_network/wifi_manager.ex:242: Nerves.Network.WiFiManager.handle_info/2
(stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
(stdlib) gen_server.erl:711: :gen_server.handle_msg/6
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {Nerves.Udhcpc, :deconfig, %{ifname: "wlan0"}}
State: %Nerves.Network.WiFiManager{context: :up, current_id: 0, dhcp_pid: #PID<0.2090.0>, dhcpd_pid: nil, ifname: "wlan0", ip_settings: %{0 => %{ipv4_address_method: :dhcp}}, settings: %{networks: [%{ipv4_address_method: :dhcp, key_mgmt: :"WPA-PSK", priority: 1000, psk: "uptime2011", ssid: "uptime.dk"}]}, wpa_pid: #PID<0.2088.0>, wpa_settings: %{0 => %{key_mgmt: :"WPA-PSK", priority: 1000, psk: "uptime2011", ssid: "uptime.dk"}}}
Expected behavior
According to the udhcpc documentation:
deconfig: This argument is used when udhcpc starts, and
when a leases is lost. The script should put the interface in an
up, but deconfigured state, ie: ifconfig $interface 0.0.0.0.
Neither DHCPManager nor WifiManager is able to consume the :deconfig
event when in the :up
state. I suppose the effect of crashing is that a new manager and thus a new address is leased, but perhaps it would be better to request a new lease without crashing?
I wonder if the lease ran out and udhcpc
decided that it should deconfigure the interface? It seems like udhcpc
should automatically start requesting an address again. Agree that it would be better to handle it than crashing.