2012-05-29 16:39:15 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2014-05-28 21:43:39 +00:00
|
|
|
# Copyright (C) 2012-2014 OpenWrt.org
|
2012-05-29 16:39:15 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
[ -e /etc/config/network ] && exit 0
|
|
|
|
|
2013-10-14 19:46:40 +00:00
|
|
|
touch /etc/config/network
|
|
|
|
|
2012-05-29 16:39:15 +00:00
|
|
|
set_lan_dhcp() {
|
|
|
|
local ifname=$1
|
|
|
|
uci batch <<EOF
|
|
|
|
set network.lan='interface'
|
|
|
|
set network.lan.ifname='$ifname'
|
|
|
|
set network.lan.proto='dhcp'
|
2013-04-09 08:03:08 +00:00
|
|
|
set network.lan6='interface'
|
|
|
|
set network.lan6.ifname='@lan'
|
|
|
|
set network.lan6.proto='dhcpv6'
|
|
|
|
set network.lan6.reqprefix='no'
|
2012-05-29 16:39:15 +00:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2014-12-18 18:38:38 +00:00
|
|
|
add_port_based_vlan() {
|
|
|
|
local device=$1
|
|
|
|
local vlan=$2
|
|
|
|
local ports=$3
|
|
|
|
uci batch <<EOF
|
|
|
|
add network switch_vlan
|
|
|
|
set network.@switch_vlan[-1].device='$device'
|
|
|
|
set network.@switch_vlan[-1].vlan='$vlan'
|
|
|
|
set network.@switch_vlan[-1].ports='$ports'
|
|
|
|
set network.@switch_vlan[-1].port_based='1'
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2012-05-29 16:39:15 +00:00
|
|
|
. /lib/functions/uci-defaults.sh
|
2014-06-26 10:13:47 +00:00
|
|
|
. /lib/kirkwood.sh
|
2014-06-24 18:18:53 +00:00
|
|
|
|
|
|
|
board=$(kirkwood_board_name)
|
2012-05-29 16:39:15 +00:00
|
|
|
|
|
|
|
ucidef_set_interface_loopback
|
|
|
|
|
2014-06-24 18:18:53 +00:00
|
|
|
case "$board" in
|
|
|
|
"dockstar")
|
2012-05-29 16:39:15 +00:00
|
|
|
set_lan_dhcp "eth0"
|
|
|
|
;;
|
2014-06-24 18:18:53 +00:00
|
|
|
"iconnect")
|
2014-02-15 23:53:08 +00:00
|
|
|
set_lan_dhcp "eth0"
|
|
|
|
;;
|
2014-06-24 18:18:53 +00:00
|
|
|
"ib62x0")
|
2012-05-29 16:39:15 +00:00
|
|
|
set_lan_dhcp "eth0"
|
|
|
|
;;
|
2014-06-24 18:18:53 +00:00
|
|
|
"pogo_e02")
|
2013-10-31 12:04:04 +00:00
|
|
|
set_lan_dhcp "eth0"
|
|
|
|
;;
|
2014-11-10 23:55:10 +00:00
|
|
|
"ea3500")
|
|
|
|
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
|
|
|
;;
|
2014-06-24 18:18:53 +00:00
|
|
|
"ea4500")
|
2014-05-28 21:43:39 +00:00
|
|
|
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
2014-12-18 18:38:38 +00:00
|
|
|
ucidef_add_switch "switch0" "1" "0"
|
|
|
|
add_port_based_vlan "switch0" "1" "0 1 2 3 5"
|
|
|
|
add_port_based_vlan "switch0" "2" "4 6"
|
2014-05-28 21:43:39 +00:00
|
|
|
;;
|
2012-05-29 16:39:15 +00:00
|
|
|
*)
|
|
|
|
ucidef_set_interface_lan "eth0"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
uci commit network
|
|
|
|
|
|
|
|
exit 0
|