Skip to content

Commit

Permalink
[NPM-3513] Fix rtt var offset guessing (#26973)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmahmood committed Jun 21, 2024
1 parent 347261f commit 07517c0
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pkg/network/tracer/offsetguess/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ const (
// the offset for RTT (and RTTvar) should be greater than this
// since the rtt fields are deep in struct tcp_sock; tcp_sock
// nests inet_connection_sock
rttDefaultOffsetBytes = 1280
rttVarDefaultOffsetBytes = 1280
rttDefaultOffsetBytes = 1280
)

var (
Expand Down Expand Up @@ -586,6 +585,11 @@ func (t *tracerOffsetGuesser) checkAndUpdateCurrentOffset(mp *maps.GenericMap[ui
// For more information on the bit shift operations see:
// https://elixir.bootlin.com/linux/v4.6/source/net/ipv4/tcp.c#L2686
if t.status.Rtt>>3 == expected.rtt {
// start rtt var offset just past the rtt offset.
// this loosens the previous assumption of the rtt var
// offset always being rtt offset + 4, since on
// newer kernels this assumption does not hold
t.status.Offset_rtt_var = t.status.Offset_rtt + 4
t.logAndAdvance(t.status.Offset_rtt, GuessRTTVar)
break
}
Expand Down Expand Up @@ -827,12 +831,11 @@ func newTracerStatus() *TracerStatus {
}

status := &TracerStatus{
State: uint64(StateChecking),
Proc: Proc{Comm: cProcName},
What: uint64(GuessSAddr),
Offset_netns: netNsDefaultOffsetBytes,
Offset_rtt: rttDefaultOffsetBytes,
Offset_rtt_var: rttVarDefaultOffsetBytes,
State: uint64(StateChecking),
Proc: Proc{Comm: cProcName},
What: uint64(GuessSAddr),
Offset_netns: netNsDefaultOffsetBytes,
Offset_rtt: rttDefaultOffsetBytes,
}

var err error
Expand Down

0 comments on commit 07517c0

Please sign in to comment.