Hi tech@, I tried to understand the output of "ifconfig bridge0 addr", especially the "magic number" after the interface name. Apparently it indicates the aging of the entry (the value is only ever 0 or 1). Eventually I looked at the aging cycle code in bridge_rtage() and wondered why there are 3 different cases (if/else-if/else). Finally I came up with below diff to make the code easier to understand and shorter (no functional change intended): Either the conditions are met to remove the entry, or else the value of brt_age is set to 0.
The current code (with the 3 if-cases) was introduced in if_bridge.c in rev 1.6 - almost 20 years ago. In said rev the aging code was extended by a 3rd case to take into account static entries. However, the same thing can be achieved with just 2 if-cases. I tested this on i386 for a couple of weeks. Regards Holger Index: bridgectl.c =================================================================== RCS file: /cvs/src/sys/net/bridgectl.c,v retrieving revision 1.13 diff -u -p -u -r1.13 bridgectl.c --- bridgectl.c 12 Dec 2018 14:19:15 -0000 1.13 +++ bridgectl.c 25 Dec 2018 21:53:06 -0000 @@ -329,20 +329,17 @@ bridge_rtage(void *vsc) for (i = 0; i < BRIDGE_RTABLE_SIZE; i++) { n = LIST_FIRST(&sc->sc_rts[i]); while (n != NULL) { - if ((n->brt_flags & IFBAF_TYPEMASK) == IFBAF_STATIC) { - n->brt_age = !n->brt_age; - if (n->brt_age) - n->brt_age = 0; - n = LIST_NEXT(n, brt_next); - } else if (n->brt_age) { - n->brt_age = 0; - n = LIST_NEXT(n, brt_next); - } else { + if ((n->brt_flags & IFBAF_TYPEMASK) != IFBAF_STATIC + && n->brt_age == 0) { + // remove non-static aged entries p = LIST_NEXT(n, brt_next); LIST_REMOVE(n, brt_next); sc->sc_brtcnt--; free(n, M_DEVBUF, sizeof *n); n = p; + } else { + n->brt_age = 0; + n = LIST_NEXT(n, brt_next); } } }