According to RFC 2131 section 4.4.4, when the DHCP client knows the address of a DHCP server, in either INIT or REBOOTING state, the client may use that address in the DHCPDISCOVER or DHCPREQUEST rather than the IP broadcast address. Fix pinctrl_handle_put_dhcp_opts implementation according to the RFC 2131.
Reported-at: https://issues.redhat.com/browse/FDP-765 Signed-off-by: Lorenzo Bianconi <[email protected]> --- Changes in v2: - remove unnecessary ip.dst checks in pinctrl_handle_put_dhcp_opts since we already filter the packets using the server_ip in the related logical flow. - move the new test item at the bottom of the ovn test in order to reduce changes. --- controller/pinctrl.c | 5 ----- tests/ovn.at | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/controller/pinctrl.c b/controller/pinctrl.c index c86b4f940..b891435c1 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -2598,11 +2598,6 @@ pinctrl_handle_put_dhcp_opts( switch (dhcp_opts.dhcp_msg_type) { case DHCP_MSG_DISCOVER: msg_type = DHCP_MSG_OFFER; - if (in_flow->nw_dst != htonl(INADDR_BROADCAST)) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); - VLOG_WARN_RL(&rl, "DHCP DISCOVER must be Broadcast"); - goto exit; - } break; case DHCP_MSG_REQUEST: { msg_type = DHCP_MSG_ACK; diff --git a/tests/ovn.at b/tests/ovn.at index 4b6e8132f..729e652ed 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -7463,6 +7463,22 @@ expected_dhcp_opts=${boofile}330400000e100104ffffff0003040a00000136040a000001 test_dhcp 20 1 f00000000001 01 0 $ciaddr $offer_ip $request_ip 1 0 ff1000000001 $server_ip 02 $expected_dhcp_opts compare_dhcp_packets 1 +# ---------------------------------------------------------------------- + +# Send unicast DHCPDISCOVER. +reset_pcap_file hv1-vif1 hv1/vif1 +reset_pcap_file hv1-vif2 hv1/vif2 +rm -f 1.expected +rm -f 2.expected + +offer_ip=`ip_to_hex 10 0 0 4` +server_ip=`ip_to_hex 10 0 0 1` +ciaddr=`ip_to_hex 0 0 0 0` +request_ip=0 +expected_dhcp_opts=4311626f6f7466696c655f6e616d655f616c74330400000e100104ffffff0003040a00000136040a000001 +test_dhcp 21 1 f00000000001 01 0 $ciaddr $offer_ip $request_ip 0 1 $offer_ip $server_ip ff1000000001 $server_ip 02 $expected_dhcp_opts +compare_dhcp_packets 1 + as hv1 OVS_APP_EXIT_AND_WAIT([ovn-controller]) -- 2.46.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
