-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes multiple problems with http processing/tagging on Windows. (#15022
) * Fixes multiple problems with http processing/tagging on Windows. - There was an offset error in which the port was not properly computed on ipv6 connections - There was a problem with computing whether an ipv6 address was loopback or not - The fullpath indication (which is used to compute the key) was not properly being computed. This led to the same tuple being used as a different key, so transactions were not properly combined. * fix grammar error in release notes
- Loading branch information
1 parent
8e87b73
commit 5151728
Showing
5 changed files
with
96 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
//go:build windows && npm | ||
// +build windows,npm | ||
|
||
package http | ||
|
||
import ( | ||
"encoding/binary" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestIsLocalhost(t *testing.T) { | ||
|
||
tests := []struct { | ||
key Key | ||
expected bool | ||
}{ | ||
// the isLocalhost function checks only the srcip, but set them both | ||
{ | ||
key: Key{ | ||
KeyTuple: KeyTuple{ | ||
SrcIPHigh: 0, | ||
SrcIPLow: uint64(binary.LittleEndian.Uint32([]uint8{127, 0, 0, 1})), | ||
DstIPHigh: 0, | ||
DstIPLow: uint64(binary.LittleEndian.Uint32([]uint8{127, 0, 0, 1})), | ||
}, | ||
}, | ||
expected: true, | ||
}, | ||
{ | ||
key: Key{ | ||
KeyTuple: KeyTuple{ | ||
SrcIPHigh: 0, | ||
SrcIPLow: uint64(binary.LittleEndian.Uint32([]uint8{192, 168, 1, 1})), | ||
DstIPHigh: 0, | ||
DstIPLow: uint64(binary.LittleEndian.Uint32([]uint8{192, 168, 1, 1})), | ||
}, | ||
}, | ||
expected: false, | ||
}, | ||
{ | ||
key: Key{ | ||
KeyTuple: KeyTuple{ | ||
SrcIPHigh: 0, | ||
SrcIPLow: binary.LittleEndian.Uint64([]uint8{0, 0, 0, 0, 0, 0, 0, 1}), | ||
DstIPHigh: 0, | ||
DstIPLow: binary.LittleEndian.Uint64([]uint8{0, 0, 0, 0, 0, 0, 0, 1}), | ||
}, | ||
}, | ||
expected: true, | ||
}, | ||
{ | ||
key: Key{ | ||
KeyTuple: KeyTuple{ | ||
SrcIPHigh: binary.LittleEndian.Uint64([]uint8{0xf, 0xe, 0x8, 0, 0, 0, 0, 0}), | ||
SrcIPLow: binary.LittleEndian.Uint64([]uint8{0x1, 0x9, 0x3, 0xe, 0x4, 0xc, 0xd, 0x6, 0xf, 0xf, 0xa, 0x4}), | ||
DstIPHigh: binary.LittleEndian.Uint64([]uint8{0xf, 0xe, 0x8, 0, 0, 0, 0, 0}), | ||
DstIPLow: binary.LittleEndian.Uint64([]uint8{0x1, 0x9, 0x3, 0xe, 0x4, 0xc, 0xd, 0x6, 0xf, 0xf, 0xa, 0x4}), | ||
}, | ||
}, | ||
expected: false, | ||
}, | ||
} | ||
for idx, tt := range tests { | ||
is := isLocalhost(tt.key) | ||
assert.Equal(t, tt.expected, is, "Unexpected result %v for test %v", is, idx) | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
releasenotes/notes/fixwinhttploopback-cec77f41a8feff7f.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Each section from every release note are combined when the | ||
# CHANGELOG.rst is rendered. So the text needs to be worded so that | ||
# it does not depend on any information only available in another | ||
# section. This may mean repeating some details, but each section | ||
# must be readable independently of the other. | ||
# | ||
# Each section note must be formatted as reStructuredText. | ||
--- | ||
fixes: | ||
- | | ||
On Windows, fixes bug in which HTTP connections were not properly accounted | ||
for when the client and server were the same host (loopback). |