Skip to content

Commit

Permalink
controller: Accept unicast dhcp-discover in pinctrl_handle_put_dhcp_o…
Browse files Browse the repository at this point in the history
…pts().

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]>
Acked-by: Mark Michelson <[email protected]>
Signed-off-by: Numan Siddique <[email protected]>
  • Loading branch information
LorenzoBianconi authored and numansiddique committed Oct 16, 2024
1 parent 3dbded6 commit f74b38f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
5 changes: 0 additions & 5 deletions controller/pinctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 16 additions & 0 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -7479,6 +7479,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])

Expand Down

0 comments on commit f74b38f

Please sign in to comment.