86a47b4a07d7d32421a6e770591d8e570d4ec765
[openwrt/openwrt.git] / target / linux / lantiq / base-files / etc / uci-defaults / 02_network
1 #!/bin/sh
2 #
3 # Copyright (C) 2011-2012 OpenWrt.org
4 #
5
6 [ -e /etc/config/network ] && exit 0
7
8 set_atm_wan() {
9 local vpi=$1
10 local vci=$2
11 local encaps=$3
12 local payload=$4
13 uci batch <<EOF
14 set network.atm='atm-bridge'
15 set network.atm.vpi='$vpi'
16 set network.atm.vci='$vci'
17 set network.atm.encaps='$encaps'
18 set network.atm.payload='$payload'
19 set network.wan='interface'
20 set network.wan.ifname='nas0'
21 set network.wan.proto='pppoe'
22 set network.wan.username='foo'
23 set network.wan.password='bar'
24 set network.wan.ipv6='1'
25 set network.wan6='interface'
26 set network.wan6.ifname='@wan'
27 set network.wan6.proto='dhcpv6'
28 EOF
29 }
30
31 . /lib/functions/uci-defaults.sh
32 . /lib/functions/lantiq.sh
33
34 touch /etc/config/network
35
36 ucidef_set_interface_loopback
37 ucidef_set_interface_lan 'eth0'
38
39 vpi=1
40 vci=32
41 encaps="llc"
42 payload="bridged"
43
44 board=$(lantiq_board_id)
45
46 case "$board" in
47 # adm6996
48 ARV4520PW)
49 ucidef_set_interface_lan "eth0.1"
50 ucidef_add_switch "eth0" "1" "1"
51 ucidef_add_switch_vlan "eth0" "1" "3 2 1 0 5t"
52 ;;
53
54 ACMP252|GIGASX76X)
55 ucidef_set_interface_lan "eth0.1"
56 ucidef_add_switch "eth0" "1" "1"
57 ucidef_add_switch_vlan "eth0" "1" "4 3 2 1 5t"
58 ;;
59
60 # ar8316
61 ARV4519PW|ARV7518PW|ARV752DPW22)
62 ucidef_set_interface_lan "eth0.1"
63 ucidef_add_switch "switch0" "1" "1"
64 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
65 ;;
66
67 WBMR)
68 ucidef_set_interface_lan "eth0.1"
69 ucidef_add_switch "switch0" "1" "1"
70 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
71 ;;
72
73 VG3503J)
74 ucidef_set_interface_lan 'eth0'
75 uci set network.lan.type='none'
76 ;;
77
78 DGN3500*)
79 ucidef_set_interface_lan "eth0.1"
80 ucidef_add_switch "switch0" "1" "1"
81 ucidef_add_switch_vlan "switch0" "1" "3 2 1 0 5t"
82 ;;
83
84 GR7000)
85 ucidef_set_interface_wan "eth0"
86 uci set network.lan.ifname=''
87 ;;
88
89 H201L)
90 ucidef_set_interface_lan "eth0.1"
91 ucidef_add_switch "switch0" "1" "1"
92 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4t"
93 ;;
94
95 P2601HNFX)
96 ucidef_set_interface_lan "eth0.1"
97 ucidef_add_switch "switch0" "1" "1"
98 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
99 ;;
100 esac
101
102 [ -z "$(ls /lib/modules/`uname -r`/ltq_atm*)" ] || set_atm_wan "$vpi" "$vci" "$encaps" "$payload"
103
104
105 uci commit network
106
107 exit 0