Networking – Block WiFi Access Point by MAC address on DD-WRT using client mode WAN connection

dd-wrtwifi-configurationwireless-networking

My router's WAN connection is configured to connect to a subscription based public WiFi network. I am effectively, extending a public WiFi network.

I've determined the public network has three different access points in range of my router (all using same SSID, but on different channels)

I've determined that one of the public WiFi APs for the public WiFi SSID, is faulty. My router's WAN connection roams between the good APs without issue, but when it roams to the bad AP, the internet access drops until the router roams back to one of the good APs.

I have identified the MAC addresses of the good and bad APs.

Given that the public WiFi network is not under my control, is there a way on my router to blacklist/block the faulty access point using its MAC address?

My router is Netgear WNDR3700v4, and I flashed with DD-WRT 06-23-2014-r24461

http://manpages.ubuntu.com/manpages/hardy/man8/iwconfig.8.html

The ap option for iwconfig sounds promising:

man iwconfig(8) ap

Force the card to register to the Access Point given by the
address, if it is possible. This address is the cell identity of
the Access Point, as reported by wireless scanning, which may be
different from its network MAC address. If the wireless link is
point to point, set the address of the other end of the link. If
the link is ad-hoc, set the cell identity of the ad-hoc network.
When the quality of the connection goes too low, the driver may
revert back to automatic mode (the card selects the best Access
Point in range).
You may also use off to re-enable automatic mode without
changing the current Access Point, or you may use any or auto to
force the card to reassociate with the currently best Access
Point.
Example :
iwconfig eth0 ap 00:60:1D:01:23:45

Even when manually setting the AP to connect to, the connection still roams onto the rogue AP.

I've tried using the "Wireless MAC Filter" options in Wireless-Security in the DD-WRT control panel, and whilst they save, they don't seem to have any affect. I suspect this is because the adaptor is in client mode, so the settings aren't applicable.

I've also tried various iw commands like this:

iw dev ath0 station del aA:BB:CC:DD:EE:FF

I've poured over /proc/net/ hoping to find something to read and write values from and to, but still no luck.

Running:

iw dev ath0 disconnect

causes a connection reset, and in my testing, the adaptor always automatically reconnects to one of the good access points. But then, after an indeterminable amount of time, the adaptor roams back to the bad access point and internet access dies.

The only solution I can see at the moment is to write my own connection manager, but without figuring out how to use the tools to do that properly, it's going to be tough.

Best Answer

As per Daniel's comment, startup.sh can modify /tmp/ath0_wpa_supplicant.conf to include variable bssid=<mac of good ap> in the network{} declaration, followed by # kill -HUP "$(pidof "wpa_supplicant")" to signal to wpa_supplicant that it should reload config.

This keeps the adaptor connected to an access point, blocking roaming to other access points.

Related Question