From: Dharmik Parmar Date: Sun, 28 Jun 2026 02:00:15 +0000 (+0530) Subject: bcp38: clean up nft rule handling X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=c11ef37d558291d272ffe6afc857afa4fd538dd4;p=openwrt-packages.git bcp38: clean up nft rule handling Quote interface names when creating nft rules and use destroy table for idempotent cleanup. Signed-off-by: Dharmik Parmar --- diff --git a/net/bcp38/Makefile b/net/bcp38/Makefile index 099f202f1..499f6fb59 100644 --- a/net/bcp38/Makefile +++ b/net/bcp38/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bcp38 PKG_VERSION:=5 -PKG_RELEASE:=12 +PKG_RELEASE:=13 PKG_LICENSE:=GPL-3.0-or-later include $(INCLUDE_DIR)/package.mk diff --git a/net/bcp38/files/run.sh b/net/bcp38/files/run.sh index 4c4f185da..54acc58c4 100755 --- a/net/bcp38/files/run.sh +++ b/net/bcp38/files/run.sh @@ -86,8 +86,8 @@ setup_chains() nft flush chain "$FAMILY" "$TABLE" "$CHAIN" 2>/dev/null nft add rule "$FAMILY" "$TABLE" "$CHAIN" udp sport . udp dport { 68 . 67, 67 . 68 } counter return comment \"always accept DHCP traffic\" - nft add rule "$FAMILY" "$TABLE" "$CHAIN" oifname $interface ip daddr @"$MATCHSET" ip daddr != @"$NOMATCHSET" counter reject with icmp type host-unreachable - nft add rule "$FAMILY" "$TABLE" "$CHAIN" iifname $interface ip saddr @"$MATCHSET" ip saddr != @"$NOMATCHSET" counter drop + nft add rule "$FAMILY" "$TABLE" "$CHAIN" oifname "$interface" ip daddr @"$MATCHSET" ip daddr != @"$NOMATCHSET" counter reject with icmp type host-unreachable + nft add rule "$FAMILY" "$TABLE" "$CHAIN" iifname "$interface" ip saddr @"$MATCHSET" ip saddr != @"$NOMATCHSET" counter drop nft add chain "$FAMILY" "$TABLE" input "{ type filter hook input priority $priority; policy accept; comment \"bcp38 filter\"; }" nft add chain "$FAMILY" "$TABLE" forward "{ type filter hook forward priority $priority; policy accept; comment \"bcp38 filter\"; }" @@ -101,8 +101,8 @@ setup_chains() destroy_table() { if [ "$TABLE" != "fw4" ]; then - #as of kernel 3.18 we can delete a table without need to flush it - nft delete table "$FAMILY" "$TABLE" 2>/dev/null + # Delete the table if it exists. + nft destroy table "$FAMILY" "$TABLE" 2>/dev/null fi }