3 # Copyright (C) 2011 OpenWrt.org
6 . /lib/functions/uci-defaults-new.sh
10 board=$(cat /proc/device-tree/compatible | tr '\0' '\t' | cut -f 1)
23 # Workaround for devices using eth2
30 ucidef_set_interface_loopback
31 ucidef_set_interfaces_lan_wan "$ifname.1" "$ifname.2"
32 ucidef_add_switch "switch0" "1" "1"
34 # Workaround for devices using CPU port 8 (connected to eth2)
37 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
38 ucidef_add_switch_vlan "switch0" "2" "4 5t"
44 # NVRAM entries may contain unsorted ports, e.g. Netgear R6250 uses
45 # vlan1ports=3 2 1 0 5*
47 # and early Netgear R8000 was using
48 # vlan1ports=3 2 1 0 5 7 8*
49 vlan1ports="$(echo $(nvram get vlan1ports | tr " " "\n" | sort))"
50 vlan2ports="$(echo $(nvram get vlan2ports | tr " " "\n" | sort))"
51 if echo "$vlan1ports" | egrep -q "^1 2 3 4 5" && \
52 echo "$vlan2ports" | egrep -q "^0 5"; then
53 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
54 ucidef_add_switch_vlan "switch0" "2" "0 5t"
55 elif echo "$vlan1ports" | egrep -q "^1 2 3 5 7" && \
56 echo "$vlan2ports" | egrep -q "^0 7"; then
57 ucidef_add_switch_vlan "switch0" "1" "1 2 3 5 7t"
58 ucidef_add_switch_vlan "switch0" "2" "0 7t"
59 elif echo "$vlan1ports" | egrep -q "^0 1 2 3 5 7 8" && \
60 echo "$vlan2ports" | egrep -q "^4 8"; then
61 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5 7 8t"
62 ucidef_add_switch_vlan "switch0" "2" "4 8t"
64 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
65 ucidef_add_switch_vlan "switch0" "2" "4 5t"