ospfd is our first target for using ROUTE_FLAGFILTER to reduce pressure on the route socket, so here's the diff we've been running for a couple of weeks now (minus the fix for RTM_DELETE flags, notably).
ok? Index: kroute.c =================================================================== RCS file: /cvs/src/usr.sbin/ospfd/kroute.c,v retrieving revision 1.113 diff -u -p -r1.113 kroute.c --- kroute.c 9 Nov 2019 15:54:19 -0000 1.113 +++ kroute.c 27 Jul 2020 03:45:41 -0000 @@ -133,6 +133,7 @@ kr_init(int fs, u_int rdomain, int redis int opt = 0, rcvbuf, default_rcvbuf; socklen_t optlen; int filter_prio = fib_prio; + int filter_flags = RTF_LLINFO | RTF_BROADCAST; kr_state.fib_sync = fs; kr_state.rdomain = rdomain; @@ -158,6 +159,11 @@ kr_init(int fs, u_int rdomain, int redis if (setsockopt(kr_state.fd, AF_ROUTE, ROUTE_PRIOFILTER, &filter_prio, sizeof(filter_prio)) == -1) { log_warn("%s: setsockopt AF_ROUTE ROUTE_PRIOFILTER", __func__); + /* not fatal */ + } + if (setsockopt(kr_state.fd, AF_ROUTE, ROUTE_FLAGFILTER, &filter_flags, + sizeof(filter_flags)) == -1) { + log_warn("%s: setsockopt AF_ROUTE ROUTE_FLAGFILTER", __func__); /* not fatal */ }