deddba2408c6ad5726a11e2a121883ce6c1bb906
[openwrt/openwrt.git] / target / linux / lantiq / ase / base-files / etc / board.d / 02_network
1 #!/bin/sh
2 #
3 # Copyright (C) 2011-2015 OpenWrt.org
4 #
5
6 . /lib/functions/uci-defaults.sh
7 . /lib/functions/system.sh
8 . /lib/functions/lantiq.sh
9
10 lantiq_setup_interfaces()
11 {
12 local board="$1"
13
14 case "$board" in
15 *)
16 ucidef_set_interface_lan 'eth0'
17 ;;
18 esac
19 }
20
21 lantiq_setup_dsl()
22 {
23 local board="$1"
24 local annex="b"
25
26 case "$board" in
27 esac
28
29 lantiq_setup_dsl_helper "$annex"
30 }
31
32 lantiq_setup_macs()
33 {
34 local board="$1"
35 local lan_mac=""
36 local wan_mac=""
37
38 case "$board" in
39 allnet,all0333cj)
40 lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
41 wan_mac=$(macaddr_add "$lan_mac" 1)
42 ;;
43 esac
44
45 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
46 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
47 }
48
49 board_config_update
50 board=$(board_name)
51 lantiq_setup_interfaces $board
52 lantiq_setup_dsl $board
53 lantiq_setup_macs $board
54 board_config_flush
55
56 exit 0