From ff04de0b45fe7f24685af3b9523260a313fd0942 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Wed, 13 Nov 2019 04:49:05 +0000 Subject: Added support for a BROPTS variable to set bridge specific settings. Before, it was not possible to set bridge specific options when creating a bridge. This option adds the ability to set options via a BROPTS variable, which takes a pipe (|) delimited set of options as documented in the ip-link(8) man page (search for "BRIDGE Type Support"). --- rc.inet1 | 6 ++++++ rc.inet1.conf | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/rc.inet1 b/rc.inet1 index 9e2ca2b..5e31c08 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -154,6 +154,12 @@ br_open() { debug_log "/sbin/ip link set dev $BRIF up" /sbin/ip link set dev $BRIF up done + while read -r -d \| BROPT; do + if [ -n "$BROPT" ]; then + debug_log "/sbin/ip link set dev ${IFNAME[$1]} type bridge $BROPT" + /sbin/ip link set dev ${IFNAME[$1]} type bridge $BROPT + fi + done <<<"${BROPTS[$i]}|" # The | on the end is required. debug_log "/sbin/ip link set dev ${IFNAME[$1]} up" /sbin/ip link set dev ${IFNAME[$1]} up } diff --git a/rc.inet1.conf b/rc.inet1.conf index f4d54b1..aba374c 100644 --- a/rc.inet1.conf +++ b/rc.inet1.conf @@ -119,13 +119,18 @@ DEBUG_ETH_UP="no" # Example of how to configure a bridge: # Note the added "BRNICS" variable which contains a space-separated list # of the physical or virtual network interfaces you want to add to the bridge. -#IFNAME[0]="br0" -#BRNICS[0]="eth0" -#IPADDR[0]="192.168.0.1" -#NETMASK[0]="255.255.255.0" -#IPALIASES[0]="" -#USE_DHCP[0]="" -#DHCP_HOSTNAME[0]="" +# BROPTS is a pipe (|) delimited list of bridge module specific settings to be +# applied to the interface. See the ip-link(8) man page (search for "BRIDGE +# Type Support") for details of the options available. This option is not +# required for a standard bridge to be configured. +# IFNAME[0]="br0" +# BRNICS[0]="eth0" +# BROPTS[0]="" +# IPADDR[0]="192.168.0.1" +# NETMASK[0]="24" +# IPALIASES[0]="" +# USE_DHCP[0]="" +# DHCP_HOSTNAME[0]="" # ============================================================================= -- cgit v1.2.3