lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | test_log=`nv get telog_path` |
| 3 | if [ "$test_log" == "" ]; then |
| 4 | test_log=`nv get path_log`"te.log" |
| 5 | fi |
| 6 | echo "Info: psext_updown_ipv6.sh $ps_if $eth_if $br_if start" >> $test_log |
| 7 | |
| 8 | c_id=$1 |
| 9 | ps_if=`nv get pswan`$c_id |
| 10 | eth_if=`nv get "ps_ext"$c_id` |
| 11 | br_if="br"$c_id |
| 12 | |
| 13 | #删除相应的ipv6路由规则 |
| 14 | linkdown_route_set() |
| 15 | { |
| 16 | br_ip=`nv get $br_if"_ipv6_ip"` |
| 17 | ps_ip=`nv get $ps_if"_ipv6_ip"` |
| 18 | pdp_ip=`nv get ipv6_wan_ipaddr` |
| 19 | |
| 20 | ip6tables -t filter -D FORWARD -p icmpv6 --icmpv6-type 135 -j DROP |
| 21 | |
| 22 | marknum=`expr $c_id + 50` |
| 23 | rt_num=`expr $c_id + 150` |
| 24 | ip -6 rule del from $pdp_ip/64 fwmark $marknum table $rt_num |
| 25 | ip6tables -t mangle -D PREROUTING -i $br_if -j MARK --set-mark $marknum |
| 26 | ip -6 route del default dev $ps_if table $rt_num |
| 27 | |
| 28 | marknum=`expr $c_id + 60` |
| 29 | rt_num=`expr $c_id + 160` |
| 30 | ip -6 rule del to $pdp_ip/64 fwmark $marknum table $rt_num |
| 31 | ip6tables -t mangle -D PREROUTING -i $ps_if -j MARK --set-mark $marknum |
| 32 | ip -6 route del default dev $br_if table $rt_num |
| 33 | |
| 34 | ip -6 addr del $br_ip/126 dev $br_if |
| 35 | #if [ $? -ne 0 ];then |
| 36 | # echo "Error: ip -6 addr del $eth_ip/126 dev $eth_if failed." >> $test_log |
| 37 | #fi |
| 38 | ip -6 addr del $ps_ip/126 dev $ps_if |
| 39 | #if [ $? -ne 0 ];then |
| 40 | # echo "Error: ip -6 addr del $ps_ip/126 dev $ps_if failed." >> $test_log |
| 41 | #fi |
xf.li | 9d1a0e1 | 2023-09-20 01:43:20 -0700 | [diff] [blame] | 42 | ip -6 route del default dev $ps_if |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 43 | #if [ $? -ne 0 ];then |
| 44 | # echo "Error: ip -6 route del default failed." >> $test_log |
| 45 | #fi |
| 46 | |
| 47 | ifconfig $br_if down 2>>$test_log |
| 48 | if [ $? -ne 0 ];then |
| 49 | echo "Error: ifconfig $br_if down failed." >> $test_log |
| 50 | fi |
| 51 | ifconfig $ps_if down 2>>$test_log |
| 52 | if [ $? -ne 0 ];then |
| 53 | echo "Error: ifconfig $ps_if down failed." >> $test_log |
| 54 | fi |
| 55 | |
| 56 | echo 0 > /proc/sys/net/ipv6/conf/$ps_if/accept_ra |
| 57 | |
| 58 | #reset nv |
| 59 | nv set $br_if"_ipv6_ip"="::" |
| 60 | nv set $ps_if"_ipv6_ip"="::" |
| 61 | nv set $ps_if"_ipv6_pridns_auto"="::" |
| 62 | nv set $ps_if"_ipv6_secdns_auto"="::" |
| 63 | nv set $ps_if"_ipv6_gw"="::" |
| 64 | nv set $ps_if"_ipv6_interface_id"="::" |
| 65 | nv set $ps_if"_ipv6_prefix_info"="::" |
| 66 | nv set $ps_if"_dhcpv6_start"="::" |
| 67 | nv set $ps_if"_dhcpv6_end"="::" |
| 68 | |
| 69 | #适配页面等其他地方使用老NV |
| 70 | nv set ipv6_wan_ipaddr="::" |
| 71 | nv set $ps_if"_ipv6_state"="dead" |
| 72 | |
| 73 | local_ipv6_addr_nv="$ps_if""_local_ipv6_addr" |
| 74 | nv set $local_ipv6_addr_nv="::" |
| 75 | |
| 76 | #ndp_kill |
| 77 | } |
| 78 | |
| 79 | tc_tbf.sh down $c_id |
| 80 | linkdown_route_set |
| 81 | brctl delif $br_if $eth_if |
| 82 | ifconfig $eth_if down |
| 83 | #echo "" > /etc/resolv.conf |
| 84 | echo "Info: psext_down_ipv6.sh leave" >> $test_log |