예제 #1
0
파일: scion.py 프로젝트: xabarass/scion
 def validate(self):  # pragma: no cover
     if self.dst.host.TYPE == AddrType.SVC:
         if self.dst.host.anycast() not in [SVCType.BS_A, SVCType.PS_A,
                                            SVCType.CS_A, SVCType.SB_A]:
             raise SCMPBadHost("Invalid dest SVC: %s" % self.dst.host.addr)
     if self.src.host.TYPE == AddrType.SVC:
         raise SCMPBadSrcType("Invalid source type: SVC")
예제 #2
0
    def process_ifid_request(self, pkt, from_local):
        """
        After receiving IFID_PKT from neighboring router it is completed (by
        iface information) and passed to local BSes.

        :param ifid_packet: the IFID request packet to send.
        :type ifid_packet: :class:`lib.packet.scion.IFIDPacket`
        """
        if from_local:
            logging.error("Received IFID packet from local AS, dropping")
            return
        if pkt.addrs.dst.host != SVCType.BS:
            raise SCMPBadHost("Invalid SVC address: %s", pkt.addrs.dst.host)
        ifid_pld = pkt.get_payload().copy()
        # Forward 'alive' packet to all BSes (to inform that neighbor is alive).
        # BS must determine interface.
        ifid_pld.p.relayIF = self.interface.if_id
        try:
            bs_addrs = self.dns_query_topo(BEACON_SERVICE)
        except SCIONServiceLookupError as e:
            logging.error("Unable to deliver ifid packet: %s", e)
            raise SCMPUnknownHost
        for bs_addr in bs_addrs:
            pkt.set_payload(ifid_pld.copy())
            self.send(pkt, bs_addr)
예제 #3
0
 def validate(self):  # pragma: no cover
     if self.dst.host.TYPE == AddrType.SVC and self.dst.host not in [
             SVCType.BS, SVCType.PS, SVCType.CS, SVCType.SB
     ]:
         raise SCMPBadHost("Invalid dest SVC: %s" % self.dst.host.addr)