-
Notifications
You must be signed in to change notification settings - Fork 174
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
dhcpv4 OFFER message isn't received if empty interface #372
Comments
Thanks for the report! Can you share with us how you actually send the response packet, if possible the whole code for your The broadcast flag is a complex matter, but the current behaviour is not a bug as far as I know. The flag only indicates a client capability, and the server only copies the flag from the client, regardless of whether the actual network packet is a broadcast or not. The meaning of the flag is explained in RFC2131§4.1; relevant excerpt:
|
On Sat, Mar 28, 2020 at 6:04 AM Anatole Denis ***@***.***> wrote:
Thanks for the report!
Can you share with us how you actually send the response packet, if possible the whole code for your handler4 function? For comparison, coredhcp's logic for DHCPv4 is here and is not obvious.
I'm literally using the exact same code, except wrapped inside of my
own mgmt wrappers. I will finish the patch shortly and publish it in
its entirety.
Are the logs you shared from the server or the client ?
Sorry-- those are from the server.
Do you have say a pcap of what ends up happening on the wire? That would be especially useful to understand if the packets are malformed or if they just don't end up on the right interface (or aren't sent at all).
Fair! I haven't dug this deep yet, and for all I know it could be a
bug in NetworkManager, but it's sufficiently common that I figured it
would be easy to reproduce on your end, sorry.
The broadcast flag is a complex matter, but the current behaviour is not a bug as far as I know. The flag only indicates a client capability, and the server only copies the flag from the client, regardless of whether the actual network packet is a broadcast or not. The meaning of the flag is explained in RFC2131§4.1; relevant excerpt:
Yeah, I think I mis-understood part of this initially, so ignore my
comments about that. The rest of the bug stands. Thanks for the
excerpt though!
TL;DR: If you run a basic "coredhcp" DHCPv4 server, does it work for
you when interface field is empty string?
Since all the examples are "TODO: dhcpv4" I assumed this was just
overlooked and it's a legitimate bug.
Thanks for the prompt reply!
|
Any chance you had a chance to try? If not, lmk and I can make you a custom build. |
Hey! Sorry I skipped over that question in the first read. I have a hunch: Do you have a default route where the server is running ? If I don't have a default route in the netns where coredhcp is running, I have the same symptoms as you: running when bound to a specified interface works fine, while running without binding to an interface (with interface = "") results in the following error:
However, once I add a default route to the netns where coredhcp runs, it works fine both with and without an interface specified |
I've been working on a built-in dhcpv4 server in https://github.com/purpleidea/mgmt/
Thanks to your fine library, I don't need to do it all from scratch! (Many thanks!)
In order to learn more about the specific protocol requirements, I've been reading and trying code in: https://github.com/coredhcp/coredhcp
In any case, I start my server like this:
As per the code, it seems that "interface" can be the empty string, eg:
dhcp/dhcpv4/server4/conn.go
Line 40 in eed709d
However, it seems that if this is the case, at least one DHCPv4 client (stock NetworkManager in modern GNU+Linux Fedora 31) doesn't seem to ever receive the OFFER message.
My logs show:
"discover":
"offer"
You'll note that I would expect the flag to be Broadcast, and I think that seems to be a bug in the DHCPv4 server used by coredhcp, but even when I set that, it still doesn't seem to get received properly.
However, if I set the specific interface (eg: to "enp0s31f6") then everything starts working!
I don't know the specific reasons why, but without knowing anything about the low-level plumbing, perhaps this broadcast bit (
dhcp/dhcpv4/server4/conn.go
Line 26 in eed709d
I'm assuming this is a bug in your NewIPv4UDPConn, but I'm happy to learn if it's something I'm doing wrong. Happy to provide anymore info or logs if necessary.
Thank you in advance!
The text was updated successfully, but these errors were encountered: