Core 152: the script "network-hotplug-bridges" now reads the variable ${ZONE}_STP_PRIORITY from /var/ipfire/ethernet/settings so that the priority can be adjusted Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org>

Message ID 20201120173551.4722-1-daniel.weismueller@ipfire.org
State Accepted
Headers
Series Core 152: the script "network-hotplug-bridges" now reads the variable ${ZONE}_STP_PRIORITY from /var/ipfire/ethernet/settings so that the priority can be adjusted Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org> |

Commit Message

Daniel Weismueller Nov. 20, 2020, 5:35 p.m. UTC
  ---
 config/udev/network-hotplug-bridges | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Patch

diff --git a/config/udev/network-hotplug-bridges b/config/udev/network-hotplug-bridges
index 7431377bb..77330b114 100644
--- a/config/udev/network-hotplug-bridges
+++ b/config/udev/network-hotplug-bridges
@@ -82,16 +82,22 @@  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 [ -n "${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 \
-				$([ "${STP}" = "on" ] && echo "stp_state 1")
+				$([ "${STP}" = "on" ] && echo "stp_state 1  priority ${STP_PRIORITY}" ) 
 			#ip link set "${BRIDGE}" up
 		fi