blob: c741406813b0fb63a55c69194daf7b0c17eba59b [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#!/bin/sh
2#
3# internet.sh,v 10.08.05 2010-08-05 15:00:00
4#
5# usage: internet.sh
6#
7path_sh=`nv get path_sh`
8. $path_sh/global.sh
9echo "Info: internet.sh start" > $test_log
10echo "Info: `date +%m-%d %H:%M:%S`" >> $test_log
11
12genSysFiles()
13{
14 login=`nv get Login`
15 pass=`nv get Password`
16 echo "$login::0:0:Adminstrator:/:/bin/sh" > /etc/passwd
17 echo "$login:x:0:$login" > /etc/group
18 echo "$login:$pass" > /tmp/tmpchpw
19 chpasswd < /tmp/tmpchpw
20 rm -f /tmp/tmpchpw
21}
22user_login=`cat /etc/passwd | grep admin`
23#user_login²»´æÔÚ»òΪ¿ÕʱºòÖ´Ðк¯ÊýgenSysFiles
24[ -n "$user_login" ] || { genSysFiles;}
25
26safe_run()
27{
28 ps_tmp=`nv get path_log`"ps.tmp"
29 ps > ${ps_tmp}
30 flag=`grep -w "$1" ${ps_tmp}`
31 if [ "-${flag}" = "-" ];then
32 $1 &
33 fi
34 rm -rf ${ps_tmp}
35}
36
37#¶¯Ì¬nvÖÿÕ
38#. $path_sh/cfgnv_init.sh
39pswan=`nv get pswan`
40ethwan=`nv get ethwan`
41wifiwan=`nv get wifiwan`
42echo 0 > /proc/sys/net/ipv6/conf/$pswan"1"/accept_ra
43echo 0 > /proc/sys/net/ipv6/conf/$pswan"2"/accept_ra
44echo 0 > /proc/sys/net/ipv6/conf/$pswan"3"/accept_ra
45echo 0 > /proc/sys/net/ipv6/conf/$pswan"4"/accept_ra
46echo 0 > /proc/sys/net/ipv6/conf/$pswan"5"/accept_ra
47echo 0 > /proc/sys/net/ipv6/conf/$pswan"6"/accept_ra
48echo 0 > /proc/sys/net/ipv6/conf/$pswan"7"/accept_ra
49echo 0 > /proc/sys/net/ipv6/conf/$pswan"8"/accept_ra
50if [ "-$ethwan" != "-" ]; then
51 echo 0 > /proc/sys/net/ipv6/conf/$ethwan/accept_ra
52fi
53if [ "-$wifiwan" != "-" ]; then
54 echo 0 > /proc/sys/net/ipv6/conf/$wifiwan/accept_ra
55fi
56
57#°²È«ÒªÇó
58echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
59echo 0 > /proc/sys/net/ipv4/conf/default/send_redirects
60echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
61echo 0 > /proc/sys/net/ipv4/conf/default/accept_redirects
62echo 0 > /proc/sys/net/ipv6/conf/all/accept_redirects
63echo 0 > /proc/sys/net/ipv6/conf/default/accept_redirects
64echo 0 > /proc/sys/net/ipv4/conf/all/secure_redirects
65echo 0 > /proc/sys/net/ipv4/conf/default/secure_redirects
66
67#EC ÉèÖÃÁ¬½Ó¸ú×Ù×î´óÖµ,·Åµ½rcÀïÃæÅäÖÃ
68#echo 2000 > /proc/sys/net/nf_conntrack_max
69echo 7200 > /proc/sys/net/netfilter/nf_conntrack_tcp_timeout_established
70
71#zte_mainctrl &
72
73#½«br_name,usblan_name´«¸øÄÚºËʵÏÖÆ½Ì¨»¯
74fast_usb=`nv get fast_usb`
75lan_enable=`nv get LanEnable`
76
77#LanEnableΪ2ʱºòûÓÐbr£¬²»ÐèҪдbr_name
78if [ "$lan_enable" != "2" ]; then
79 echo $lan_if > /proc/net/br_name
80fi
81
82echo $fast_usb > /proc/net/usb_name
83
84echo "" > /etc/resolv.conf
85
86#br0´î½¨£¬¼°ÄÚÍødhcp
87sh $path_sh/lan.sh
88
89#½«¿ìËÙת·¢¼¶±ð´«¸øÄÚºË
90fastnat_level=`nv get fastnat_level`
xf.li6236ea72023-07-26 04:58:33 -070091echo "Info: set fastnat_level: $fastnat_level" >> $test_log
lh9ed821d2023-04-07 01:36:19 -070092echo $fastnat_level > /proc/net/fastnat_level
93
xf.lif2330622024-05-15 18:17:18 -070094fastbr_level=`nv get fastbr_level`
95echo "Info: set fastbr_level: $fastbr_level" >> $test_log
96echo $fastbr_level > /proc/net/fastbr_level
97
lh9ed821d2023-04-07 01:36:19 -070098#½«²»Ö§³Ö¿ìËÙת·¢µÄЭÒé¶Ë¿ÚºÅ´«¸øÄÚºË
99nofast_port=`nv get nofast_port`
xf.li6236ea72023-07-26 04:58:33 -0700100echo "Info: set nofast_port: $nofast_port" >> $test_log
lh9ed821d2023-04-07 01:36:19 -0700101echo $nofast_port > /proc/net/nofast_port
102
xf.li7ccf8372024-03-07 00:08:02 -0800103#½«ÊÇ·ñ¸ù¾ÝRA±¨ÎÄÅäÖÃÍø¿ÚµÄmtu´«¸øÄÚºË
104ra_mtu_enable=`nv get ra_mtu_enable`
105echo "Info: set ra_mtu_enable£º$ra_mtu_enable" >> $test_log
106echo $ra_mtu_enable > /sys/module/psnet_io/parameters/ra_mtu_enable
107
lh9ed821d2023-04-07 01:36:19 -0700108#SKB debug¿ª¹Ø
109skb_debug=`nv get skb_debug`
xf.li6236ea72023-07-26 04:58:33 -0700110echo "Info: set skb_debug: $skb_debug" >> $test_log
lh9ed821d2023-04-07 01:36:19 -0700111if [ "-$skb_debug" != "-1" ]; then
112 echo 0 > /proc/net/skb_debug_off
113fi
114
115killall -9 miniupnpd
116rm -rf $path_conf/inadyn.status
117
118#¼Ç¼½ø³Ì±»ºÎÖÖÐźÅkilledµô
119netdog -s exitsig=1
120
121#¼à¿ØÄÚºËskbÏà¹ØÐÅÏ¢µÄ×î´óÖµ
122#safe_run netmonitor
123
124#¼à¿ØÄں˵Änetlinkʼþ´æÎļþ£¬Ö§³ÖÄÚºË×Ô¶¨Òåʼþ£¬Òò»áдflash°æ±¾Ä¬ÈϹرÕ
125#safe_run event_proc