2

In recent versions of Linux, when an IPv6 route is added with an expiration time, I have noticed the expiration is exceeded by up to about 30 seconds.

Is there some slack built into the route expiration algorithm?

This is easily observed by creating a route with a 5 second expiration and then watching it. E.g.

ip -6 route add 2001:789::/64 dev eth1 expires 5
watch ip -6 route show dev eth1

You will see the expires value countdown and goes negative... eg.

2001:789::/64 metric 1024 expires -19sec pref medium

The route seems to expire about 24 seconds after it was scheduled to expire.

Observations:

  • Affected versions of Linux that I've tried, include: 5.15.146, 6.1.55, 6.5.0-35.
  • An earlier version of Linux (4.18.0-425.13.1) did not have this behaviour.
  • It doesn't matter if this route is added statically or via the kernel receiving an RA.
  • I've tried expiration times up to 10 minutes, they all expire late

Update

Rather than believing what I was seeing with the ip -6 route command, I also ran a test to see if the route is getting resolved after the expiration. The testing shows the Network is unreacahble after expiry, so this might be just a display problem?

Here's the results of that test...

ip -6 route add 2001:789::/64 dev eth1 expires 5
watch ip -6 route get 2001:789::1

Initially, I see:

2001:789::1 dev eth1 src 2001:2:0:1000:9640:c9ff:fed6:77f6 metric 1024 pref medium

Then 5 seconds later, the route expiration reaches 0 seconds, I see:

RTNETLINK answers: Network is unreachable

So the expiration seems to work. I guess this is just a display problem?

1 Answer 1

3

The expired check in Linux net/ipv6/route.c is not fancy, just a time_after comparison.

Your testing indicated the route does become unreachable around when expected.

I am not sure that the iproute developers consider not removing immediately a problem. Could be helpful to the user that expired routes show up in output briefly. And its not like the kernel is running timers to fire when these expire, its just checked on use, from what I understand of the implementation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .