Skip to content

luci-app-firewall: sync protocol list with musl libc#8494

Closed
R41D1 wants to merge 1 commit intoopenwrt:masterfrom
R41D1:luci-app-firewall/fix-protocol-list-musl
Closed

luci-app-firewall: sync protocol list with musl libc#8494
R41D1 wants to merge 1 commit intoopenwrt:masterfrom
R41D1:luci-app-firewall/fix-protocol-list-musl

Conversation

@R41D1
Copy link
Copy Markdown
Contributor

@R41D1 R41D1 commented Apr 1, 2026

Summary

  • Remove 23 protocol names from the firewall protocol list that musl's getprotobyname() cannot resolve

nftables resolves symbolic protocol names via getprotobyname(). On musl (used by all OpenWrt targets), this function only knows a hardcoded subset of 36 protocols (src/network/proto.c). musl intentionally does not read /etc/protocols.

When LuCI writes a symbolic name like vrrp to /etc/config/firewall, nftables fails with Could not resolve protocol name on rule load, breaking the entire firewall.

The protocol list was originally sourced from a glibc-based /etc/protocols. This patch syncs it to only include names musl can resolve. Users who need removed protocols (e.g. VRRP=112, SCTP=132) can still enter them by number.

Removed protocols: hopopt, igp, dccp, icmpv6 (alias; ipv6-icmp stays), eigrp, ax.25, etherip, ipcomp, vrrp, l2tp, isis, sctp, fc, mh, ipv6-mh, mobility-header, udplite, mpls-in-ip, manet, hip, shim6, wesp, rohc, duplicate rspf/CPHB alias.

Test plan

  • Create firewall rule with protocol tcp — rule saves and firewall loads
  • Create firewall rule with protocol number 112 — rule saves and firewall loads
  • Verify vrrp no longer appears in protocol dropdown (prevents the nftables failure)
  • service firewall restart succeeds with all selectable protocols

Fixes #8449

🤖 Generated with Claude Code

nftables resolves symbolic protocol names via getprotobyname()
which on musl only knows a hardcoded subset of protocols
(src/network/proto.c). Names not in that list cause nftables
to fail with "Could not resolve protocol name", breaking the
firewall on rule load.

Remove 23 protocol entries (including vrrp, sctp, dccp, l2tp)
that musl cannot resolve. Users who need these protocols can
still enter them by number in firewall rules.

The removed protocols were originally sourced from a glibc-based
/etc/protocols file. musl intentionally does not read that file.

Fixes: openwrt#8449
Signed-off-by: Joshua Klinesmith <joshuaklinesmith@gmail.com>

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@R41D1
Copy link
Copy Markdown
Contributor Author

R41D1 commented Apr 1, 2026

Closing in favor of the approach from the issue discussion — adding a musl-compatibility flag (4th field) to each protocol entry and converting unsupported names to numeric values on write via protoToNum(). That preserves the full protocol list for user reference while ensuring nftables always gets resolvable values. Strictly better than removing entries.

@R41D1 R41D1 closed this Apr 1, 2026
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.

LuCI : firewall rewrites protocol 112 to vrrp, but fw4/nftables cannot render the generated rule and firewall restart fails.

1 participant