|
|
|
@ -301,39 +301,9 @@ uci set network.lan.gateway=$dns
|
|
|
|
|
uci set system.@system[0].hostname=$gateway
|
|
|
|
|
|
|
|
|
|
# Configure LAN bridge and add ethernet interfaces to the bridge
|
|
|
|
|
# uci set network.lan.ifname='eth0 eth1 wan lan1 lan2 lan3' # Add ethernet interfaces and the kitchen sink here
|
|
|
|
|
uci set network.lan.ifname='eth0 eth1 wan lan1 lan2 lan3' # Add ethernet interfaces and the kitchen sink here
|
|
|
|
|
uci set network.lan.type='bridge'
|
|
|
|
|
|
|
|
|
|
# List of interfaces to ensure are part of the bridge
|
|
|
|
|
declare -a interfaces_to_check=('bat0' 'eth0' 'eth1' 'lan1' 'lan2' 'wan')
|
|
|
|
|
|
|
|
|
|
# Load the network configuration
|
|
|
|
|
config_load network
|
|
|
|
|
|
|
|
|
|
# Get the current list of bridge ports for 'br-lan'
|
|
|
|
|
config_get bridge_ports br-lan ports
|
|
|
|
|
|
|
|
|
|
# Convert the list to an array
|
|
|
|
|
IFS=' '
|
|
|
|
|
read -ra current_ports <<< "$bridge_ports"
|
|
|
|
|
|
|
|
|
|
# Function to check and add interface to br-lan if not present
|
|
|
|
|
add_interface_to_bridge() {
|
|
|
|
|
local interface=$1
|
|
|
|
|
if [[ ! " ${current_ports[*]} " =~ " ${interface} " ]]; then
|
|
|
|
|
# Interface not found in current bridge ports, add it
|
|
|
|
|
uci add_list network.br-lan.ports="$interface"
|
|
|
|
|
echo "Interface ${interface} added to br-lan."
|
|
|
|
|
else
|
|
|
|
|
echo "Interface ${interface} is already part of br-lan."
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Loop through each interface and check/add to bridge
|
|
|
|
|
for interface in "${interfaces_to_check[@]}"; do
|
|
|
|
|
add_interface_to_bridge "$interface"
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# If you also need to configure the wireless network to be part of the bridge:
|
|
|
|
|
uci set wireless.default_$apall.network='lan' # Make sure the Wi-Fi is part of the lan network
|
|
|
|
|
|
|
|
|
|