Repository: fujiapple852/trippy (language: rust)

Issue:
Reduce MAX_SEQUENCE_PER_ROUND from 1024 to 512
Reduce MAX_SEQUENCE_PER_ROUND from 1024 to 512

The Dublin multipath strategy for IPv6/udp encodes the sequence number in the payload length and consequently the maximum sequence number must be no larger than the maximum IPv6/udp payload size.  It is important that the range of possible sequence numbers is _at least_ `BUFFER_SIZE` to ensure delayed responses from a prior round are not incorrectly associated with later rounds.


Discussion / hints:

Fix patch:
diff --git a/src/tracing/constants.rs b/src/tracing/constants.rs
index 32bfba349..45f1207d3 100644
--- a/src/tracing/constants.rs
+++ b/src/tracing/constants.rs
@@ -6,7 +6,7 @@ pub const MAX_TTL: u8 = 254;
 /// This is set to be far larger than the `MAX_TTL` to allow for the re-issue of probes (with the
 /// next sequence number, but the same ttl) which can occur for some protocols such as TCP when it
 /// cannot bind to a given port.
-pub const MAX_SEQUENCE_PER_ROUND: u16 = 1024;
+pub const MAX_SEQUENCE_PER_ROUND: u16 = 512;
 
 /// The maximum _starting_ sequence number allowed.
 ///
diff --git a/src/tracing/tracer.rs b/src/tracing/tracer.rs
index a1ec08b1e..658413bfc 100644
--- a/src/tracing/tracer.rs
+++ b/src/tracing/tracer.rs
@@ -1090,8 +1090,8 @@ mod state {
                 state.advance_round(TimeToLive(1));
             }
             assert_eq!(state.round, Round(2000));
-            assert_eq!(state.round_sequence, Sequence(33000));
-            assert_eq!(state.sequence, Sequence(33000));
+            assert_eq!(state.round_sequence, Sequence(57130));
+            assert_eq!(state.sequence, Sequence(57130));
         }
 
         #[test]
@@ -1121,16 +1121,16 @@ mod state {
                 state.advance_round(TimeToLive(1));
             }
             assert_eq!(state.round, Round(2000));
-            assert_eq!(state.round_sequence, Sequence(56876));
-            assert_eq!(state.sequence, Sequence(56876));
+            assert_eq!(state.round_sequence, Sequence(41128));
+            assert_eq!(state.sequence, Sequence(41128));
         }
 
         #[test]
         fn test_in_round() {
             let state = TracerState::new(cfg(Sequence(33000)));
             assert!(state.in_round(Sequence(33000)));
-            assert!(state.in_round(Sequence(34023)));
-            assert!(!state.in_round(Sequence(34024)));
+            assert!(state.in_round(Sequence(33511)));
+            assert!(!state.in_round(Sequence(33512)));
         }
 
         #[test]


Test patch: