From: Justin Cinkelj <[email protected]>
Committer: Nadav Har'El <[email protected]>
Branch: master
DHCP - additional refinements
From RFC 2131, page 30-31
o DHCPREQUEST generated during SELECTING state:
Client inserts the address of the selected server in 'server
identifier', 'ciaddr' MUST be zero, 'requested IP address MUST be
filled in with the yiaddr value from the chosen DHCPOFFER.
o DHCPREQUEST generated during RENEWING state:
'server identifier' MUST NOT be filled in, 'requested IP address'
option MUST NOT be filled in, 'ciaddr' MUST be filled in with
client's IP address.
I understand "'server identifier'/'requested IP address' MUST NOT be filled
in"
as instruction to not include those two DHCP OPTIONS into RENEWING/REBINDING
DHCPREQUEST. So I tried to add additional change, as an attempt to be more
RFC
compliant. After that change, code still works - well, at least against
dnsmasq.
Waldek Kozaczuk tested against InfoBlox and in AWS and it works.
Message-Id:
<1436431666.124738710.1490222473623.javamail.zim...@zimbra.xlab.si>
---
diff --git a/core/dhcp.cc b/core/dhcp.cc
--- a/core/dhcp.cc
+++ b/core/dhcp.cc
@@ -253,12 +253,16 @@ namespace dhcp {
ip::address_v4::bytes_type dhcp_server_ip = sip.to_bytes();
ip::address_v4::bytes_type requested_ip = yip.to_bytes();
options = add_option(options, DHCP_OPTION_MESSAGE_TYPE, 1,
DHCP_MT_REQUEST);
- options = add_option(options, DHCP_OPTION_DHCP_SERVER, 4,
(u8*)&dhcp_server_ip);
+ if(request_packet_type == DHCP_REQUEST_SELECTING) {
+ options = add_option(options, DHCP_OPTION_DHCP_SERVER, 4,
(u8*)&dhcp_server_ip);
+ }
char hostname[256];
if (0 == gethostname(hostname, sizeof(hostname))) {
options = add_option(options, DHCP_OPTION_HOSTNAME,
strlen(hostname), (u8*)hostname);
}
- options = add_option(options, DHCP_OPTION_REQUESTED_ADDRESS, 4,
(u8*)&requested_ip);
+ if(request_packet_type == DHCP_REQUEST_SELECTING) {
+ options = add_option(options, DHCP_OPTION_REQUESTED_ADDRESS,
4, (u8*)&requested_ip);
+ }
options = add_option(options, DHCP_OPTION_PARAMETER_REQUEST_LIST,
sizeof(requested_options), requested_options);
*options++ = DHCP_OPTION_END;
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.