示例#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
 def _count_handshakes(self) -> int:
     """ Count the number of QUIC handshakes """
     tr = TraceAnalyzer(self._sim_log_dir.name + "/trace_node_left.pcap")
     # Determine the number of handshakes by looking at Handshake packets.
     # This is easier, since the DCID of Handshake packets doesn't changes.
     return len(set([p.scid
                     for p in tr.get_initial(Direction.FROM_SERVER)]))
 def check(self):
     tr = TraceAnalyzer(self._sim_log_dir.name + "/trace_node_left.pcap")
     initials = tr.get_initial(Direction.FROM_CLIENT)
     dcid = ""
     for p in initials:
         dcid = p.dcid
         break
     if dcid is "":
         logging.info("Didn't find an Initial / a DCID.")
         return False
     vnps = tr.get_vnp()
     for p in vnps:
         if p.scid == dcid:
             return True
     logging.info(
         "Didn't find a Version Negotiation Packet with matching SCID.")
     return False
示例#4
0
 def check(self):
   tr = TraceAnalyzer(self._sim_log_dir.name + "/trace_node_left.pcap")
   cap_initial = tr.get_initial(Direction.FROM_CLIENT)
   dcid = ""
   for p in cap_initial:
     dcid = p.quic.dcid
   cap_initial.close()
   if dcid is "":
     logging.info("Didn't find an Initial / a DCID.")
     return False
   cap_server = tr.get_vnp()
   conn_id_matches = False
   for p in cap_server:
     if p.quic.scid == dcid:
       conn_id_matches = True
   cap_server.close()
   if not conn_id_matches:
     logging.info("Didn't find a Version Negotiation Packet with matching SCID.")
   return conn_id_matches
    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
示例#6
0
 def _get_versions(self) -> set:
     """ Get the QUIC versions """
     tr = TraceAnalyzer(self._sim_log_dir.name + "/trace_node_left.pcap")
     return set([p.version for p in tr.get_initial(Direction.FROM_SERVER)])