Example #1
0
    def handle_path_reply(self, cpld, meta):
        """
        Handle path reply from local path server.
        """
        pmgt = cpld.union
        path_reply = pmgt.union
        assert isinstance(path_reply, PathSegmentReply), type(path_reply)
        recs = path_reply.recs()
        for srev_info in recs.iter_srev_infos():
            self.check_revocation(
                srev_info,
                lambda x: self.continue_revocation_processing(srev_info)
                if not x else False, meta)

        req = path_reply.req()
        key = req.dst_ia(), req.flags()
        with self.req_path_lock:
            r = self.requested_paths.get(key)
            if r:
                r.notify_reply(path_reply)
            else:
                logging.warning("No outstanding request found for %s", key)
        for type_, pcb in recs.iter_pcbs():
            seg_meta = PathSegMeta(pcb,
                                   self.continue_seg_processing,
                                   meta,
                                   type_,
                                   params=(r, ))
            self._process_path_seg(seg_meta, cpld.req_id)
Example #2
0
    def handle_path_reply(self, cpld, meta):
        """
        Handle path reply from local path server.
        """
        # FIXME(kormat): sciond does not cache non-peer revocations, so if the PS gives us a path
        # that has been revoked, this won't be caught. This will be fixed in the upcoming rewrite of
        # sciond.
        pmgt = cpld.union
        path_reply = pmgt.union
        assert isinstance(path_reply, PathSegmentReply), type(path_reply)
        recs = path_reply.recs()
        for rev_info in recs.iter_rev_infos():
            self.peer_revs.add(rev_info)

        req = path_reply.req()
        key = req.dst_ia(), req.flags()
        r = self.requested_paths.get(key)
        if r:
            r.notify_reply(path_reply)
        else:
            logging.warning("No outstanding request found for %s", key)
        for type_, pcb in recs.iter_pcbs():
            seg_meta = PathSegMeta(pcb,
                                   self.continue_seg_processing,
                                   meta,
                                   type_,
                                   params=(r, ))
            self._process_path_seg(seg_meta)
Example #3
0
    def handle_path_reply(self, path_reply, meta):
        """
        Handle path reply from local path server.
        """
        for rev_info in path_reply.iter_rev_infos():
            self.peer_revs.add(rev_info)

        for type_, pcb in path_reply.iter_pcbs():
            seg_meta = PathSegMeta(pcb, self.continue_seg_processing, meta,
                                   type_)
            self.process_path_seg(seg_meta)
Example #4
0
 def _handle_paths_from_zk(self, raw_entries):
     """
     Handles cached paths through ZK, passed as a list.
     """
     for raw in raw_entries:
         recs = PathSegmentRecords.from_raw(raw)
         for type_, pcb in recs.iter_pcbs():
             seg_meta = PathSegMeta(pcb, self.continue_seg_processing,
                                    type_=type_, params={'from_zk': True})
             self._process_path_seg(seg_meta)
     if raw_entries:
         logging.debug("Processed %s segments from ZK", len(raw_entries))
Example #5
0
 def handle_path_segment_record(self, seg_recs, meta):
     """
     Handles paths received from the network.
     """
     params = self._dispatch_params(seg_recs, meta)
     # Add revocations for peer interfaces included in the path segments.
     for rev_info in seg_recs.iter_rev_infos():
         self.revocations.add(rev_info)
     # Verify pcbs and process them
     for type_, pcb in seg_recs.iter_pcbs():
         seg_meta = PathSegMeta(pcb, self.continue_seg_processing, meta,
                                type_, params)
         self._process_path_seg(seg_meta)
Example #6
0
 def handle_pcb(self, pcb, meta=None):
     """
     Handles pcbs received from the network.
     """
     if meta:
         pcb.p.ifID = meta.path.get_hof().ingress_if
     if not self.path_policy.check_filters(pcb):
         logging.debug("Segment dropped due to path policy: %s" %
                       pcb.short_desc())
         return
     if not self._filter_pcb(pcb):
         logging.debug("Segment dropped due to looping: %s" %
                       pcb.short_desc())
         return
     seg_meta = PathSegMeta(pcb, self.continue_seg_processing, meta)
     self.process_path_seg(seg_meta)
Example #7
0
 def handle_pcb(self, cpld, meta=None):
     """
     Handles pcbs received from the network.
     """
     pcb = cpld.union
     assert isinstance(pcb, PCB), type(pcb)
     pcb = pcb.pseg()
     if meta:
         pcb.ifID = meta.path.get_hof().ingress_if
     try:
         self.path_policy.check_filters(pcb)
     except SCIONPathPolicyViolated as e:
         logging.debug("Segment dropped due to path policy: %s\n%s" %
                       (e, pcb.short_desc()))
         return
     if not self._filter_pcb(pcb):
         logging.debug("Segment dropped due to looping: %s" %
                       pcb.short_desc())
         return
     seg_meta = PathSegMeta(pcb, self.continue_seg_processing, meta)
     self._process_path_seg(seg_meta, cpld.req_id)