From: Daniel Wagner <wagi@monom.org>
To: connman@lists.linux.dev
Cc: Daniel Wagner <wagi@monom.org>
Subject: [PATCH] gdhcp: Do not process missing DHCP_SERVER_ID fields
Date: Mon, 26 Jul 2021 09:29:58 +0200 [thread overview]
Message-ID: <20210726072958.23281-1-wagi@monom.org> (raw)
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
next reply other threads:[~2021-07-26 7:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 7:29 Daniel Wagner [this message]
2021-07-28 6:45 ` [PATCH] gdhcp: Do not process missing DHCP_SERVER_ID fields Daniel Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210726072958.23281-1-wagi@monom.org \
--to=wagi@monom.org \
--cc=connman@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).