forked from openwrt/openwrt
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
02_network
executable file
·48 lines (40 loc) · 915 Bytes
/
02_network
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
. /lib/functions/system.sh
. /lib/functions/uci-defaults.sh
ath79_setup_interfaces()
{
local board="$1"
case "$board" in
mikrotik,routerboard-922uags-5hpacd|\
mikrotik,routerboard-wap-g-5hact2hnd)
ucidef_set_interface_lan "eth0"
;;
*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
esac
}
ath79_setup_macs()
{
local board="$1"
local lan_mac=""
local wan_mac=""
local label_mac=""
local mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)"
case "$board" in
*)
label_mac="$mac_base"
wan_mac="$mac_base"
lan_mac=$(macaddr_add $mac_base 1)
;;
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
}
board_config_update
board=$(board_name)
ath79_setup_interfaces $board
ath79_setup_macs $board
board_config_flush
exit 0