rtsold: check RA lifetime before triggering the one-shot always script

Historic context: rtsold is used by *sense to get a router address which
wasn't originally the daemon's purpose.  We only ever get the first address
per interface lifetime so if the RA contains an invalid router with a zero
lifetime and we catch it we cannot get a valid one ever again.

This is suboptimal in a number of ways, but the obvious way to deal with
this is to ignore all RA messages from routers that do not advertise a
default route.

PR: https://github.com/opnsense/core/issues/9551
This commit is contained in:
Franco Fichtner 2025-12-22 22:09:23 +01:00
parent f8a604129b
commit dee15bb1bd

View file

@ -328,9 +328,11 @@ rtsol_input(int sock)
}
/*
* "Always" script.
* "Always" script. This extracts router information, but only
* once per interface "lifetime". To make it more effective check
* the lifetime of the RA in order to see if this router is viable.
*/
if (!ifi->alwaysconfig) {
if (!ifi->alwaysconfig && ntohs(nd_ra->nd_ra_router_lifetime) != 0) {
const char *rasender = inet_ntop(AF_INET6, &from.sin6_addr,
ntopbuf, sizeof(ntopbuf));
ifi->alwaysconfig = 1;