Skip to content

Commit

Permalink
Respect IPV6_PREFERRED_ONLY flag on DHS_NONE state
Browse files Browse the repository at this point in the history
Current IPv6_PREFERRED_ONLY (option 108) handling code is only effective
when current state is DHS_DISCOVER and DHS_REBOOT. However, when we
receive multiple ACKs upon our REQUEST, the first ACK will trigger the
use_v6only code path and dhcp_drop() us into DHS_NONE state, as a result
the option 108 on the second ACK won't be handled correctly and we'll
bind to the lease instead.

This patch fixes the issue by adding DHS_NONE as a state to respect
option 108 as well.
  • Loading branch information
taoyl-g authored and rsmarples committed Apr 2, 2024
1 parent 9f8bb1f commit faa3f54
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dhcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3207,8 +3207,8 @@ dhcp_handledhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len,

if (has_option_mask(ifo->requestmask, DHO_IPV6_PREFERRED_ONLY)) {
if (get_option_uint32(ifp->ctx, &v6only_time, bootp, bootp_len,
DHO_IPV6_PREFERRED_ONLY) == 0 &&
(state->state == DHS_DISCOVER || state->state == DHS_REBOOT))
DHO_IPV6_PREFERRED_ONLY) == 0 && (state->state == DHS_DISCOVER ||
state->state == DHS_REBOOT || state->state == DHS_NONE))
{
char v6msg[128];

Expand Down

0 comments on commit faa3f54

Please sign in to comment.