summaryrefstree
path: root/system/bin/netbox.sh
blob: 87b7d53f0544ad211bb22cf9d72574f89d13d825 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/system/bin/sh

LOG_TAG="netbox.sh"

function nlog()
{
	log -p d -t "$LOG_TAG" $@ 
}

function exe_log()
{
	local cmd="$@"
	local emsg="$(eval $cmd 2>&1)"

	log -p d -t "$LOG_TAG" "$cmd ecode=$? $emsg"
}

function gro_switch()
{
	exe_log "echo $1 > /sys/module/seth/parameters/gro_enable"
}

#for reliance to have BIP test over ipv6
function stk_bip_test()
{
	nlog "start stk logic"
	is_stk=`getprop persist.sys.bip.channel`
	nlog "is_stk = $is_stk."
	if [ $is_stk == "1" ]; then
		nlog "now it is bip test over ipv6"
		ip_addr=`getprop persist.sys.bip.ipv6_addr`
		table_idx=`getprop persist.sys.bip.table_index`
		nlog "ip addr = $ip_addr."
		nlog "table index = $table_idx."
		exe_log "ip -6 rule add from $ip_addr lookup $table_idx"
	else
		nlog "is_stk is not set!"
	fi
}

if [ "$1" == "gro" ]; then
	if [ "$2" == "on" ]; then
		gro_switch 1;
	elif [ "$2" == "off" ]; then
		gro_switch 0;
	fi
elif [ "$1" == "stk" ]; then
	stk_bip_test    
fi