Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to parse union type on yaml #250

Closed
cdkunsong opened this issue Aug 16, 2023 · 3 comments
Closed

How to parse union type on yaml #250

cdkunsong opened this issue Aug 16, 2023 · 3 comments

Comments

@cdkunsong
Copy link

Hi,
I have a question about ebpf_exporter ask you
For bcc libbpf-tools,for ipv4/ipv6, it use union type.
struct event {
union {
__u32 saddr_v4;
__u8 saddr_v6[16];
};
union {
__u32 daddr_v4;
__u8 daddr_v6[16];
};
Have you ever used, how to define the yaml file to parse it(ipv4/ipv6)?
I only found one issue, use two metric for ipv4/ipv6
#46

whether have other method?
Thanks!

@bobrik
Copy link
Contributor

bobrik commented Aug 20, 2023

A struct is just a bunch of bytes and there is no way of knowing which union type you expect to use for decoding.

You need separate configurations for IPv4 and IPv6. I'll add an example.

@bobrik
Copy link
Contributor

bobrik commented Aug 20, 2023

See #251.

@cdkunsong
Copy link
Author

@bobrik
Thanks for sharing! I will close the issue.

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

No branches or pull requests

2 participants