24.2 C
New York
Friday, September 6, 2024

How FDB (Filtering Database) is stuffed out


I wish to perceive what’s used as a VLAN column within the FDB. For ACCESS port it’s PVID if body untagged or body VID if body is tagged, for TRUNK it’s allowed VLANs?

We will symbolize the CAM document of the FDB in a desk as the next construction:

kind FdbEntry struct {
    Port    uint16
    Handle MACAddr
    Kind    uint8
    Vlan    []uint16
    TTL     Period
}

But when the body got here to the trunk port, the trunk port can have a number of VLANs, respectively we set within the Vlan area an array of VLANs specified on the trunk interface. If the port is ACCESS we use PVID. For the reason that quickest choice together with the CAM desk to get the document is by way of hash-map, the important thing should be distinctive and as a key we use MAC tackle of the sender. That is why the Vlan area is an array.

When body was got here, we should discover an entry in FDB (as a result of we’re supporting 802.1Q)
If an entry is discovered, we be sure that to verify the entry port ID with the ingress port ID, as a result of the system could also be reconnected to a different port, so the port ID should be modified accordingly.
If the entry was not discovered, we have now to create an entry within the desk (FDB) with the PVID of the ingress port because the Vlan area. Or if ingress body tagged, we should set a body VID because the Vlan area as a substitute of ingress PVID?

t = FdbEntry{
    Port:    ingressPort.Id,
    Handle: ingressFrame.srcAddr,
    Kind:    DYNAMIC,
    Vlan:    ingressPort.Vlans(),
    TTL:     60 * Second,
}

Checking for "MAC motion second"

isMoved = fdbEntry.Port != ingressPort.Id
if isMoved {
    // Be sure you verify if a body got here to us, however from underneath a special port,
    // we should essentially overwrite the port within the desk.
    t = FdbEntry{
        Port:    ingressPort.Id,
        Handle: fdbEntry.Handle,
        Kind:    fdbEntry.Kind,
        Vlan:    fdbEntry.Vlan,
        TTL:     fdbEntry.TTL,
    }
    fdbTable.Replace(ingressFrame.srcAddr, t) // replace hash-map 
}

See illustartion under:

enter image description here

Additionally, will we add the entry as quickly because the body arrives (after solely ingress filtering (if enabled)), or will we add the entry solely when the ingress, egress filtering, forwaring course of will probably be profitable?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles