Skip to content

Commit 7c2b292

Browse files
author
Mario Macias
authored
NETOBSERV-755: ignore flow direction in deduplication (#74)
1 parent 17e9a6d commit 7c2b292

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pkg/flow/deduper.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ func (c *deduperCache) isDupe(key *RecordKey) bool {
6767
// zeroes fields from key that should be ignored from the flow comparison
6868
rk.IFIndex = 0
6969
rk.DataLink = DataLink{}
70+
rk.Direction = 0
7071
// If a flow has been accounted previously, whatever its interface was,
7172
// it updates the expiry time for that flow
7273
if ele, ok := c.ifaces[rk]; ok {

pkg/flow/deduper_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ var (
2121
}, RecordMetrics: RecordMetrics{
2222
Packets: 2, Bytes: 456,
2323
}}, Interface: "123456789"}
24-
// another fow from 2 different interfaces
24+
// another fow from 2 different interfaces and directions
2525
twoIf1 = &Record{RawRecord: RawRecord{RecordKey: RecordKey{
2626
EthProtocol: 1, Direction: 1, Transport: Transport{SrcPort: 333, DstPort: 456},
2727
DataLink: DataLink{DstMac: MacAddr{0x1}, SrcMac: MacAddr{0x1}}, IFIndex: 1,
2828
}, RecordMetrics: RecordMetrics{
2929
Packets: 2, Bytes: 456,
3030
}}, Interface: "eth0"}
3131
twoIf2 = &Record{RawRecord: RawRecord{RecordKey: RecordKey{
32-
EthProtocol: 1, Direction: 1, Transport: Transport{SrcPort: 333, DstPort: 456},
32+
EthProtocol: 1, Direction: 0, Transport: Transport{SrcPort: 333, DstPort: 456},
3333
DataLink: DataLink{DstMac: MacAddr{0x2}, SrcMac: MacAddr{0x2}}, IFIndex: 2,
3434
}, RecordMetrics: RecordMetrics{
3535
Packets: 2, Bytes: 456,

0 commit comments

Comments
 (0)