pbr: update to 1.0.1-14

* improve install/uninstall messages
* fix ips add command
* add boot() to init file

Signed-off-by: Stan Grishin <stangri@melmac.ca>
This commit is contained in:
Stan Grishin 2023-01-17 00:41:48 +00:00
parent 70cf654ce2
commit f4f899f6f9
2 changed files with 17 additions and 20 deletions

View file

@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=pbr
PKG_VERSION:=1.0.1
PKG_RELEASE:=10
PKG_RELEASE:=14
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
@ -130,8 +130,8 @@ define Package/pbr/prerm
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
uci -q delete firewall.pbr || true
echo "Stopping pbr service... "
/etc/init.d/pbr stop || true
echo -n "Stopping pbr service... "
/etc/init.d/pbr stop && echo "OK" || echo "FAIL"
echo -n "Removing rc.d symlink for pbr... "
/etc/init.d/pbr disable && echo "OK" || echo "FAIL"
fi
@ -151,7 +151,7 @@ define Package/pbr-iptables/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo -n "Installing rc.d symlink for pbr... "
echo -n "Installing rc.d symlink for pbr-iptables... "
/etc/init.d/pbr enable && echo "OK" || echo "FAIL"
fi
exit 0
@ -162,9 +162,9 @@ define Package/pbr-iptables/prerm
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
uci -q delete firewall.pbr || true
echo "Stopping pbr service... "
/etc/init.d/pbr stop || true
echo -n "Removing rc.d symlink for pbr... "
echo -n "Stopping pbr-iptables service... "
/etc/init.d/pbr stop && echo "OK" || echo "FAIL"
echo -n "Removing rc.d symlink for pbr-iptables... "
/etc/init.d/pbr disable && echo "OK" || echo "FAIL"
fi
exit 0
@ -174,12 +174,8 @@ define Package/pbr-netifd/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo -n "Installing rc.d symlink for pbr... "
echo -n "Installing rc.d symlink for pbr-netifd... "
/etc/init.d/pbr enable && echo "OK" || echo "FAIL"
# echo -n "Installing netifd support for pbr... "
# /etc/init.d/pbr netifd install && echo "OK" || echo "FAIL"
# echo -n "Restarting network... "
# /etc/init.d/network restart && echo "OK" || echo "FAIL"
fi
exit 0
endef
@ -189,14 +185,10 @@ define Package/pbr-netifd/prerm
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
uci -q delete firewall.pbr || true
echo "Stopping pbr service... "
/etc/init.d/pbr stop || true
# echo -n "Removing netifd support for pbr... "
# /etc/init.d/pbr netifd remove && echo "OK" || echo "FAIL"
echo -n "Stopping pbr-netifd service... "
/etc/init.d/pbr stop && echo "OK" || echo "FAIL"
echo -n "Removing rc.d symlink for pbr... "
/etc/init.d/pbr disable && echo "OK" || echo "FAIL"
# echo -n "Restarting network... "
# /etc/init.d/network restart && echo "OK" || echo "FAIL"
fi
exit 0
endef

View file

@ -457,8 +457,8 @@ ips() {
case "$command" in
add)
ips4 -q -! add "$ipset4" comment "$comment" && ipv4_error=0
ips6 -q -! add "$ipset6" comment "$comment" && ipv6_error=0
ips4 -q -! add "$ipset4" ["$param"] comment "$comment" && ipv4_error=0
ips6 -q -! add "$ipset6" ["$param"] comment "$comment" && ipv6_error=0
;;
add_agh_element)
[ -n "$ipv6_enabled" ] || unset ipset6
@ -1971,6 +1971,11 @@ user_file_process() {
fi
}
boot() {
ubus -t 30 wait_for network.interface 2>/dev/null
rc_procd start_service 'on_boot'
}
on_firewall_reload() {
if [ -z "$(ubus_get_status 'gateways')" ]; then # service is not running, do not start it on firewall reload
logger -t "$packageName" "Reload on firewall action aborted: service not running."