diff --git a/ui/qt/tcp_stream_dialog.cpp b/ui/qt/tcp_stream_dialog.cpp index 8e8b1f9a32d..b4a0bd83e2a 100644 --- a/ui/qt/tcp_stream_dialog.cpp +++ b/ui/qt/tcp_stream_dialog.cpp @@ -18,6 +18,7 @@ #include "wsutil/str_util.h" +#include #include #include @@ -1633,9 +1634,21 @@ void TCPStreamDialog::fillWindowScale() QVector 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; @@ -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 &&