No DHCP lease received on open Wi-Fi if wpa_supplicant is on

This is a weird one. Yes, I did search the forums beforehand and nobody seems to have had the same problem as me.

Context: I'm trying out FreeBSD (more precisely NomadBSD, I still need to get comfortable with the system before really installing it) on my laptop. Drivers for the network card work fine, I can connect to my phone as a Wi-Fi router out of the box using networkmgr, so both wpa_supplicant (used for authenticating) and dhclient (for DHCP) work fine. However, my building has an open wireless network set up where I have to login to a captive portal. Again, I can connect to the network via networkmgr without a problem, and in wpa_supplicant.conf I get the obvious profile attached to it:

Code:
network={
 ssid="Open Network Name"
 key_mgmt=NONE
}

But there is no Internet connection. So I looked into it, and I realized that for this particular network, dhclient wasn't working as expected: it sent requests but received no response, so it gave up and left an empty resolv.conf. That's why I had no connection.

The weird part is how I fixed it: I had ifconfig_wlan0="WPA DHCP" in rc.conf and I set it to ifconfig_wlan0="DHCP". If I understand correctly, this makes it so that wpa_supplicant is not called when connecting to any network. Now I can connect to my building's open Wi-Fi and DHCP works with no problems; however, in disabling wpa_supplicant, I also disabled my ability to connect to any Wi-Fi network that does need authentication.

I don't want to have to change rc.conf every time I connect to a new Wi-Fi network. I ask you humbly:
  1. Do you understand why in the world this works? Like, why disabling wpa_supplicant for this particular network makes DHCP work, whereas it just works as normal for other networks?
  2. Is there a better way to do this?
Thanks in advance. :)
 
Back
Top