Page MenuHomeFreeBSD

allow rtadvd to set the rdnss address based on the interface link-local address
Needs RevisionPublic

Authored by denis_h3q.com on Jul 13 2025, 3:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 2, 2:55 AM
Unknown Object (File)
Sat, Sep 27, 1:51 AM
Unknown Object (File)
Wed, Sep 24, 11:40 AM
Unknown Object (File)
Wed, Sep 24, 3:45 AM
Unknown Object (File)
Wed, Sep 24, 2:15 AM
Unknown Object (File)
Tue, Sep 23, 5:47 PM
Unknown Object (File)
Mon, Sep 15, 6:23 AM
Unknown Object (File)
Sep 13 2025, 8:13 AM
Subscribers

Details

Reviewers
kp
ivy
hrs
Group Reviewers
network
Summary

Instead of setting the rdnss address directly, this change adds a LINKLOCAL keyword so the address will be dynamically deducted from the specified interface.

With this change it is possible to switch hardware or ethernet interfaces without changing the rtadvd.config while using the rdnss feature.
Setting the address manually is, of course, still possible.

rtadvd.config example:
denis@host ~ % more rtadvd.conf
em0::rdnss="LINKLOCAL":
em1::rdnss="LINKLOCAL":
em2::rdnss="fe80::1d04:3630:60c3:1ade":

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

denis_h3q.com created this revision.
kp set the repository for this revision to rG FreeBSD src repository.

There are a couple of style issues, but let's worry about those last. (line length, no variable declaration except at the start of blocks).
It'll also need a man page change.

On the whole this seems like a useful little quality of life improvement.

usr.sbin/rtadvd/config.c
830

I don't like Yoda conditionals.
This can just be if (!strcmp()) or if (strcmp() != 0)

851

I'd make this similar to the other syslog here and do syslog(LOG_INFO, "<%s> found LINKLOCAL keyword, changed address to %s on %s", __func__, abuf, ifi->ifi_ifname);

You really need to remove this bit from the proposed commit message:

em2::rdnss="fe80::1d04:3630:60c3:1ade@em2":

As that doesn't work. I take that back. But it should be verified that it does work and goes out on thw wire correctly.

Please also update the man page.

Do you also have corresponding rtsol(d) changes to make use of the link-local adding the link zone indices (or is that functionality there as well).

I would probably also add a reference to https://datatracker.ietf.org/doc/html/rfc8106#section-5.1 Note somewhere?

Lastly if not using arc please upload the next diff generated with -U9999 so context is available on Phabricator.

In D51292#1171320, @bz wrote:

Do you also have corresponding rtsol(d) changes to make use of the link-local adding the link zone indices (or is that functionality there as well).

If your concern is for the receiving side I can say that I'm using my change for two years now with macOS clients and it works well after Apple fixed a bug I found three years ago (they were not using the link zone indices, only if you configered it manually (FB9737974)). Linux and FreeBSD also handle the link local RDNSS entry well.

I would probably also add a reference to https://datatracker.ietf.org/doc/html/rfc8106#section-5.1 Note somewhere?
Lastly if not using arc please upload the next diff generated with -U9999 so context is available on Phabricator.

Will do.

usr.sbin/rtadvd/config.c
851

"found LINKLOCAL keyword" is oddly informal for a log message.

i would suggest something like "<%s>: using link-local address %s for rdnss".

usr.sbin/rtadvd/config.c
830

i think i'd rather use a boolean capability here, e.g. rdnss.linklocal. this seems more in the spirit of the cap format.

831

can we move this into a separate (static) function? the rtadvd code is already quite "interesting" to read, but not adding large inline blocks might help not make it worse.

I put the code into a function like requested.

usr.sbin/rtadvd/config.c
830

At first I thought this is a good idea, but it does not really fit in or really complicates the rdnss code.

em0::rdnss="":rdnss.linklocal would not work without changing the code a lot.

with the LINKLOCAL keyword it really replaces one entry in the rdnss list and keeps all the other functionality working.

usr.sbin/rtadvd/config.c
362

You could check ifa == NULL and no need for the success variable then

denis_h3q.com marked 2 inline comments as done.

LGTM. Absent objections in the next day or two I'll commit this.

This revision is now accepted and ready to land.Aug 11 2025, 9:46 AM

added a line to the rtadvd.conf manpage.

This revision now requires review to proceed.Aug 11 2025, 11:53 AM

added a line to the rtadvd.conf manpage.

hrs requested changes to this revision.Aug 12 2025, 12:38 AM
hrs added a subscriber: hrs.

Just curious, but why do you want to use automatically-generated LLAs? If you manually assign and use fe80::53/64 to the DNS server, for example, you can use it consistently without editing the configuration even when changing NICs on it.

usr.sbin/rtadvd/config.c
334

Please change update_ifinfo() function to store LLAs in addition to L2 addrs instead of calling getifaddrs() here. The rtadvd is designed so that all of the interface information are obtained in that function consistently.

862

The current code will pass "LINKLOCAL" as an entry. If the expansion does not work, the entry should be disabled or it should emit an error.

This revision now requires changes to proceed.Aug 12 2025, 12:38 AM