Skip to content

Commit

Permalink
fix(init): bug fix (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
SunBK201 authored Aug 10, 2021
1 parent f3d4c1b commit c8a11a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion files/ua2f.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

config ua2f 'enabled'
option enabled '1'
option enabled '0'

config ua2f 'firewall'
option handle_fw '1'
Expand Down
4 changes: 2 additions & 2 deletions files/ua2f.init
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ start_service() {
procd_close_instance

local wan
wan=$(ubus call network.interface.wan status | grep nexthop | grep -oE "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)")
wan=$(route -n | grep UG | awk '{print $2}')

[ "$handle_fw" -eq "1" ] && {
ipset create nohttp hash:ip,port hashsize 16384 timeout 300
Expand All @@ -44,7 +44,7 @@ start_service() {
[[ $wan =~ ^10. ]] && {
iptables -t mangle -D ua2f 1
}
[[ $wan =~ ^172.((1[6-9])|(2[0-9])|(3[0-1])) ]] && {
( echo "$wan" | grep -Eq "^172\.((1[6-9])|(2[0-9])|(3[0-1]))\." ) && {
iptables -t mangle -D ua2f 2
}
[[ $wan =~ ^192.168 ]] && {
Expand Down

0 comments on commit c8a11a1

Please sign in to comment.