Commit 1635c937 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

sims/net/switch: only look up mac address once per packet

parent 43825889
......@@ -409,8 +409,9 @@ static void switch_pkt(Port &port, size_t iport) {
mac_table[src] = iport;
}
// L2 forwarding
if (mac_table.count(dst) > 0) {
size_t eport = mac_table.at(dst);
auto i = mac_table.find(dst);
if (i != mac_table.end()) {
size_t eport = i->second;
forward_pkt(pkt_data, pkt_len, eport);
} else {
// Broadcast
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment