Skip to content

netfilter-match-modules: fix implicit-declaration warnings for newer GCC#45

Open
ispyisail wants to merge 1 commit into
openwrt-2512from
netfilter-warning-cleanup
Open

netfilter-match-modules: fix implicit-declaration warnings for newer GCC#45
ispyisail wants to merge 1 commit into
openwrt-2512from
netfilter-warning-cleanup

Conversation

@ispyisail

Copy link
Copy Markdown
Owner

Stacked on #43 — base branch is openwrt-2512 (the 25.12 bump), not master. Merge #43 first; this rebases cleanly onto master afterward.

Applies fixes for implicit-declaration warnings across the netfilter-match-modules webmon, weburl, and bandwidth modules (both iptables and nftables variants) and their shared regexp.h helper, plus two real portability fixes in the iptables bandwidth userspace tool (libxt_bandwidth.c) — a duplicated ipany union and an unportable %lld format assumption.

The underlying diff was proposed by Michael Gray (of the nftables port of these modules) for a separate GCC/kernel toolchain. Confirmed during review that on this repo's current toolchain the affected code paths only produce warnings, not hard errors (CONFIG_WERROR isn't set) — so this isn't a build-breaking fix here, but it's a real correctness improvement worth carrying: newer GCC toolchains do turn functions-called-before-declared into a hard error, and the duplicated union / format-string issues are genuine latent bugs.

Not otherwise related to the 25.12 bump; stacked only because the affected files were touched by the bump's own nftables fixes and this avoids re-deriving against a moving target.

Newer GCC toolchains (as used building this OpenWrt 25.12 bump) warn on
functions called before they're declared, where older GCC treated this
as silently fine. Adds missing forward declarations across the webmon,
weburl, and bandwidth modules (both iptables and nftables variants) and
their shared regexp.h helper (my_strcspn).

Also fixes two real portability issues in the iptables bandwidth
userspace tool (libxt_bandwidth.c), currently unused now that Gargoyle
builds nftables-only but still worth correcting:
- Removed a private `ipany` union duplicating the kernel's own
  `union xt_bandwidth_ipany` (from linux/netfilter/xt_bandwidth.h) -
  two separate definitions of the same layout is a latent bug if either
  one ever changes shape.
- Print 64-bit fields via an explicit (long long) cast rather than
  relying on `%lld` matching whatever the platform's uint64_t/time_t
  happens to be, which isn't guaranteed and trips -Wformat on stricter
  toolchains.

Reordered a Makefile-generation step in integrate_netfilter_modules.sh
so GENERIC_PLATFORM_DIR/PLATFORM_DIR are defined before the
kernel-version.mk include that (on this newer OpenWrt base) expects
them already set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant