ndp: fix macOS IPv6 compatibility by using link-local source addresses
authorStephen Groat <[email protected]>
Wed, 8 Oct 2025 18:54:51 +0000 (11:54 -0700)
committerÁlvaro Fernández Rojas <[email protected]>
Thu, 9 Oct 2025 06:43:26 +0000 (08:43 +0200)
commitd402cdae431668f55f9d82b7072b0afa3b8090df
treeafcad6d5d0206d40c67d63c26c55e91061bced3c
parent5eac9c56ff3b0a013c5241f449ca144f70bf4c02
ndp: fix macOS IPv6 compatibility by using link-local source addresses

macOS ignores NDP packets that don't originate from link-local addresses,
causing IPv6 connectivity issues with odhcpd. This change ensures NDP
packets (Neighbor Advertisements and ICMP Echo Requests) are sent using
link-local source addresses for RFC 4861 compliance.

Changes:
* Add ndp_from_link_local configuration flag (defaults to true)
* Add odhcpd_send_with_src() to allow explicit source address control
* Add odhcpd_try_send_with_src() helper to eliminate code duplication
* Add odhcpd_get_interface_linklocal_addr() with caching for performance
* Update send_na() and ping6() to use link-local source addresses when
  enabled
* Add RFC 4861, §4.2 comments explaining the mandated behavior
* Maintain backward compatibility with fallback behavior

Fixes: openwrt/openwrt#7561 #202
Signed-off-by: Stephen Groat <[email protected]>
Link: https://github.com/openwrt/odhcpd/pull/242
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
README.md
src/config.c
src/ndp.c
src/odhcpd.c
src/odhcpd.h