* [PATCH] gdhcp: Do not process missing DHCP_SERVER_ID fields
@ 2021-07-26 7:29 Daniel Wagner
2021-07-28 6:45 ` Daniel Wagner
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Wagner @ 2021-07-26 7:29 UTC (permalink / raw)
To: connman; +Cc: Daniel Wagner
The DHCP might send an invalid DHCP response with a missing
DHCP_SERVER_ID field. In this case just abort the processing and
return to the idle loop.
Reported by Mike Evdokimov.
---
gdhcp/client.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gdhcp/client.c b/gdhcp/client.c
index c7b85e58e2be..3016dfc2582b 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -2381,6 +2381,9 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
dhcp_client->retry_times = 0;
option = dhcp_get_option(&packet, pkt_len, DHCP_SERVER_ID);
+ if (!option)
+ return TRUE;
+
dhcp_client->server_ip = get_be32(option);
dhcp_client->requested_ip = ntohl(packet.yiaddr);
@@ -2442,6 +2445,8 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
if (dhcp_client->state == REBOOTING) {
option = dhcp_get_option(&packet, pkt_len,
DHCP_SERVER_ID);
+ if (!option)
+ return TRUE;
dhcp_client->server_ip = get_be32(option);
}
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gdhcp: Do not process missing DHCP_SERVER_ID fields
2021-07-26 7:29 [PATCH] gdhcp: Do not process missing DHCP_SERVER_ID fields Daniel Wagner
@ 2021-07-28 6:45 ` Daniel Wagner
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Wagner @ 2021-07-28 6:45 UTC (permalink / raw)
To: connman
On Mon, Jul 26, 2021 at 09:29:58AM +0200, Daniel Wagner wrote:
> The DHCP might send an invalid DHCP response with a missing
> DHCP_SERVER_ID field. In this case just abort the processing and
> return to the idle loop.
>
> Reported by Mike Evdokimov.
Patch applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-28 6:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 7:29 [PATCH] gdhcp: Do not process missing DHCP_SERVER_ID fields Daniel Wagner
2021-07-28 6:45 ` Daniel Wagner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.