Skip to content

Commit

Permalink
Qt: Window Scaling Bytes fixed for RAW SEQ numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
edadell authored and johnthacker committed Nov 27, 2024
1 parent deaa5fd commit 45c8bf0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions ui/qt/tcp_stream_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "wsutil/str_util.h"

#include <epan/prefs-int.h>
#include <wsutil/utf8_entities.h>

#include <ui/qt/utils/tango_colors.h>
Expand Down Expand Up @@ -1633,9 +1634,21 @@ void TCPStreamDialog::fillWindowScale()
QVector<double> cwnd_time, cwnd_size;
uint32_t last_ack = 0;

/* highest expected SEQ seen so far */
/* highest expected SEQ seen so far (starts at 0 for relative SEQ) */
uint32_t max_next_seq = 0;

pref_t *pref = prefs_find_preference(prefs_find_module("tcp"), "relative_sequence_numbers");
if(!pref || !prefs_get_bool_value(pref, pref_current)) {
bool found_first_data = false;
/* loop until we know the first raw SEQ */
for (struct segment *seg = graph_.segments; (!found_first_data && seg != NULL); seg = seg->next) {
if (compareHeaders(seg)) {
max_next_seq = seg->th_seq ;
found_first_data = true;
}
}
}

bool found_first_ack = false;
for (struct segment *seg = graph_.segments; seg != NULL; seg = seg->next) {
double ts = seg->rel_secs + seg->rel_usecs / 1000000.0;
Expand All @@ -1647,7 +1660,7 @@ void TCPStreamDialog::fillWindowScale()
* by comparing the highest next SEQ to the latest ACK
*/
uint32_t end_seq = seg->th_seq + seg->th_seglen;
if(end_seq > max_next_seq) {
if(tcp_seq_eq_or_after(end_seq, max_next_seq)) {
max_next_seq = end_seq;
}
if (found_first_ack &&
Expand Down

0 comments on commit 45c8bf0

Please sign in to comment.