[2/2] udev: Set wireless interfaces into AP mode before adding to bridge

Message ID 20200214134819.23170-2-michael.tremer@ipfire.org
State Accepted
Commit b53d8ae99b8e2f4164824413b2f771ae54dbe9a7
Headers
Series [1/2] udev: Add more logging to bridge hotplug script |

Commit Message

Michael Tremer Feb. 14, 2020, 1:48 p.m. UTC
  Wireless interfaces cannot be added to the bridge when they are
still running in station mode. At boot time, the interface will
be created and it is attempted to attach it to a bridge, which
fails.

This patch now checks whether the wireless interface is going to
be an access point, changes the mode accordingly and then attaches
the interface to the bridge.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
---
 config/udev/network-hotplug-bridges | 4 ++++
 1 file changed, 4 insertions(+)
  

Patch

diff --git a/config/udev/network-hotplug-bridges b/config/udev/network-hotplug-bridges
index 30a671f04..33d6d65ba 100644
--- a/config/udev/network-hotplug-bridges
+++ b/config/udev/network-hotplug-bridges
@@ -93,6 +93,10 @@  case "${MODE}" in
 			#ip link set "${BRIDGE}" up
 		fi
 
+		if grep -q "INTERFACE=${INTERFACE}" "/var/ipfire/wlanap/settings" 2>/dev/null; then
+			iw dev "${INTERFACE}" set type __ap
+		fi
+
 		# Attach the physical device
 		logger "Attach ${INTERFACE} to ${BRIDGE}"
 		ip link set dev "${INTERFACE}" master "${BRIDGE}"