Beispiel #1
0
 def _check_trace(self) -> bool:
   # check that (at least) one Retry packet was actually sent
   tr = TraceAnalyzer(self._sim_log_dir.name + "/trace_node_left.pcap")
   tokens = []
   cap_retry = tr.get_retry(Direction.FROM_SERVER)
   for p in cap_retry:
     tokens += [ p.quic.retry_token.replace(":", "") ]
   cap_retry.close()
   if len(tokens) == 0:
     logging.info("Didn't find any Retry packets.")
     return False
   
   # check that an Initial packet uses a token sent in the Retry packet(s)
   cap_initial = tr.get_initial(Direction.FROM_CLIENT)
   found = False
   for p in cap_initial:
     if p.quic.long_packet_type != "0" or p.quic.token_length == "0":
       continue
     token = p.quic.token.replace(":", "")
     if token in tokens:
       logging.debug("Check of Retry succeeded. Token used: %s", token)
       found = True
       break
   cap_initial.close()
   if not found:
     logging.info("Didn't find any Initial packet using a Retry token.")
   return found
Beispiel #2
0
 def _retry_sent(self) -> bool:
   tr = TraceAnalyzer(self._sim_log_dir.name + "/trace_node_left.pcap")
   cap = tr.get_retry()
   sent = True
   try: 
     cap.next()
   except StopIteration:
     sent = False
   cap.close()
   return sent
Beispiel #3
0
 def _retry_sent(self, log_dir: tempfile.TemporaryDirectory) -> bool:
     tr = TraceAnalyzer(log_dir.name + "/trace_node_left.pcap")
     cap = tr.get_retry()
     sent = True
     try:
         cap.next()
     except StopIteration:
         sent = False
     cap.close()
     return sent
    def _check_trace(self) -> bool:
        # check that (at least) one Retry packet was actually sent
        tr = TraceAnalyzer(self._sim_log_dir.name + "/trace_node_left.pcap")
        tokens = []
        retries = tr.get_retry(Direction.FROM_SERVER)
        for p in retries:
            tokens += [p.retry_token.replace(":", "")]
        if len(tokens) == 0:
            logging.info("Didn't find any Retry packets.")
            return False

        # check that an Initial packet uses a token sent in the Retry packet(s)
        initials = tr.get_initial(Direction.FROM_CLIENT)
        for p in initials:
            if p.token_length == "0":
                continue
            token = p.token.replace(":", "")
            if token in tokens:
                logging.debug("Check of Retry succeeded. Token used: %s",
                              token)
                return True
        logging.info("Didn't find any Initial packet using a Retry token.")
        return False