Skip to content

Commit 8bf5f68

Browse files
committed
pbr: update to 1.2.1-r35
pbr 1.2.1-r35 Makefile: * split uci-defaults into different purpose files * add handling of netifd integration Config: * update with default values for all options (thanks @betonmischer86) Init-script: * add netifd integration handling * add ip() function to emulate ip rule replace * add netbird intrfaces support (thanks @egc112) * reorganize loading/handling of options in load_package_config() * improve display of interface triggers in service_triggers() * remove chains cleanup from stop_service() due to exclusive use of fw4 nft files * improve status_service() output * drop input and postrouting as valid options for policy chain Uci-defaults files: * 91-pbr-nft: cosmetic improvements Default nft files: * drop use of input and postrouting chanins Custom User files: * dns-prefetch: functional improvements (thanks @betonmischer86) Signed-off-by: Stan Grishin <[email protected]>
1 parent 803a754 commit 8bf5f68

File tree

8 files changed

+592
-341
lines changed

8 files changed

+592
-341
lines changed

net/pbr/Makefile

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
include $(TOPDIR)/rules.mk
55

66
PKG_NAME:=pbr
7-
PKG_VERSION:=1.2.0
8-
PKG_RELEASE:=2
7+
PKG_VERSION:=1.2.1
8+
PKG_RELEASE:=35
99
PKG_LICENSE:=AGPL-3.0-or-later
1010
PKG_MAINTAINER:=Stan Grishin <[email protected]>
1111

@@ -81,28 +81,29 @@ define Package/pbr/default/install
8181
$(INSTALL_DIR) $(1)/usr/share/nftables.d
8282
$(CP) ./files/usr/share/nftables.d/* $(1)/usr/share/nftables.d/
8383
$(INSTALL_DIR) $(1)/etc/uci-defaults
84-
$(INSTALL_BIN) ./files/etc/uci-defaults/90-pbr $(1)/etc/uci-defaults/90-pbr
84+
$(INSTALL_BIN) ./files/etc/uci-defaults/90-pbr $(1)/etc/uci-defaults/90-pbr
85+
$(INSTALL_BIN) ./files/etc/uci-defaults/91-pbr-nft $(1)/etc/uci-defaults/91-pbr-nft
86+
$(INSTALL_BIN) ./files/etc/uci-defaults/99-pbr-version $(1)/etc/uci-defaults/99-pbr-version
8587
endef
8688

8789
define Package/pbr/install
8890
$(call Package/pbr/default/install,$(1))
89-
$(INSTALL_DIR) $(1)/etc/uci-defaults
90-
$(INSTALL_BIN) ./files/etc/uci-defaults/91-pbr-nft $(1)/etc/uci-defaults/91-pbr-nft
9191
endef
9292

9393
define Package/pbr-netifd/install
9494
$(call Package/pbr/default/install,$(1))
9595
$(INSTALL_DIR) $(1)/etc/uci-defaults
96-
$(INSTALL_BIN) ./files/etc/uci-defaults/91-pbr-netifd $(1)/etc/uci-defaults/91-pbr-netifd
9796
endef
97+
# $(INSTALL_BIN) ./files/etc/uci-defaults/91-pbr-netifd $(1)/etc/uci-defaults/91-pbr-netifd
9898

9999
define Package/pbr/postinst
100100
#!/bin/sh
101101
# check if we are on real system
102102
if [ -z "$${IPKG_INSTROOT}" ]; then
103-
chmod -x /etc/init.d/pbr || true
104-
fw4 -q reload || true
105-
chmod +x /etc/init.d/pbr || true
103+
/etc/init.d/pbr netifd check && {
104+
echo -n "Reinstalling pbr netifd integration... "
105+
/etc/init.d/pbr netifd install >/dev/null 2>&1 && echo "OK" || echo "FAIL"
106+
}
106107
echo -n "Installing rc.d symlink for pbr... "
107108
/etc/init.d/pbr enable && echo "OK" || echo "FAIL"
108109
fi
@@ -114,9 +115,13 @@ define Package/pbr/prerm
114115
# check if we are on real system
115116
if [ -z "$${IPKG_INSTROOT}" ]; then
116117
echo -n "Stopping pbr service... "
117-
/etc/init.d/pbr stop quiet >/dev/null 2>&1 && echo "OK" || echo "FAIL"
118+
/etc/init.d/pbr stop >/dev/null 2>&1 && echo "OK" || echo "FAIL"
118119
echo -n "Removing rc.d symlink for pbr... "
119120
/etc/init.d/pbr disable && echo "OK" || echo "FAIL"
121+
/etc/init.d/pbr netifd check && {
122+
echo -n "Uninstalling pbr netifd integration... "
123+
/etc/init.d/pbr netifd uninstall >/dev/null 2>&1 && echo "OK" || echo "FAIL"
124+
}
120125
fi
121126
exit 0
122127
endef
@@ -134,10 +139,9 @@ define Package/pbr-netifd/postinst
134139
#!/bin/sh
135140
# check if we are on real system
136141
if [ -z "$${IPKG_INSTROOT}" ]; then
137-
chmod -x /etc/init.d/pbr || true
138-
fw4 -q reload || true
139-
chmod +x /etc/init.d/pbr || true
140-
echo -n "Installing rc.d symlink for pbr-netifd... "
142+
echo -n "Installing pbr integration with netifd... "
143+
/etc/init.d/pbr netifd check && /etc/init.d/pbr netifd install >/dev/null 2>&1 && echo "OK" || echo "FAIL"
144+
echo -n "Installing rc.d symlink for pbr... "
141145
/etc/init.d/pbr enable && echo "OK" || echo "FAIL"
142146
fi
143147
exit 0
@@ -147,31 +151,12 @@ define Package/pbr-netifd/prerm
147151
#!/bin/sh
148152
# check if we are on real system
149153
if [ -z "$${IPKG_INSTROOT}" ]; then
150-
echo -n "Stopping pbr-netifd service... "
151-
/etc/init.d/pbr stop quiet >/dev/null 2>&1 && echo "OK" || echo "FAIL"
154+
echo -n "Stopping pbr service... "
155+
/etc/init.d/pbr stop >/dev/null 2>&1 && echo "OK" || echo "FAIL"
152156
echo -n "Removing rc.d symlink for pbr... "
153157
/etc/init.d/pbr disable && echo "OK" || echo "FAIL"
154-
echo -n "Cleaning up /etc/iproute2/rt_tables... "
155-
if sed -i '/pbr_/d' /etc/iproute2/rt_tables; then
156-
echo "OK"
157-
else
158-
echo "FAIL"
159-
fi
160-
echo -n "Cleaning up /etc/config/network... "
161-
uci -q delete 'network.pbr_default' || true
162-
uci -q delete 'network.pbr_default6' || true
163-
uci commit network || true
164-
if sed -i '/ip.table.*pbr_/d' /etc/config/network; then
165-
echo "OK"
166-
else
167-
echo "FAIL"
168-
fi
169-
echo -n "Restarting Network... "
170-
if /etc/init.d/network restart >/dev/null 2>&1; then
171-
echo "OK"
172-
else
173-
echo "FAIL"
174-
fi
158+
echo -n "Uninstalling pbr integration with netifd... "
159+
/etc/init.d/pbr netifd check && /etc/init.d/pbr netifd uninstall >/dev/null 2>&1 && echo "OK" || echo "FAIL"
175160
fi
176161
exit 0
177162
endef

net/pbr/files/etc/config/pbr

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
config pbr 'config'
22
option enabled '0'
3-
option verbosity '2'
4-
option strict_enforcement '1'
5-
option resolver_set 'dnsmasq.nftset'
6-
list resolver_instance '*'
7-
option ipv6_enabled '0'
3+
option fw_mask '00ff0000'
84
list ignored_interface 'vpnserver'
9-
option rule_create_option 'add'
10-
option procd_boot_trigger_delay '5000'
11-
option procd_reload_delay '1'
12-
option webui_show_ignore_target '0'
5+
option ipv6_enabled '0'
6+
option lan_device 'br-lan'
137
option nft_rule_counter '0'
148
option nft_set_auto_merge '1'
159
option nft_set_counter '0'
1610
option nft_set_flags_interval '1'
1711
option nft_set_flags_timeout '0'
18-
option nft_set_gc_interval ''
1912
option nft_set_policy 'performance'
20-
option nft_set_timeout ''
13+
option nft_user_set_counter '0'
14+
option procd_boot_trigger_delay '5000'
15+
option procd_reload_delay '0'
16+
list resolver_instance '*'
17+
option resolver_set 'dnsmasq.nftset'
18+
option strict_enforcement '1'
19+
option uplink_interface 'wan'
20+
option uplink_interface6 'wan6'
21+
option uplink_ip_rules_priority '30000'
22+
option uplink_mark '00010000'
23+
option verbosity '2'
2124
list webui_supported_protocol 'all'
2225
list webui_supported_protocol 'tcp'
2326
list webui_supported_protocol 'udp'

0 commit comments

Comments
 (0)