pbr: update to 1.0.1-14
authorStan Grishin <stangri@melmac.ca>
Tue, 17 Jan 2023 00:41:48 +0000 (00:41 +0000)
committerStan Grishin <stangri@melmac.ca>
Tue, 17 Jan 2023 00:48:22 +0000 (00:48 +0000)
* improve install/uninstall messages
* fix ips add command
* add boot() to init file

Signed-off-by: Stan Grishin <stangri@melmac.ca>
net/pbr/Makefile
net/pbr/files/etc/init.d/pbr.init

index 6348c9bab756aec608e776c7cf6fc00aefbb8afc..ab931e7cd9757b8b7c663a945fb345ca2c5947f7 100644 (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
index 481b1d94861b7c2c43228e7e11a4eacb6237ed49..e612072c3497b0d4d38656d9942c171972a5b429 100755 (executable)
@@ -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."