diff --git a/router/fastdp.go b/router/fastdp.go index 3b3fbb06..3c1efa7d 100644 --- a/router/fastdp.go +++ b/router/fastdp.go @@ -765,10 +765,10 @@ func (fwd *fastDatapathForwarder) Forward(key ForwardPacketKey) FlowOp { defer fwd.lock.RUnlock() if fwd.remoteAddr == nil { - // Returning nil would discard the packet, but also - // result in a flow rule, which we would have to - // invalidate when we learn the remote IP. So for - // now, just prevent flows. + // Returning a DiscardingFlowOp would discard the + // packet, but also result in a flow rule, which we + // would have to invalidate when we learn the remote + // IP. So for now, just prevent flows. return vetoFlowCreationFlowOp{} } @@ -1076,6 +1076,10 @@ func (fastdp *FastDatapath) send(fops FlowOp, frame []byte, lock *fastDatapathLo case vetoFlowCreationFlowOp: createFlow = false default: + if xfop.Discards() { + continue + } + // A foreign FlowOp (e.g. a sleeve forwarding // FlowOp), so send the packet through the // FlowOp interface, decoding the packet diff --git a/router/flow.go b/router/flow.go index 34a1a7f7..217c1e95 100644 --- a/router/flow.go +++ b/router/flow.go @@ -84,15 +84,12 @@ func (mfop *MultiFlowOp) Discards() bool { return true } +// Flatten out a FlowOp to eliminate any MultiFlowOps func FlattenFlowOp(fop FlowOp) []FlowOp { return collectFlowOps(nil, fop) } func collectFlowOps(into []FlowOp, fop FlowOp) []FlowOp { - if fop == nil { - return into - } - if mfop, ok := fop.(*MultiFlowOp); ok { for _, op := range mfop.ops { into = collectFlowOps(into, op)