From be7c65eb6d3fb657a059707da3ca559937e59739 Mon Sep 17 00:00:00 2001 From: Roee Gadot Date: Wed, 25 Aug 2021 17:28:14 +0300 Subject: [PATCH] fix getStreamProps function. (it should be passed from CLI as it was before). --- tap/tcp_stream_factory.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tap/tcp_stream_factory.go b/tap/tcp_stream_factory.go index 2a8f228b1..cb4e4068e 100644 --- a/tap/tcp_stream_factory.go +++ b/tap/tcp_stream_factory.go @@ -19,7 +19,7 @@ import ( */ type tcpStreamFactory struct { wg sync.WaitGroup - outbountLinkWriter *OutboundLinkWriter + outboundLinkWriter *OutboundLinkWriter AllExtensionPorts []string Emitter api.Emitter } @@ -36,9 +36,9 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T dstPort := transport.Dst().String() // if factory.shouldNotifyOnOutboundLink(dstIp, dstPort) { - // factory.outbountLinkWriter.WriteOutboundLink(net.Src().String(), dstIp, dstPort, "", "") + // factory.outboundLinkWriter.WriteOutboundLink(net.Src().String(), dstIp, dstPort, "", "") // } - props := factory.getStreamProps(srcIp, dstIp, srcPort, dstPort, factory.AllExtensionPorts) + props := factory.getStreamProps(srcIp, dstIp, dstPort) isTapTarget := props.isTapTarget stream := &tcpStream{ net: net, @@ -62,7 +62,7 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T parent: stream, isClient: true, isOutgoing: props.isOutgoing, - outboundLinkWriter: factory.outbountLinkWriter, + outboundLinkWriter: factory.outboundLinkWriter, Emitter: factory.Emitter, } factory.wg.Add(1) @@ -76,17 +76,15 @@ func (factory *tcpStreamFactory) WaitGoRoutines() { factory.wg.Wait() } -func (factory *tcpStreamFactory) getStreamProps(srcIP string, dstIP string, srcPort string, dstPort string, allExtensionPorts []string) *streamProps { +func (factory *tcpStreamFactory) getStreamProps(srcIP string, dstIP string, dstPort string) *streamProps { if hostMode { - // TODO: Bring back `filterAuthorities` - return &streamProps{isTapTarget: true, isOutgoing: false} - if inArrayString(gSettings.filterAuthorities, fmt.Sprintf("%s:%s", dstIP, dstPort)) == true { + if inArrayString(gSettings.filterAuthorities, fmt.Sprintf("%s:%s", dstIP, dstPort)) { rlog.Debugf("getStreamProps %s", fmt.Sprintf("+ host1 %s:%s", dstIP, dstPort)) return &streamProps{isTapTarget: true, isOutgoing: false} - } else if inArrayString(gSettings.filterAuthorities, dstIP) == true { + } else if inArrayString(gSettings.filterAuthorities, dstIP) { rlog.Debugf("getStreamProps %s", fmt.Sprintf("+ host2 %s", dstIP)) return &streamProps{isTapTarget: true, isOutgoing: false} - } else if *anydirection && inArrayString(gSettings.filterAuthorities, srcIP) == true { + } else if *anydirection && inArrayString(gSettings.filterAuthorities, srcIP) { rlog.Debugf("getStreamProps %s", fmt.Sprintf("+ host3 %s", srcIP)) return &streamProps{isTapTarget: true, isOutgoing: true} }