Page MenuHomeFreeBSD

Make temp option for ndp work
Needs ReviewPublic

Authored by lytboris_gmail.com on Mar 23 2025, 8:20 AM.
Referenced Files
Unknown Object (File)
Tue, Jan 20, 6:27 PM
Unknown Object (File)
Tue, Jan 20, 5:42 AM
Unknown Object (File)
Tue, Jan 20, 5:41 AM
Unknown Object (File)
Mon, Jan 19, 6:14 PM
Unknown Object (File)
Jan 10 2026, 8:14 PM
Unknown Object (File)
Jan 10 2026, 3:33 PM
Unknown Object (File)
Jan 10 2026, 4:27 AM
Unknown Object (File)
Dec 30 2025, 7:47 AM

Details

Reviewers
melifaro
glebius
Summary

Both ways to create an artificial NDP record are broken: a call via rtsock sets wrong timeout, a netlink code does not check opts.expire_time value at all.

Patch addresses both issues.

Test Plan
  1. add 2001:DB8::/64 to an interface
  2. run ndp -s 2001:DB8::c001 11:22:33:44:55:66 temp
  3. check ndp -an | fgrep 2001:DB8::c001 to have < 20 minutes timeout
  4. rebuild ndp with -DWITHOUT_NETLINK=1 and repeat steps 1-3

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Thank you for working on this! Can we add tests here?

Are the tests that hard to add, or perhaps can it be proceeded with further without them?

Are the tests that hard to add, or perhaps can it be proceeded with further without them?

I will try to add them this or the next week, it takes a while to get familiar with test suite.

usr.sbin/ndp/ndp.c
960

IMHO the comment isn't really needed. It just reiterates what we see in the code. If you don't like idea of using uptime for that purpose you'd better make a longer XXX comment that would elaborate on why using uptime is not the best idea.

usr.sbin/ndp/ndp_netlink.c
484–495
507

Please declare int off; at the beginning of the block.

P.S. IMHO, the entire API construct of adding a nested attribute should be a bit easier. Just comment into the air, not asking for anything here :)

I had already done some quick testing of the previous version earlier, but today I rebased this patch onto the latest version and applied it to the 16.0-CURRENT sources to do some testing.

I’m not fully familiar with the NDP mechanics, but when an entry expires, shouldn’t it be removed and the NDP resolution performed again? That doesn’t seem to be happening here. The NDP entry is marked as expired, but the host continues to use it and sends packets as if it were a static entry.

I’m not sure whether this is caused by the patch or if the bug is elsewhere.