94dea9a24e468be1a2dea36fe1a346f6b8ebddff
[openwrt/staging/dedeckeh.git] / target / linux / lantiq / base-files / etc / uci-defaults / 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.unit='0'
16 set network.atm.vpi='$vpi'
17 set network.atm.vci='$vci'
18 set network.atm.encaps='$encaps'
19 set network.atm.payload='$payload'
20 set network.wan='interface'
21 set network.wan.ifname='nas0'
22 set network.wan.proto='pppoe'
23 set network.wan.username='foo'
24 set network.wan.password='bar'
25 EOF
26 }
27
28 set_adsl() {
29 local fwannex=$1
30 local annex=$2
31 uci batch <<EOF
32 set network.adsl='adsl-device'
33 set network.adsl.fwannex='$fwannex'
34 set network.adsl.annex='$annex'
35 EOF
36 }
37
38 . /lib/functions/uci-defaults.sh
39 . /lib/lantiq.sh
40
41 touch /etc/config/network
42
43 ucidef_set_interface_loopback
44 ucidef_set_interface_lan 'eth0'
45
46 vpi=1
47 vci=32
48 encaps="llc"
49 payload="bridged"
50 fwannex=$(lantiq_dsl_fwannex)
51 board=$(lantiq_board_name)
52 dsl=$(lantiq_soc_has_adsl)
53
54 case "$board" in
55 # annex B with adm6996
56 ARV4520PW|GIGASX76X)
57 ucidef_set_interface_lan "eth0.1"
58 ucidef_add_switch "eth0" "1" "1"
59 ucidef_add_switch_vlan "eth0" "1" "1 2 3 4 5t"
60 set_adsl "b" "b2p"
61 ;;
62
63 # annex A with ar8316
64 ARV4519PW|ARV7518PW)
65 ucidef_set_interface_lan "eth0.1"
66 ucidef_add_switch "eth0" "1" "1"
67 ucidef_add_switch_vlan "eth0" "1" "0t 2 3 4 5"
68 set_adsl "a" "a2p"
69 ;;
70
71 ARV7525PW|ARV4525PW|*)
72 set_adsl "$fwannex" "${fwannex}2p"
73 ;;
74 esac
75
76 [ -z "$dsl" ] || set_atm_wan "$vpi" "$vci" "$encaps" "$payload"
77
78 uci commit network
79
80 exit 0