MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bridge_rtnode_lookup

Function bridge_rtnode_lookup

freebsd/net/if_bridge.c:3002–3021  ·  view source on GitHub ↗

* bridge_rtnode_lookup: * * Look up a bridge route node for the specified destination. Compare the * vlan id or if zero then just return the first match. */

Source from the content-addressed store, hash-verified

3000 * vlan id or if zero then just return the first match.
3001 */
3002static struct bridge_rtnode *
3003bridge_rtnode_lookup(struct bridge_softc *sc, const uint8_t *addr, uint16_t vlan)
3004{
3005 struct bridge_rtnode *brt;
3006 uint32_t hash;
3007 int dir;
3008
3009 BRIDGE_RT_LOCK_OR_NET_EPOCH_ASSERT(sc);
3010
3011 hash = bridge_rthash(sc, addr);
3012 CK_LIST_FOREACH(brt, &sc->sc_rthash[hash], brt_hash) {
3013 dir = bridge_rtnode_addr_cmp(addr, brt->brt_addr);
3014 if (dir == 0 && (brt->brt_vlan == vlan || vlan == 0))
3015 return (brt);
3016 if (dir > 0)
3017 return (NULL);
3018 }
3019
3020 return (NULL);
3021}
3022
3023/*
3024 * bridge_rtnode_insert:

Callers 3

bridge_rtupdateFunction · 0.85
bridge_rtlookupFunction · 0.85
bridge_rtdaddrFunction · 0.85

Calls 2

bridge_rthashFunction · 0.85
bridge_rtnode_addr_cmpFunction · 0.85

Tested by

no test coverage detected