Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
4.0.x - DHCP does not print the correct destination port when sending a reply #3221
How to reproduce the issue
Configure FreeRADIUS to listen on port 6700.
Started with -X, FreeRADIUS says it sends the reply to the sender and port 67 (as expected):
But it actually sends the reply to port 6700, as shown by a tcpdump:
DHCP is a horrible protocol unfortunately. It mandates src/dst ports for various situations. i.e. it doesn't support clients sending packets from random source ports.
It's not really clear what to do here. Perhaps one solution is to use (and enforce) the RFC ports if the server is listening on the RFC ports. i.e. run like a normal DHCP server when using the RFC ports.
Then, if the server isn't listening on the RFC ports, it should just behave like a normal UDP application, and swap src/dst ip/port when sending replies.
Though maybe it's not worth the hassle since non standard ports are just for testing.
But at least, the server should not lie about what it is doing. If it is sending to port 6700, it should not say 67. :)
The "incorrect" reply debug is printed from mod_process (proto_dhcpv4_base.c), before the reply is actually sent.
Maybe just change the debug "Reply will be sent to giaddr." here to add information such as the actual destination port?
(source address could also be useful, since there's some "magic" involved)
Or add a debug "Sending from... to..." at "send_reply" juste before actually sending: