mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Fix bad reply to DHCPCONFIRM messages (wrong message type).
Thanks to renmingshuai <renmingshuai@huawei.com> for spotting the error, and making the initial patch.
This commit is contained in:
@@ -1074,7 +1074,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, unsigned char *inbu
|
||||
|
||||
case DHCP6CONFIRM:
|
||||
{
|
||||
int good_addr = 0;
|
||||
int good_addr = 0, bad_addr = 0;
|
||||
|
||||
/* set reply message type */
|
||||
outmsgtype = DHCP6REPLY;
|
||||
@@ -1096,26 +1096,24 @@ static int dhcp6_no_relay(struct state *state, int msg_type, unsigned char *inbu
|
||||
|
||||
if (!address6_valid(state->context, &req_addr, tagif, 1))
|
||||
{
|
||||
o1 = new_opt6(OPTION6_STATUS_CODE);
|
||||
put_opt6_short(DHCP6NOTONLINK);
|
||||
put_opt6_string(_("confirm failed"));
|
||||
end_opt6(o1);
|
||||
bad_addr = 1;
|
||||
log6_quiet(state, "DHCPREPLY", &req_addr, _("confirm failed"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
good_addr = 1;
|
||||
log6_quiet(state, "DHCPREPLY", &req_addr, state->hostname);
|
||||
else
|
||||
{
|
||||
good_addr = 1;
|
||||
log6_quiet(state, "DHCPREPLY", &req_addr, state->hostname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* No addresses, no reply: RFC 3315 18.2.2 */
|
||||
if (!good_addr)
|
||||
if (!good_addr && !bad_addr)
|
||||
return 0;
|
||||
|
||||
o1 = new_opt6(OPTION6_STATUS_CODE);
|
||||
put_opt6_short(DHCP6SUCCESS );
|
||||
put_opt6_string(_("all addresses still on link"));
|
||||
put_opt6_short(bad_addr ? DHCP6NOTONLINK : DHCP6SUCCESS);
|
||||
put_opt6_string(bad_addr ? (_("confirm failed")) : (_("all addresses still on link")));
|
||||
end_opt6(o1);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user