2

I have OpenBSD 5.9 on a virtual private server. Like other people in these days of No More IPv4 Address Space For You, the machine is allocated only a /32, i.e. a LAN of just a single IPv4 address. The (sole) other node on the LAN is the default gateway to the world supplied by the hosting provider. It's in effect a LAN of two nodes, but without IP broadcasting.

The way to address this is fairly straightfoward and well known. Set up the default route as normal, and create a static route over the LAN network interface in order to reach the default gateway itself. The latter is done in my /etc/hostname.vio0 with the following line

!route add 188.165.223.254 -static -link -iface vio0

Unfortunately, this does not work. The machine regularly loses connectivity to the entire world.

I find that, after a day or two, the static route via the interface has disappeared entirely from the routing table, seemingly at random, at no particularly regular time of day. After adding it back, it will disappear again. Checking, there are no cron jobs or other scheduled tasks that could be triggering it, and it isn't happening aligned to a minute boundary anyway. Moreover, the machine is largely idle most of the times that this happens.

Cranking up route monitor piped through cyclog to a log directory and leaving it running for days, in order to catch the problem when it happens, reveals that it is the kernel itself that is doing this, not some user process:

2016-07-29 06:27:08.436729680 got message of size 144 on Fri Jul 29 06:27:08 2016
2016-07-29 06:27:08.436740030 RTM_DELETE: Delete Route: len 144, priority 0, table 0, ifidx 1, pid: 0, seq 0, errno 0
2016-07-29 06:27:08.436747000 flags:
2016-07-29 06:27:08.436752930 use:        0   mtu:        0    expire:        0 
2016-07-29 06:27:08.436759100 locks:  inits: 
2016-07-29 06:27:08.436764620 sockaddrs: 
2016-07-29 06:27:08.436770290  188.165.223.254 link#1

Why is the OpenBSD kernel doing this? And how do I stop it?

Further reading

3

A colleague opined that "this is one for the OpenBSD mailing list". Following the sage advice to always read the mailing list first before posting I discovered that it has already been brought up there, by Matthieu Herrb in February 2016.

It turns out that this is an OpenBSD 5.9 kernel bug, a regression introduced since 5.8 by the "new" OpenBSD routing table implemented by Martin Pieuchot.

Applying M. Pieuchot's kernel patch to sys/netinet and sys/netinet6 (and rebuilding and installing the kernel) stops this from happening.

Further reading

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.