-
Notifications
You must be signed in to change notification settings - Fork 8
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
dhcp-relay: Handle server responses #9
Comments
@tohojo any task that I can pick it up? |
@sachints123 I just found out that the relay doesn't re-calculate the UDP checksum. If you can find an example of how to do that in XDP, it would be much appreciated - thanks in advance. |
@yoelcaspersen it can be done this way usingxdp helper function,
Helper function is in bpf/include/bpf/ctx/xdp.h. |
Thanks, @sachints123, but are you sure it works? It looks like csum_l4_offset_and_flags() and csum_l4_replace() are from a different project (Cilium) - and my compiler can't find bpf/include/bpf/ctx/xdp.h. |
@yoelcaspersen yes but we need to copy the implementation of helpers from cilium, like xdp_store_bytes(). Other way we can try is, calculate the csum as we are doing for IP in relay code and then replace the csum value in udp part. |
@sachints123 thanks for your reply. @netoptimizer suggested that we should just clear the checksum completely:
I tried that, and it works - the packets are received by the DHCP server now. Are there any good reasons to re-calculate the UDP checksum, or should we just rely on the checks in the underlying IP and ethernet layers? |
UDP checksum field for IPv4 is not mandatory, so it should be fine i think. |
@sachints123 I have made a pull request (#11). It works for DHCP requests received as QinQ (double VLAN tags), buf if I disable the check:
to allow the XDP program to inspect single-tagged VLAN packets (server responses are singled tagged in my setup), the verifier complains about the program being too large. Can you take a look at this and see if you can find the issue? I guess it has something to do with the memcpy_var / option 82 loops that the verifier can't work out. I compile the program with LLVM 13 as the verifier should be better than in older releases. Thanks in advance. |
I am not sure why the removal of this check causing verifier issuer, initially when this check was added, it was working even with out any vlan tags. We can still have check without goto statement and it works i feel. |
PS: |
Initial checks:
If option 82 is set, do the following:
Final action:
TBD: Should we look at BOOTP flags (unicast vs. broadcast response)?
The text was updated successfully, but these errors were encountered: