ab87421bb9eb9dc3bb0104205f176b621b42052b
[openwrt/openwrt.git] / target / linux / ramips / base-files / lib / preinit / 07_set_preinit_iface_ramips
1 #!/bin/sh
2 #
3 # Copyright (C) 2013 OpenWrt.org
4 #
5
6 . /lib/ramips.sh
7
8 ramips_set_preinit_iface() {
9 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
10 if [ -n "${RT3X5X}" ]; then
11 swconfig dev rt305x set reset 1
12 fi
13
14 if echo $RT3X5X | grep -q RT5350; then
15 # This is a dirty hack to get by while the switch
16 # problem is investigated. When VLAN is disabled, ICMP
17 # pings work as expected, but TCP connections time
18 # out, so telnetting in failsafe is impossible. The
19 # likely reason is TCP checksumming hardware getting
20 # disabled:
21 # https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg19870.html
22 swconfig dev rt305x set enable_vlan 1
23 swconfig dev rt305x vlan 1 set ports "0 6"
24 swconfig dev rt305x port 6 set untag 0
25 swconfig dev rt305x set apply 1
26 vconfig add eth0 1
27 ifconfig eth0 up
28 ifname=eth0.1
29 else
30 ifname=eth0
31 fi
32 }
33
34 boot_hook_add preinit_main ramips_set_preinit_iface