Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize script ipv6 condition #5

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions scripts/shield-trigger
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ null_route() {
# louzy detection of IPv4 or IPv6 address
#
TASK="$1"
INET=$(echo "$2" | sed 's/[0-9\.]//g')
if [ -z "$INET" ]
then
INET=""
GW="127.0.0.1"
else
INET=""
GW="127.0.0.1"
if [ "${2#*:}" != "$2" ] ; then
INET="-f inet6"
GW="::1"
fi
Expand Down
12 changes: 2 additions & 10 deletions scripts/shield-trigger-iptables
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,8 @@
#

run_iptables() {
#
# louzy detection of IPv4 or IPv6 address
#
IPT=$(echo "$2" | sed 's/[0-9\.]//g')
if [ -z "$IPT" ]
then
IPT=iptables
else
IPT=ip6tables
fi
IPT="iptables"
[ "${2#*:}" != "$2" ] && IPT="ip6tables"

# switch -A for iptables to -I
if [ "$1" = "-A" ]
Expand Down