diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-01-21 21:13:27 +0000 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-03-17 20:06:04 +0100 |
commit | 6397414f52df7d224fb4bf05024715f3b8f88c25 (patch) | |
tree | 2a6ab97da604cf260ceae0f84ddaeabc50a4c380 | |
parent | 844171a88b8115ad6fd3654745ac326becd31582 (diff) |
Implement weak host model
Use weak host model if forwarding is enabled.
-rw-r--r-- | pkg/tcpip/stack/nic.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/tcpip/stack/nic.go b/pkg/tcpip/stack/nic.go index 133e6e76b..63c31aef4 100644 --- a/pkg/tcpip/stack/nic.go +++ b/pkg/tcpip/stack/nic.go @@ -1238,6 +1238,14 @@ func (n *NIC) DeliverNetworkPacket(linkEP LinkEndpoint, remote, local tcpip.Link // // TODO: Should we be forwarding the packet even if promiscuous? if n.stack.Forwarding() { + // Implement weak host model when forwarding is enabled + for _, nic := range n.stack.nics { + if ref := nic.getRef(protocol, dst); ref != nil { + handlePacket(n, protocol, dst, src, linkEP.LinkAddress(), remote, ref, pkt) + return + } + } + r, err := n.stack.FindRoute(0, "", dst, protocol, false /* multicastLoop */) if err != nil { n.stack.stats.IP.InvalidDestinationAddressesReceived.Increment() |