OPNsense plugin · os-mac-alias-cache 1.4

MAC Alias Cache

Shows what every MAC-type firewall alias really resolves to, and rebuilds them from current host discovery data on demand, instead of waiting up to twelve hours for stale addresses to age out. It can also give each MAC alias the IPv6 addresses host discovery misses.

Why this plugin

OPNsense resolves MAC-type aliases through a cache of addresses reported by its host discovery. When a device is still being seen, its entry is refreshed. When it is no longer reported at all (it left, moved to an unwatched interface, or its records expired), its last addresses stay in the cache for up to 12 hours, in its own alias and in every alias that nests it. Rules keep matching an address that may already belong to another device.

Firewall > Diagnostics > Aliases cannot fix that: its flush and delete act on the pf table only, and the next alias refresh reloads the table from the same cache.

Using it

Firewall > Diagnostics > MAC Alias Cache lists each MAC alias with its entries, the MACs that match, the addresses cached versus those host discovery reports now, and the aliases that nest it.

The MAC Alias Cache page: the last flush result for each alias, and a MAC alias expanded to show its MACs, the addresses host discovery reports and those added from the neighbor table
The page after a flush, with one alias expanded: its two MACs, the addresses host discovery reports, and two IPv6 addresses added from the neighbor table. From a live firewall, with alias names, MACs and addresses replaced by illustrative ones. Select the image for full size.

Flush & rebuild replaces the cache with one seeded only from current host discovery data and rebuilds every MAC alias and every alias nesting one, under core's own alias update lock. If the host list cannot be read, or is empty, it refuses and changes nothing, because core would otherwise rebuild every MAC alias as empty. It also refuses read-only users, runs one flush at a time, checks each host row's MAC and address before it reaches the cache, and refuses when the core files it relies on no longer match what it was built against (after a core update). The cache keeps core's own permissions.

Core's issue for this, opnsense/core#10114, was closed without a fix, and core 26.7.10 still keeps an address 12 hours. Should a later release carry one, the page says so: MAC aliases may then drop a vanished address on their own, and the addresses from the neighbor table (below) may no longer reach the aliases.

From a shell, as root: configctl macaliascache status and configctl macaliascache flush.

Addresses host discovery misses

Host discovery records an IPv6 address when it sees a host send a neighbor solicitation or advertisement from it. A host that answers for a privacy address from its stable address gets no row for the privacy address unless host discovery's Promiscuous mode is on: the network card then passes the duplicate address detection probe the host sends for it, and host discovery records the address from that (opnsense/hostwatch#39). With it off, a MAC alias for that host holds one address while the host opens connections from several, and a rule on the alias misses them.

Since 1.4 the page has a setting, Add addresses from the neighbor table, off by default. Tick it and press Apply. While it is on, and while host discovery is on, the plugin adds to core's cache, each minute, the IPv6 addresses the kernel's neighbor table has for a MAC of a MAC alias and host discovery does not list for that MAC. Core's own alias update then puts them in the alias and in every alias nesting it. The page lists them under their MAC.

Turned off again, the addresses leave the cache at once and the aliases at core's next update. Removing the package does the same. A flush keeps them while the setting is on, since the neighbor table is current data too.

The page warns, while the setting is on, when the update has failed for ten minutes, when a limit kept addresses out, when core no longer merges such entries, and when no update has completed for two hours. From a shell: configctl macaliascache neighbors runs one update.

Limits

For the addresses from the neighbor table:

Source and install

Install it from the LegoTypes repository: see Install. Source: LegoTypes/plugins, net/mac-alias-cache.