From 6397414f52df7d224fb4bf05024715f3b8f88c25 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 21 Jan 2020 21:13:27 +0000 Subject: Implement weak host model Use weak host model if forwarding is enabled. --- pkg/tcpip/stack/nic.go | 8 ++++++++ 1 file changed, 8 insertions(+) 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() -- cgit v1.2.3