summaryrefslogtreecommitdiff
path: root/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
blob: 3dce1b667bb88a8934c5300f50fe1e0956a339b0 (plain)
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
#!/bin/sh
#
# Copyright (C) 2013 OpenWrt.org
#

. /lib/ramips.sh

ramips_set_preinit_iface() {
	RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350|MT7628|MT7688)"`
	if [ -n "${RT3X5X}" ]; then
		swconfig dev rt305x set reset 1
	fi

	if echo $RT3X5X | egrep -q "(RT5350|MT7628|MT7688)"; then
		# This is a dirty hack to get by while the switch
		# problem is investigated. When VLAN is disabled, ICMP
		# pings work as expected, but TCP connections time
		# out, so telnetting in failsafe is impossible. The
		# likely reason is TCP checksumming hardware getting
		# disabled:
		# https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg19870.html
		swconfig dev rt305x set enable_vlan 1
		swconfig dev rt305x vlan 1 set ports "0 6"
		swconfig dev rt305x port 6 set untag 0
		swconfig dev rt305x set apply 1
		ip link add link eth0 name eth0.1 type vlan id 1
		ip link set eth0 up
		ifname=eth0.1
	else
		ifname=eth0
	fi
}

boot_hook_add preinit_main ramips_set_preinit_iface