Skip to content

Commit

Permalink
fix: fix log output
Browse files Browse the repository at this point in the history
  • Loading branch information
CHIZI-0618 authored Sep 18, 2024
1 parent 6e5fd9f commit c090508
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion box/scripts/net.inotify
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ rules_add() {
iptables -t mangle -F LOCAL_IP_V4
ip -4 a | awk '/inet/ {print $2}' | grep -vE "^127.0.0.1" | while read -r local_ipv4 ; do
iptables -w 100 -t mangle -A LOCAL_IP_V4 -d $local_ipv4 -j ACCEPT
rv1=$?
iptables -w 100 -t nat -A LOCAL_IP_V4 -d $local_ipv4 -j ACCEPT
[ $? = "0" ] && echo "$(date +"[%Y-%m-%d %H:%M:%S %Z]") [Info]: local ip is $local_ipv4, anti-loopback rule has been inserted" >> ${run_path}/run.log 2>> ${run_path}/run_error.log
rv2=$?
( [ $rv1 = "0" ] || [ $rv2 = "0" ] ) && echo "$(date +"[%Y-%m-%d %H:%M:%S %Z]") [Info]: local ip is $local_ipv4, anti-loopback rule has been inserted" >> ${run_path}/run.log 2>> ${run_path}/run_error.log
done

ip6tables -t mangle -F LOCAL_IP_V6
Expand Down

0 comments on commit c090508

Please sign in to comment.