Hop limit override

Evgeniy Khramtsov evgeniy at khramtsov.org
Tue May 4 23:00:46 UTC 2021


Hi net,

According to in6_selecthlim() in in6_src.c, hlim selection order is:

1. hlim specified via ioctl;
2. interface chlim via nd if outgoing interface;
3. V_ip6_defhlim.

Let us suppose one needs to change the default non-ioctl hlim.

The obvious way without reading in6_src.c would be to specify it via
net.inet6.ip6.hlim. But then it would not work if there is curhlim:

# ndp -i foo
... curhlim=255 ...

Changing it via 'ndp -i foo curhlim=bar' seems to be temporary.
I thought rtsold may refresh it back to the original value, though
the value changes back to the original after rtsold was stopped.

The first question: is nd behaviour a bug or works as intended?
The second question: what would be the best way to override hlim?

Currently I patched in6_selecthlim() to always return V_ip6_defhlim,
though I am more interested to know a way that already works, or the
way networking people would accept as a patch.

If it matters, the described behaviour was observed on FreeBSD 14.

--
(reachability warning: IPv6-only email address)


More information about the freebsd-net mailing list