diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2021-01-06 14:01:05 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-01-06 14:02:45 -0800 |
commit | 7817e3b5e4202eb2001806b5043052a2f5b591a4 (patch) | |
tree | 0784014a9b19933a67ff3adb259135e1d71d393e /pkg/tcpip/link/ethernet/ethernet.go | |
parent | abe9d9f67f2c2c696ef26690fa8518dfc4e28728 (diff) |
Do not filter frames in ethernet link endpoint
Ethernet frames are usually filtered at the hardware-level so there is
no need to filter the frames in software.
For test purposes, a new link endpoint was introduced to filter frames
based on their destination.
PiperOrigin-RevId: 350422941
Diffstat (limited to 'pkg/tcpip/link/ethernet/ethernet.go')
-rw-r--r-- | pkg/tcpip/link/ethernet/ethernet.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/tcpip/link/ethernet/ethernet.go b/pkg/tcpip/link/ethernet/ethernet.go index beefcd008..89e3e6164 100644 --- a/pkg/tcpip/link/ethernet/ethernet.go +++ b/pkg/tcpip/link/ethernet/ethernet.go @@ -49,10 +49,10 @@ func (e *Endpoint) DeliverNetworkPacket(_, _ tcpip.LinkAddress, _ tcpip.NetworkP return } + // Note, there is no need to check the destination link address here since + // the ethernet hardware filters frames based on their destination addresses. eth := header.Ethernet(hdr) - if dst := eth.DestinationAddress(); dst == e.Endpoint.LinkAddress() || dst == header.EthernetBroadcastAddress || header.IsMulticastEthernetAddress(dst) { - e.Endpoint.DeliverNetworkPacket(eth.SourceAddress() /* remote */, dst /* local */, eth.Type() /* protocol */, pkt) - } + e.Endpoint.DeliverNetworkPacket(eth.SourceAddress() /* remote */, eth.DestinationAddress() /* local */, eth.Type() /* protocol */, pkt) } // Capabilities implements stack.LinkEndpoint. |