mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-02 09:13:56 +08:00
update 2026-09-25 06:56:42
This commit is contained in:
1 parent
45632307c8
commit
6ef6eec405
218 files changed
+45422
-299
No files matched your search
@@ -21,8 +21,9 @@ localip=$(config_t_get service localip 10.0.1.1)
|
||||
|
||||
ipt_rule() {
|
||||
if [ "$1" = "add" ]; then
|
||||
iptables -t nat -I postrouting_rule -s ${localip%.*}.0/24 -m comment --comment "${ipt_flag}" -j MASQUERADE 2>/dev/null
|
||||
iptables -I forwarding_rule -s ${localip%.*}.0/24 -m comment --comment "${ipt_flag}" -j ACCEPT 2>/dev/null
|
||||
iptables -w -t nat -I POSTROUTING -s ${localip%.*}.0/24 -m comment --comment "${ipt_flag}" -j MASQUERADE 2>/dev/null
|
||||
iptables -w -t nat -I POSTROUTING -d ${localip%.*}.0/24 -m comment --comment "${ipt_flag}" -j MASQUERADE 2>/dev/null
|
||||
iptables -w -I FORWARD -s ${localip%.*}.0/24 -m comment --comment "${ipt_flag}" -j ACCEPT 2>/dev/null
|
||||
else
|
||||
ipt_del() {
|
||||
for i in $(seq 1 $($1 -nL $2 | grep -c "${ipt_flag}")); do
|
||||
@@ -30,8 +31,8 @@ ipt_rule() {
|
||||
$1 -w -D $2 $index 2>/dev/null
|
||||
done
|
||||
}
|
||||
ipt_del "iptables" "forwarding_rule"
|
||||
ipt_del "iptables -t nat" "postrouting_rule"
|
||||
ipt_del "iptables" "FORWARD"
|
||||
ipt_del "iptables -t nat" "POSTROUTING"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -49,6 +50,7 @@ gen_include() {
|
||||
$(extract_rules filter)
|
||||
$(extract_rules nat)
|
||||
EOT
|
||||
exit 0
|
||||
EOF
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -5,8 +5,15 @@ uci -q batch <<-EOF >/dev/null
|
||||
set firewall.luci_app_pppoe_server=include
|
||||
set firewall.luci_app_pppoe_server.type=script
|
||||
set firewall.luci_app_pppoe_server.path=/var/etc/luci-app-pppoe-server.include
|
||||
set firewall.luci_app_pppoe_server.reload=1
|
||||
EOF
|
||||
|
||||
if [ -x "/sbin/fw3" ] && [ ! -L "/sbin/fw3" ]; then
|
||||
uci -q set firewall.luci_app_pppoe_server.reload='1'
|
||||
else
|
||||
uci -q delete firewall.luci_app_pppoe_server.reload
|
||||
uci -q delete firewall.luci_app_pppoe_server.fw4_compatible
|
||||
fi
|
||||
uci commit firewall
|
||||
|
||||
rm -rf /tmp/luci-*cache
|
||||
exit 0
|
||||
Reference in new issue
Block a user