FreeBSD WiFi troubles

I installed FreeBSD 11.1 a couple of days ago on my decade-old Dell XPS M1330 with Intel Core 2 Duo T8100 processor and 4 GB RAM. I had a terrible time as I ended up repeating the installation routine three times. Or was it four?

The installation was trouble-free, every single time. The installer could successfully scan and list all WiFi access points. And there were many. I have a couple of Jio WiFi dongles and a Motorola G5S Plus mobile whose hot-spot I had enabled. The Android USB tethering also worked during installation. However, it was the reboot after installation that drove me nuts every single time.

No network after reboot. No amount of wpa_supplicant and rc.conf tweaking could help me. No ifconfig command variation or dhclient could save me. Even with status: associated the access point would not let me access anything on the internet.

wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 00:21:5c:6a:6c:61
hwaddr 00:21:5c:6a:6c:61
inet 192.168.1.102 netmask 0xffff0000 broadcast 192.168.255.255
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
status: associated
ssid my_ssid channel 11 (2462 MHz 11g ht/20) bssid bc:8a:e8:0a:27:f1
regdomain APAC2 country IN authmode WPA2/802.11i privacy ON
deftxkey UNDEF AES-CCM 2:128-bit txpower 30 bmiss 10 scanvalid 60
protmode CTS ampdulimit 32k ampdudensity 16 -amsdutx amsdurx shortgi
-stbc wme roaming MANUALgroups: wlan

I checked resolv.conf, but did not see anything wrong there either. I tried a few other things, but no luck. I looked in the forums, but nothing. I deleted resolv.conf and rebooted the PC. It worked.

I still have not figured out why it worked. I will get into it when I have time. However, now I can connect to all access points by tweaking the wpa_supplicant file.

ctrl_interface=/var/run/wpa_supplicant
eapol_version=2
ap_scan=1
fast_reauth=1

network={
ssid="my_ssid"
scan_ssid=0
psk="my_password"
priority=5
}
network={
        priority=0
        key_mgmt=NONE
}

The rc.conf values added by the installer is good for all access points.

hostname="my_hostname"
wlans_iwn0="wlan0"
ifconfig_wlan0="WPA DHCP"
create_args_wlan0="country IN regdomain APAC2"
local_unbound_enable="YES"
sshd_enable="YES"
dbus_enable="YES"
moused_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
dumpdev="AUTO"
zfs_enable="YES"