dpgen,datapath: generate Go types for BPF maps and variables#44755
Merged
ti-mo merged 9 commits intocilium:mainfrom Mar 19, 2026
Merged
dpgen,datapath: generate Go types for BPF maps and variables#44755ti-mo merged 9 commits intocilium:mainfrom
ti-mo merged 9 commits intocilium:mainfrom
Conversation
Contributor
Author
|
/test |
1 similar comment
|
/test |
Contributor
Author
|
/test |
1 similar comment
|
/test |
Contributor
Author
|
/test |
|
/test |
Contributor
Author
|
/test |
Contributor
Author
|
/test |
1 similar comment
|
/test |
tklauser
reviewed
Mar 17, 2026
Contributor
Author
|
/test |
1 similar comment
|
/test |
tklauser
approved these changes
Mar 18, 2026
Member
tklauser
left a comment
There was a problem hiding this comment.
Thanks, nice work! Looks good for my code owners and I briefly looked through the core changes too. My review comment has been addressed.
Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
For parsing v4addr into a Go type that can be assigned to with a byte slice,
the byte array needs to be the first member in the union. bpf2go picks the first
member since Go doesn't have unions. Otherwise, v4addr would become `struct
{ be32 uint32; }`, which is not very convenient nor sound in Go.
Also make sure structs embedding a v4/v6 union get zero-initialized correctly,
since having implicit padding means uninitialized memory can get passed to map
lookups which may upset the verifier.
Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
…kage dpgen imports these. If there's a bug that causes pkg/datapath/config to not build, dpgen can't be run anymore. Turns out it's not a great idea to manage a package you import. Move the constants to a separate package to prevent this chicken-egg problem. Signed-off-by: Timo Beckers <timo@isovalent.com>
If an incompatible map error occurs due to a partial rebuild or a subtle bug with build permutations, it can be difficult to figure out where the problem lies exactly. By dumping successful files along with the name of the incoming map and object, this becomes much easier to troubleshoot. ``` Error: "bpf_host.o" contains map "cilium_calls" incompatible with one or more BPF objects [bpf_alignchecker.o]: max entries mismatch: 49 != 50 ``` Signed-off-by: Timo Beckers <timo@isovalent.com>
… keys We'll need this for variables in a follow-up commit. Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
Contributor
Author
|
/test |
1 similar comment
|
/test |
christarazi
approved these changes
Mar 19, 2026
julianwiedmann
approved these changes
Mar 19, 2026
dylandreimerink
approved these changes
Mar 19, 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.
Best reviewed per commit, but at a high level:
union v4addrto represent ipv4 addresses everywhere in BPF codepkg/datapath/config