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

Wrong iphdr and tcphdr mapping #2637

Closed
dthaler opened this issue Jun 27, 2023 · 1 comment · Fixed by #2688
Closed

Wrong iphdr and tcphdr mapping #2637

dthaler opened this issue Jun 27, 2023 · 1 comment · Fixed by #2688
Assignees
Labels
bug Something isn't working good first issue Good for newcomers triaged Discussed in a triage meeting
Milestone

Comments

@dthaler
Copy link
Collaborator

dthaler commented Jun 27, 2023

Describe the bug

l3af-project/eBPF-Package-Repository#54 is failing which tries to use iphdr and tcphdr in cross-platform code.

https://github.com/microsoft/ebpf-for-windows/blob/main/include/net/ip.h#L94 defines it as _IPV4_HEADER, but the field names in that struct don't match the expected field names in iphdr which is causing the windows test failures in l3af-project/eBPF-Package-Repository#54.

OS information

No response

Steps taken to reproduce bug

Try to compile l3af-project/eBPF-Package-Repository#54

Expected behavior

Build should succeed

Actual outcome

Build fails

Additional details

D:/a/eBPF-Package-Repository/eBPF-Package-Repository/ratelimiting/ratelimiting_kern.c(103,27): error G1A4676F8: no member named 'ihl' in 'struct _IPV4_HEADER' [D:\a\eBPF-Package-Repository\eBPF-Package-Repository\build\ratelimiting\ratelimiting_kern.vcxproj]
      __u8 l4_offset = iph->ihl * 4; // ipv4 header length
                       ~~~  ^
D:/a/eBPF-Package-Repository/eBPF-Package-Repository/ratelimiting/ratelimiting_kern.c(114,31): error G1A4[67](https://github.com/l3af-project/eBPF-Package-Repository/actions/runs/5384061159/jobs/9771541350?pr=54#step:5:68)6F8: no member named 'doff' in 'struct tcphdr' [D:\a\eBPF-Package-Repository\eBPF-Package-Repository\build\ratelimiting\ratelimiting_kern.vcxproj]
      __u16 data_offset = tcph->doff * 4; // tcp header length
                          ~~~~  ^

https://github.com/microsoft/ebpf-for-windows/blob/main/include/net/tcp.h#L11 has data_offset instead of doff

@dthaler dthaler added the bug Something isn't working label Jun 27, 2023
@dthaler dthaler changed the title Wrong iphdr mapping Wrong iphdr and tcphdr mapping Jun 28, 2023
@dahavey dahavey added triaged Discussed in a triage meeting good first issue Good for newcomers labels Jul 10, 2023
@dahavey dahavey added this to the 2307 milestone Jul 10, 2023
@dthaler dthaler assigned hawkinsw and unassigned delaramamiri Jul 17, 2023
@hawkinsw
Copy link
Collaborator

@dthaler Do you want to add Linux-compatible field names for the IPv6 header, too, while we are at it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers triaged Discussed in a triage meeting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants