feat: multi-value rodata infrastructure#49
Open
leodido wants to merge 4 commits intofeat/dispatcher-chainfrom
Open
feat: multi-value rodata infrastructure#49leodido wants to merge 4 commits intofeat/dispatcher-chainfrom
leodido wants to merge 4 commits intofeat/dispatcher-chainfrom
Conversation
bb0df4d to
95679b3
Compare
f87d1dc to
93071f5
Compare
Add ethertypes and protos structs to the input union in both chain_entry (api/chain.h) and struct config (api/api.h.in). Add MAX_MULTI_VALUES define (8) shared across all multi-value types. No behavioral change — the new union members are not yet populated by any parser or consumed by any BPF program. Co-authored-by: Ona <no-reply@ona.com>
Add parse_ethertypes() and parse_protos() helpers to input_parse.h. parse_ethertypes() splits on '+', accepts symbolic names (ipv4, ipv6, arp) and 0x-prefixed hex values. parse_protos() splits on '+', accepts symbolic names (tcp, udp, icmp) and decimal numbers. Both validate: no empty lists, no duplicates, no overflow beyond MAX_MULTI_VALUES, no out-of-range values. These helpers are not yet wired into parse_input() — the cases will be added when the corresponding BPF programs land and the enum values exist. Co-authored-by: Ona <no-reply@ona.com>
Extend api.lua to support table-format input_fields entries alongside
plain strings. Multi-value programs use { field = "name", multi = true }
which sets PROGNAME_IS_MULTI_VALUE in the template variables.
The template's memcpy already handles both scalars and structs via
sizeof(), so no template file changes are needed. The new variable is
available for future template branching if needed.
No input_fields entries are added yet — those come when the BPF
programs (allow_ethertype, allow_proto) land.
Co-authored-by: Ona <no-reply@ona.com>
Add validate_delimited_input() that rejects leading '+', trailing '+', and consecutive '++' before tokenization. strtok_r collapses adjacent delimiters, so without this check 'ipv4+', '+ipv4', and 'ipv4++arp' would be silently accepted as valid input. Co-authored-by: Ona <no-reply@ona.com>
95679b3 to
3f99ffb
Compare
93071f5 to
29e8571
Compare
fntlnz
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends the input model from single scalars to arrays, enabling future
multi-value programs (
allow_ethertype,allow_proto).Changes
refactor: extend input unions with multi-value structs— addsethertypes(__u16[8]+ count) andprotos(__u8[8]+ count)structs to the input union in both
chain_entryandstruct config.MAX_MULTI_VALUES = 8shared across all multi-value types.feat: add multi-value input parsers for ethertypes and protos—parse_ethertypes()splits on+, accepts symbolic names (ipv4,arp,ipv6) and0x-prefixed hex.parse_protos()splits on+,accepts symbolic names (
tcp,udp,icmp) and decimal numbers.Both validate: no empty lists, no duplicates, no overflow, no
out-of-range values.
feat: add multi-value rodata support to build system template—api.luanow supports table-formatinput_fieldsentries(
{ field = "ethertypes", multi = true }) alongside plain strings.What this enables
When
allow_ethertypeorallow_protoland, they need only:.bpf.cfilecaseinload_chain_program()input_fieldsentry inapi.luaparse_input()/program_requires_input()wiringThe parsers and rodata plumbing are ready.
Stacked on
feat/dispatcher-chain) — parser fixesfeat/dispatcher-bpf) — dispatcher infrastructure