From 51686912e0f3552bacd8ef7cf980f270c2fa3ec4 Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Mon, 18 Aug 2025 16:34:28 +0000 Subject: [PATCH] pbr: 1.1.8-36 bugfixes - drop load_environment_flag and always load environment on start, making restart command great again - store/restore existing jshn namespace when using json() - remove unneeded sleepCount in is_wan_up() - move updated README inside files/ Signed-off-by: Stan Grishin --- net/pbr/Makefile | 2 +- net/pbr/README.md | 18 ------------------ net/pbr/files/README.md | 19 +++++++++++++++++-- net/pbr/files/etc/init.d/pbr | 9 +++++---- 4 files changed, 23 insertions(+), 25 deletions(-) delete mode 100644 net/pbr/README.md diff --git a/net/pbr/Makefile b/net/pbr/Makefile index 05cc1e6ddf..1cea31c728 100644 --- a/net/pbr/Makefile +++ b/net/pbr/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=pbr PKG_VERSION:=1.1.8 -PKG_RELEASE:=34 +PKG_RELEASE:=36 PKG_LICENSE:=AGPL-3.0-or-later PKG_MAINTAINER:=Stan Grishin diff --git a/net/pbr/README.md b/net/pbr/README.md deleted file mode 100644 index 3a65c6b225..0000000000 --- a/net/pbr/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Policy-Based Routing (pbr) - -[![OpenWrt](https://img.shields.io/badge/OpenWrt-Compatible-blueviolet)](https://openwrt.org) -[![Web UI](https://img.shields.io/badge/Web_UI-Available-blue)](https://docs.openwrt.melmac.ca/pbr/) -[![License](https://img.shields.io/badge/License-GPL--3.0-lightgrey)](https://github.com/stangri/pbr/blob/master/LICENSE) - -Flexible policy-based routing (PBR) framework for OpenWrt. -Allows routing specific traffic (by IP, MAC, port, protocol, or domain) through a specific WAN, VPN, or tunnel. - -## Features - -- Route by IP, MAC, port, or domain name -- Works with WAN, VPNs (WireGuard, OpenVPN), or tunnels -- Lightweight shell-based implementation -- Optional Web UI integration via LuCI - -**Full documentation:** -[https://docs.openwrt.melmac.ca/pbr/](https://docs.openwrt.melmac.ca/pbr/) diff --git a/net/pbr/files/README.md b/net/pbr/files/README.md index 494a97c138..3a65c6b225 100644 --- a/net/pbr/files/README.md +++ b/net/pbr/files/README.md @@ -1,3 +1,18 @@ -# README +# Policy-Based Routing (pbr) -README is available at [https://docs.openwrt.melmac.net/pbr/](https://docs.openwrt.melmac.net/pbr/). +[![OpenWrt](https://img.shields.io/badge/OpenWrt-Compatible-blueviolet)](https://openwrt.org) +[![Web UI](https://img.shields.io/badge/Web_UI-Available-blue)](https://docs.openwrt.melmac.ca/pbr/) +[![License](https://img.shields.io/badge/License-GPL--3.0-lightgrey)](https://github.com/stangri/pbr/blob/master/LICENSE) + +Flexible policy-based routing (PBR) framework for OpenWrt. +Allows routing specific traffic (by IP, MAC, port, protocol, or domain) through a specific WAN, VPN, or tunnel. + +## Features + +- Route by IP, MAC, port, or domain name +- Works with WAN, VPNs (WireGuard, OpenVPN), or tunnels +- Lightweight shell-based implementation +- Optional Web UI integration via LuCI + +**Full documentation:** +[https://docs.openwrt.melmac.ca/pbr/](https://docs.openwrt.melmac.ca/pbr/) diff --git a/net/pbr/files/etc/init.d/pbr b/net/pbr/files/etc/init.d/pbr index 043ccfb83e..1f698ec4b2 100755 --- a/net/pbr/files/etc/init.d/pbr +++ b/net/pbr/files/etc/init.d/pbr @@ -101,7 +101,6 @@ nft_set_policy= nft_set_timeout= # run-time -load_environment_flag= aghConfigFile='/etc/AdGuardHome/AdGuardHome.yaml' gatewaySummary= wanIface4= @@ -569,7 +568,6 @@ load_environment() { return "$_ret" } local param="$1" validation_result="$2" - [ -z "$load_environment_flag" ] || return 0 case "$param" in on_boot|on_start) json init @@ -607,7 +605,6 @@ load_environment() { load_network "$param" ;; esac - load_environment_flag=1 } # shellcheck disable=SC2317 @@ -648,7 +645,7 @@ load_network() { } is_wan_up() { - local sleepCount='1' param="$1" + local param="$1" if [ -z "$(uci_get network "$procd_wan_interface")" ]; then json add error 'errorNoWanInterface' "$procd_wan_interface" json add error 'errorNoWanInterfaceHint' @@ -864,8 +861,10 @@ cleanup_sets() { json() { local status message stats i local action="$1" param="$2" value="$3"; shift 3; local info="$*"; + local _current_namespace="$_JSON_PREFIX" [ "$param" = 'error' ] && param='errors' [ "$param" = 'warning' ] && param='warnings' + json_set_namespace "${packageName}_" { json_load_file "$runningStatusFile" || json_init; } >/dev/null 2>&1 case "$action" in 'get') @@ -882,6 +881,7 @@ json() { fi printf "%b" "$i" json_select .. + json_set_namespace "$_current_namespace" return ;; 'add') @@ -903,6 +903,7 @@ json() { mkdir -p "${runningStatusFile%/*}" json_dump > "$runningStatusFile" sync + json_set_namespace "$_current_namespace" } resolver() {