openwrt / odhcpd

This repository is a mirror of https://git.openwrt.org/?p=project/odhcpd.git. Pull requests will be accepted which will be merged in odhcpd.git
GNU General Public License v2.0
162 stars 98 forks source link

RA relay shouldn't relay link-local DNS #218

Open AndersTrier opened 5 months ago

AndersTrier commented 5 months ago

.. as that DNS server address is unreachable from clients.

The router advertisements sent by my OPPO 5G CPE T2 sets a link-local DNS resolver. This works fine for clients connected directly to the OPPO router. It doesn't work for clients behind a second router that uses odhcpd to relay the router advertisements, as the link-local address of the OPPO router is unreachable from behind this second router.

Suggested fix: If relaying a router advertisement that includes a link-local DNS, remove that entry from the relayed message as that will never work.

If the dns_service option is enabled, set c->always_rewrite_dns to true so we hit https://github.com/openwrt/odhcpd/blob/master/src/router.c#L971C1-L971C59

AndersTrier commented 5 months ago

Announcing a link-local address as DNS is permitted by RFC 8106 section 5.1:

Note: The addresses for RDNSSes in the RDNSS option MAY be link-local addresses.

Homas commented 1 month ago

The same with TMO's trashcan (Nokia). Due to the issue every DNS resolution always takes significantly longer on MacOS. IMO ra_dns should be applied in relay mode as well.