]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - config/udev/network-hotplug-bridges
udev: Set all wireless interfaces to master mode before adding to bridge
[people/pmueller/ipfire-2.x.git] / config / udev / network-hotplug-bridges
index 5144a7712d5fedc82e0cd482148e65c0ab79202b..a2ee56b8365d356b4b4c4c2ee565979485c10a76 100644 (file)
@@ -72,6 +72,7 @@ ZONE=$(detect_zone)
 
 # Cannot proceed if we could not find a zone
 if [ -z "${ZONE}" ]; then
+       logger "Could not find a bridged zone for ${INTERFACE}"
        exit 0
 fi
 
@@ -80,19 +81,33 @@ MODE="$(get_value "${ZONE}_MODE")"
 
 # The name of the virtual bridge
 BRIDGE="$(get_value "${ZONE}_DEV")"
+STP="$(get_value "${ZONE}_STP")"
+STP_PRIORITY="$(get_value "${ZONE}_STP_PRIORITY")"
 
 case "${MODE}" in
        bridge)
+               # We need to check if $STP_PRIORITY has a valid value if not set it
+               if [ -z "${STP_PRIORITY}" ]; then
+                       STP_PRIORITY=16384
+               fi
+
                ADDRESS="$(get_value "${ZONE}_MACADDR")"
                [ -n "${ADDRESS}" ] || ADDRESS="$(random_mac_address)"
 
                # We need to create the bridge if it doesn't exist, yet
                if [ ! -d "/sys/class/net/${BRIDGE}" ]; then
-                       ip link add "${BRIDGE}" address "${ADDRESS}" type bridge
+                       ip link add "${BRIDGE}" address "${ADDRESS}" type bridge \
+                               $([ "${STP}" = "on" ] && echo "stp_state 1  priority ${STP_PRIORITY}" )
                        #ip link set "${BRIDGE}" up
                fi
 
+               # Try setting wireless interfaces into master mode
+               if [ -d "/sys/class/net/${INTERFACE}/phy80211" ]; then
+                       iw dev "${INTERFACE}" set type __ap
+               fi
+
                # Attach the physical device
+               logger "Attach ${INTERFACE} to ${BRIDGE}"
                ip link set dev "${INTERFACE}" master "${BRIDGE}"
                ip link set dev "${INTERFACE}" up
                ;;