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 are able to signify the CAM document of the FDB in a desk as the next construction:
kind FdbEntry struct {
Port uint16
Handle MACAddr
Sort 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. Because the 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 certain to test the entry port ID with the ingress port ID, as a result of the machine 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,
Sort: DYNAMIC,
Vlan: ingressPort.Vlans(),
TTL: 60 * Second,
}
Checking for "MAC motion second"
isMoved = fdbEntry.Port != ingressPort.Id
if isMoved {
// You'll want to test if a body got here to us, however from below a unique port,
// we should essentially overwrite the port within the desk.
t = FdbEntry{
Port: ingressPort.Id,
Handle: fdbEntry.Handle,
Sort: fdbEntry.Sort,
Vlan: fdbEntry.Vlan,
TTL: fdbEntry.TTL,
}
fdbTable.Replace(ingressFrame.srcAddr, t) // replace hash-map
}
See illustartion beneath:
Additionally, can we add the entry as quickly because the body arrives (after solely ingress filtering (if enabled)), or can we add the entry solely when the ingress, egress filtering, forwaring course of shall be profitable?