From 8c574bd2fe623cf8bb6e91f6f086e25a9f13e104 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Mon, 17 Nov 2025 02:15:51 +0100 Subject: [PATCH] dhcpv6: prevent network loop scenario MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It's possible for odhcpd to talk with its (odhcp6c) self in a network loop scenario with strange results. Prevent this by returning early. Signed-off-by: Paul Donald Link: https://github.com/openwrt/odhcpd/pull/314 Signed-off-by: Álvaro Fernández Rojas --- src/dhcpv6.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dhcpv6.c b/src/dhcpv6.c index a808400..9d81262 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -708,6 +708,12 @@ static void handle_client_request(void *addr, void *data, size_t len, } } + if (dest.serverid_length == clientid.len && + !memcmp(clientid.buf, dest.serverid_buf, dest.serverid_length)) { + /* Bail if we are in a network loop where we talk with ourself */ + return; + } + if (!IN6_IS_ADDR_MULTICAST((struct in6_addr *)dest_addr) && iov[IOV_NESTED].iov_len == 0 && (hdr->msg_type == DHCPV6_MSG_REQUEST || hdr->msg_type == DHCPV6_MSG_RENEW || hdr->msg_type == DHCPV6_MSG_RELEASE || hdr->msg_type == DHCPV6_MSG_DECLINE)) { -- 2.30.2