Restart/reset/reload WiFi without disconnecting current clients

I think that the current code does disconnect all clients from that wifi device that you are reloading but not from the other radio. The "wifi" command always runs down+up, in order to get all changes reflected to the radio that you are configuring.

So, if you make config changes to just one radio, it is likely possible to maintain clients connected to the other radio when you reload the config of the first radio..

If you look at the source code of "wifi", you can see that plain "wifi" affects all radios, but you can also specify just one radio for the "wifi up X" command.
https://git.lede-project.org/?p=source.git;a=blob;f=package/base-files/files/sbin/wifi;hb=HEAD#l125

Only radio0 = wlan0 gets affected below:

root@LEDE:~# wifi down radio0
root@LEDE:~# wifi up radio0
root@LEDE:~# logread | tail -n 20
Mon Dec 18 16:59:07 2017 authpriv.notice dropbear[11817]: Pubkey auth succeeded for 'root' with key sha1!! 25:30:1e:50:42:81:6c:c2:d1:26:9c:02:bf:b0:c2:f7:f4:6b:a3:a1 from 192.168.1.180:50596
Mon Dec 18 17:06:30 2017 daemon.notice netifd: Network device 'wlan0' link is down
Mon Dec 18 17:06:30 2017 kern.info kernel: [188877.715584] device wlan0 left promiscuous mode
Mon Dec 18 17:06:30 2017 kern.info kernel: [188877.715707] br-lan: port 2(wlan0) entered disabled state
Mon Dec 18 17:06:30 2017 kern.warn kernel: [188877.767484] ath10k_pci 0000:01:00.0: peer-unmap-event: unknown peer id 1
Mon Dec 18 17:06:30 2017 kern.warn kernel: [188877.767595] ath10k_pci 0000:01:00.0: peer-unmap-event: unknown peer id 1
Mon Dec 18 17:06:30 2017 kern.warn kernel: [188877.773301] ath10k_pci 0000:01:00.0: peer-unmap-event: unknown peer id 1
Mon Dec 18 17:06:34 2017 daemon.notice netifd: radio0 (11881): command failed: Not supported (-95)
Mon Dec 18 17:06:35 2017 daemon.err hostapd: Configuration file: /var/run/hostapd-phy0.conf
Mon Dec 18 17:06:41 2017 kern.info kernel: [188888.417129] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
Mon Dec 18 17:06:41 2017 kern.info kernel: [188888.425148] br-lan: port 2(wlan0) entered blocking state
Mon Dec 18 17:06:41 2017 kern.info kernel: [188888.425188] br-lan: port 2(wlan0) entered disabled state
Mon Dec 18 17:06:41 2017 kern.info kernel: [188888.430165] device wlan0 entered promiscuous mode
Mon Dec 18 17:06:41 2017 daemon.err hostapd: Using interface wlan0 with hwaddr dc:ef:09:ef:f3:e6 and ssid "HN5WLAN"
Mon Dec 18 17:06:41 2017 kern.info kernel: [188889.238516] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Mon Dec 18 17:06:41 2017 kern.info kernel: [188889.238862] br-lan: port 2(wlan0) entered blocking state
Mon Dec 18 17:06:41 2017 kern.info kernel: [188889.243991] br-lan: port 2(wlan0) entered forwarding state
Mon Dec 18 17:06:41 2017 daemon.notice netifd: Network device 'wlan0' link is up
2 Likes