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")
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)
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)