diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile index 707e85be7f..03d012bcda 100644 --- a/package/network/services/odhcpd/Makefile +++ b/package/network/services/odhcpd/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=odhcpd -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git diff --git a/package/network/services/odhcpd/patches/0010-router-always-use-link-local-src-address-for-RAs.patch b/package/network/services/odhcpd/patches/0010-router-always-use-link-local-src-address-for-RAs.patch new file mode 100644 index 0000000000..e5187e3ec9 --- /dev/null +++ b/package/network/services/odhcpd/patches/0010-router-always-use-link-local-src-address-for-RAs.patch @@ -0,0 +1,63 @@ +From 7e6acc5c0ab7500ac88ffcfac14dc12b34c1f463 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?David=20H=C3=A4rdeman?= +Date: Sun, 2 Nov 2025 19:25:13 +0100 +Subject: [PATCH] router: always use link-local src address for RAs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is a follow-up to: +https://github.com/openwrt/odhcpd/pull/242 + +As noted by @willmo [1], RAs are currently not strictly limited to using a +link-local source address, which they should according to RFC4861, §4.2. + +This is usually not an issue, since router solicitations typically +originate from link-local source addresses or the undefined address, +meaning that odhcpd will reply with its own link-local address +(auto-selected by the kernel). + +But if a solicitation is sent from e.g. a GUA/ULA address, odhpcd will +currently reply using it's own GUA/ULA address. + +While fixing this, correct some misleading comments. + +[1] https://github.com/openwrt/odhcpd/pull/242#issuecomment-3475020864 + +Signed-off-by: David Härdeman +Link: https://github.com/openwrt/odhcpd/pull/297 +Signed-off-by: Álvaro Fernández Rojas +(cherry picked from commit 74eeff193848a993ee0c42acbd2f4d58721e091c) +--- + src/router.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/src/router.c ++++ b/src/router.c +@@ -1020,7 +1020,7 @@ static int send_router_advert(struct int + + syslog(LOG_DEBUG, "Sending a RA on %s", iface->name); + +- if (odhcpd_send(iface->router_event.uloop.fd, &dest, iov, ARRAY_SIZE(iov), iface) > 0) { ++ if (odhcpd_try_send_with_src(iface->router_event.uloop.fd, &dest, iov, ARRAY_SIZE(iov), iface) > 0) { + iface->ra_sent++; + + config_save_ra_pio(iface); +@@ -1074,7 +1074,7 @@ static void handle_icmpv6(void *addr, vo + } + + +-/* Forward router solicitation */ ++/* Forward a router solicitation from slave to master interface */ + static void forward_router_solicitation(const struct interface *iface) + { + struct icmp6_hdr rs = {ND_ROUTER_SOLICIT, 0, 0, {{0}}}; +@@ -1094,7 +1094,7 @@ static void forward_router_solicitation( + } + + +-/* Handler for incoming router solicitations on slave interfaces */ ++/* Forward a router advertisment from master to slave interfaces */ + static void forward_router_advertisement(const struct interface *iface, uint8_t *data, size_t len) + { + struct nd_router_advert *adv = (struct nd_router_advert *)data; diff --git a/package/network/services/odhcpd/patches/100-support-rewrite-dns-server-to-local.patch b/package/network/services/odhcpd/patches/100-support-rewrite-dns-server-to-local.patch index d69917c9dd..463f8b0fe4 100644 --- a/package/network/services/odhcpd/patches/100-support-rewrite-dns-server-to-local.patch +++ b/package/network/services/odhcpd/patches/100-support-rewrite-dns-server-to-local.patch @@ -9,11 +9,9 @@ Subject: [PATCH] odhcpd: support rewrite dns server to local ipv6 address src/router.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -diff --git a/src/dhcpv6.c b/src/dhcpv6.c -index 58b7d9f..09718d8 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c -@@ -734,7 +734,7 @@ static void relay_server_response(uint8_t *data, size_t len) +@@ -821,7 +821,7 @@ static void relay_server_response(uint8_ } /* Rewrite DNS servers if requested */ @@ -22,11 +20,9 @@ index 58b7d9f..09718d8 100644 if (is_authenticated) return; /* Impossible to rewrite */ -diff --git a/src/router.c b/src/router.c -index 7f5658b..aac1a83 100644 --- a/src/router.c +++ b/src/router.c -@@ -988,7 +988,7 @@ static void forward_router_advertisement(const struct interface *iface, uint8_t +@@ -1138,7 +1138,7 @@ static void forward_router_advertisement odhcpd_get_mac(c, mac_ptr); /* If we have to rewrite DNS entries */ @@ -35,6 +31,3 @@ index 7f5658b..aac1a83 100644 const struct in6_addr *rewrite = c->dns; struct in6_addr addr; size_t rewrite_cnt = c->dns_cnt; --- -2.46.0 -