Skip to content

Commit

Permalink
install_easy: in openwrt clear ipsets during install to save RAM
Browse files Browse the repository at this point in the history
  • Loading branch information
bol-van committed Nov 13, 2020
1 parent 33dbc5b commit bc7ed63
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion install_easy.sh
Expand Up @@ -716,7 +716,7 @@ is_linked_to_busybox()
F=/bin/$1
P="$(readlink $F)"
if [ -z "$P" ] && [ -x $F ] && [ ! -L $F ]; then false; return; fi
[ "${P%busybox*}" != "$P" ] && return
[ "${P%busybox*}" != "$P" ]
}

check_prerequisites_openwrt()
Expand Down Expand Up @@ -868,6 +868,9 @@ remove_openwrt_firewall()
openwrt_fw_section_del
# from old zapret versions. now we use single include
openwrt_fw_section_del 6

# free some RAM
"$EXEDIR/ipset/create_ipset.sh" clear
}

install_openwrt_iface_hook()
Expand Down
9 changes: 6 additions & 3 deletions ipset/create_ipset.sh
Expand Up @@ -18,6 +18,7 @@ IPSET_SAVERAM_MIN_FILESIZE=131072

while [ -n "$1" ]; do
[ "$1" = "no-update" ] && NO_UPDATE=1
[ "$1" = "clear" ] && DO_CLEAR=1
shift
done

Expand Down Expand Up @@ -112,9 +113,11 @@ create_ipset()
[ "$NO_UPDATE" = "1" ] && return
}
ipset flush $2
for f in "$5" "$6" ; do
ipset_restore "$f" "$2" $1
done
[ "$DO_CLEAR" = "1" ] || {
for f in "$5" "$6" ; do
ipset_restore "$f" "$2" $1
done
}
return 0
}

Expand Down
3 changes: 3 additions & 0 deletions uninstall_easy.sh
Expand Up @@ -158,6 +158,9 @@ remove_openwrt_firewall()
openwrt_fw_section_del
# from old zapret versions. now we use single include
openwrt_fw_section_del 6

# free some RAM
"$EXEDIR/ipset/create_ipset.sh" clear
}

restart_openwrt_firewall()
Expand Down

0 comments on commit bc7ed63

Please sign in to comment.