lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # internet.sh,v 10.08.05 2010-08-05 15:00:00 |
| 4 | # |
| 5 | # usage: internet.sh |
| 6 | # |
| 7 | path_sh=`nv get path_sh` |
| 8 | . $path_sh/global.sh |
| 9 | echo "Info: internet.sh start" > $test_log |
| 10 | echo "Info: `date +%m-%d %H:%M:%S`" >> $test_log |
| 11 | |
| 12 | genSysFiles() |
| 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 | } |
| 22 | user_login=`cat /etc/passwd | grep admin` |
| 23 | #user_login²»´æÔÚ»òΪ¿ÕʱºòÖ´Ðк¯ÊýgenSysFiles |
| 24 | [ -n "$user_login" ] || { genSysFiles;} |
| 25 | |
| 26 | safe_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 |
| 39 | pswan=`nv get pswan` |
| 40 | ethwan=`nv get ethwan` |
| 41 | wifiwan=`nv get wifiwan` |
| 42 | echo 0 > /proc/sys/net/ipv6/conf/$pswan"1"/accept_ra |
| 43 | echo 0 > /proc/sys/net/ipv6/conf/$pswan"2"/accept_ra |
| 44 | echo 0 > /proc/sys/net/ipv6/conf/$pswan"3"/accept_ra |
| 45 | echo 0 > /proc/sys/net/ipv6/conf/$pswan"4"/accept_ra |
| 46 | echo 0 > /proc/sys/net/ipv6/conf/$pswan"5"/accept_ra |
| 47 | echo 0 > /proc/sys/net/ipv6/conf/$pswan"6"/accept_ra |
| 48 | echo 0 > /proc/sys/net/ipv6/conf/$pswan"7"/accept_ra |
| 49 | echo 0 > /proc/sys/net/ipv6/conf/$pswan"8"/accept_ra |
| 50 | if [ "-$ethwan" != "-" ]; then |
| 51 | echo 0 > /proc/sys/net/ipv6/conf/$ethwan/accept_ra |
| 52 | fi |
| 53 | if [ "-$wifiwan" != "-" ]; then |
| 54 | echo 0 > /proc/sys/net/ipv6/conf/$wifiwan/accept_ra |
| 55 | fi |
| 56 | |
| 57 | #°²È«ÒªÇó |
| 58 | echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects |
| 59 | echo 0 > /proc/sys/net/ipv4/conf/default/send_redirects |
| 60 | echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects |
| 61 | echo 0 > /proc/sys/net/ipv4/conf/default/accept_redirects |
| 62 | echo 0 > /proc/sys/net/ipv6/conf/all/accept_redirects |
| 63 | echo 0 > /proc/sys/net/ipv6/conf/default/accept_redirects |
| 64 | echo 0 > /proc/sys/net/ipv4/conf/all/secure_redirects |
| 65 | echo 0 > /proc/sys/net/ipv4/conf/default/secure_redirects |
| 66 | |
| 67 | #EC ÉèÖÃÁ¬½Ó¸ú×Ù×î´óÖµ,·Åµ½rcÀïÃæÅäÖà |
| 68 | #echo 2000 > /proc/sys/net/nf_conntrack_max |
| 69 | echo 7200 > /proc/sys/net/netfilter/nf_conntrack_tcp_timeout_established |
| 70 | |
| 71 | #zte_mainctrl & |
| 72 | |
| 73 | #½«br_name,usblan_name´«¸øÄÚºËʵÏÖÆ½Ì¨»¯ |
| 74 | fast_usb=`nv get fast_usb` |
| 75 | lan_enable=`nv get LanEnable` |
| 76 | |
| 77 | #LanEnableΪ2ʱºòûÓÐbr£¬²»ÐèҪдbr_name |
| 78 | if [ "$lan_enable" != "2" ]; then |
| 79 | echo $lan_if > /proc/net/br_name |
| 80 | fi |
| 81 | |
| 82 | echo $fast_usb > /proc/net/usb_name |
| 83 | |
| 84 | echo "" > /etc/resolv.conf |
| 85 | |
| 86 | #br0´î½¨£¬¼°ÄÚÍødhcp |
| 87 | sh $path_sh/lan.sh |
| 88 | |
| 89 | #½«¿ìËÙת·¢¼¶±ð´«¸øÄÚºË |
| 90 | fastnat_level=`nv get fastnat_level` |
xf.li | 6236ea7 | 2023-07-26 04:58:33 -0700 | [diff] [blame] | 91 | echo "Info: set fastnat_level: $fastnat_level" >> $test_log |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 92 | echo $fastnat_level > /proc/net/fastnat_level |
| 93 | |
xf.li | f233062 | 2024-05-15 18:17:18 -0700 | [diff] [blame^] | 94 | fastbr_level=`nv get fastbr_level` |
| 95 | echo "Info: set fastbr_level: $fastbr_level" >> $test_log |
| 96 | echo $fastbr_level > /proc/net/fastbr_level |
| 97 | |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 98 | #½«²»Ö§³Ö¿ìËÙת·¢µÄÐÒé¶Ë¿ÚºÅ´«¸øÄÚºË |
| 99 | nofast_port=`nv get nofast_port` |
xf.li | 6236ea7 | 2023-07-26 04:58:33 -0700 | [diff] [blame] | 100 | echo "Info: set nofast_port: $nofast_port" >> $test_log |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 101 | echo $nofast_port > /proc/net/nofast_port |
| 102 | |
xf.li | 7ccf837 | 2024-03-07 00:08:02 -0800 | [diff] [blame] | 103 | #½«ÊÇ·ñ¸ù¾ÝRA±¨ÎÄÅäÖÃÍø¿ÚµÄmtu´«¸øÄÚºË |
| 104 | ra_mtu_enable=`nv get ra_mtu_enable` |
| 105 | echo "Info: set ra_mtu_enable£º$ra_mtu_enable" >> $test_log |
| 106 | echo $ra_mtu_enable > /sys/module/psnet_io/parameters/ra_mtu_enable |
| 107 | |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 108 | #SKB debug¿ª¹Ø |
| 109 | skb_debug=`nv get skb_debug` |
xf.li | 6236ea7 | 2023-07-26 04:58:33 -0700 | [diff] [blame] | 110 | echo "Info: set skb_debug: $skb_debug" >> $test_log |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 111 | if [ "-$skb_debug" != "-1" ]; then |
| 112 | echo 0 > /proc/net/skb_debug_off |
| 113 | fi |
| 114 | |
| 115 | killall -9 miniupnpd |
| 116 | rm -rf $path_conf/inadyn.status |
| 117 | |
| 118 | #¼Ç¼½ø³Ì±»ºÎÖÖÐźÅkilledµô |
| 119 | netdog -s exitsig=1 |
| 120 | |
| 121 | #¼à¿ØÄÚºËskbÏà¹ØÐÅÏ¢µÄ×î´óÖµ |
| 122 | #safe_run netmonitor |
| 123 | |
| 124 | #¼à¿ØÄں˵Änetlinkʼþ´æÎļþ£¬Ö§³ÖÄÚºË×Ô¶¨Òåʼþ£¬Òò»áдflash°æ±¾Ä¬ÈÏ¹Ø±Õ |
| 125 | #safe_run event_proc |