From: Hans Dedecker Date: Tue, 8 Dec 2020 17:43:38 +0000 (+0100) Subject: dhcpv6: harden reconfigure logic X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=0ffa3a31f7146d320214f431291c1196070a010f;p=project%2Fodhcp6c.git dhcpv6: harden reconfigure logic Check if a valid DHCPv6 message is returned by dhcpv6_request in dhcpv6_poll_reconfigure as only RENEW/REBIND/INFORMATION REQUEST messages can trigger the transmission of these messages in reply to a RECONFIGURE Signed-off-by: Hans Dedecker --- diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 312e7aa..b9eac43 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -849,8 +849,21 @@ int dhcpv6_poll_reconfigure(void) { int ret = dhcpv6_request(DHCPV6_MSG_UNKNOWN); - if (ret != -1) + switch (ret) { + /* + * Only RENEW/REBIND/INFORMATION REQUEST + * messaage transmission can be requested + * by a RECONFIGURE + */ + case DHCPV6_MSG_RENEW: + case DHCPV6_MSG_REBIND: + case DHCPV6_MSG_INFO_REQ: ret = dhcpv6_request(ret); + break; + + default: + break; + } return ret; }