]> git.99rst.org Git - openwrt-packages.git/commitdiff
shunt: init fixes
authorDirk Brenken <redacted>
Wed, 26 Aug 2026 15:03:37 +0000 (17:03 +0200)
committerDirk Brenken <redacted>
Wed, 26 Aug 2026 15:04:08 +0000 (17:04 +0200)
- fixed crash loops as the shipped example policy is disabled
- fixed restart/reload glitches with already stopped services
- bumped version to 0.1.5-r2

Signed-off-by: Dirk Brenken <redacted>
Co-authored-by: Claude <redacted>
Signed-off-by: Dirk Brenken <redacted>
net/shunt/Makefile
net/shunt/files/shunt.init
net/shunt/files/shunt.uc

index c2862e7abf43fb627a0314d99e55e097b283968e..caba5916fb20b178e234baddaba094fc2c1bd81d 100644 (file)
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=shunt
 PKG_VERSION:=0.1.5
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=GPL-3.0-or-later
 PKG_LICENSE_FILES:=
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
index b5fa29277429d9066fcd01e2288c3491bd70048a..004257026cf9992bf4635a00d173c2d93d643390 100644 (file)
@@ -14,16 +14,23 @@ if [ -z "${IPKG_INSTROOT}" ]; then
        "stop")
                "${shunt_init}" running || exit 0
                ;;
+       "restart" | "reload")
+               if ! "${shunt_init}" running; then
+                       exec "${shunt_init}" start
+               fi
+               ;;
        esac
 fi
 
 start_service() {
-       procd_open_instance "shunt"
-       procd_set_param command /usr/sbin/shunt run
-       procd_set_param respawn 300 5 3
-       procd_set_param stdout 0
-       procd_set_param stderr 1
-       procd_close_instance
+       if "${shunt_init}" enabled; then
+               procd_open_instance "shunt"
+               procd_set_param command /usr/sbin/shunt run
+               procd_set_param respawn 300 5 3
+               procd_set_param stdout 0
+               procd_set_param stderr 1
+               procd_close_instance
+       fi
 }
 
 stop_service() {
index 9444d0527dd8ec229d7eb5f0eba9c3bed2e5e27e..eb94660138d74b00c132f7a3a72775665164b3fa 100755 (executable)
@@ -353,14 +353,15 @@ function run() {
        dbg = verbose || state.cfg.global.debug;
 
        if (!state.cfg.global.enabled) {
-               log('notice', 'disabled in config');
-               return 0;
+               log('notice', 'disabled in config - running idle; enable and reload to start');
+               state.cfg.policies = [];
+               state.matcher = match_compile([]);
+               state.nft = nft_compile([]);
+               state.route = route_compile([], state.nft.marks);
        }
 
-       if (!length(state.nft.marks)) {
-               log('err', 'no usable policy - not starting, run `shunt check` for the reasons');
-               return 2;
-       }
+       if (!length(state.nft.marks))
+               log('warn', 'no usable policy - running idle; configure a policy and reload, `shunt check` shows the reasons');
 
        if (state.cfg.global.rp_filter_manage)
                rp_filter_apply(state.cfg.policies);
@@ -526,7 +527,7 @@ function run() {
 
        let socks = [];
 
-       if (state.cfg.global.snoop) {
+       if (state.cfg.global.snoop && length(state.nft.marks)) {
                let socket = null;
 
                for (let dev in state.cfg.global.snoop_devices) {
git clone https://git.99rst.org/PROJECT