• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python icmp.icmp函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中ryu.lib.packet.icmp.icmp函数的典型用法代码示例。如果您正苦于以下问题:Python icmp函数的具体用法?Python icmp怎么用?Python icmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了icmp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_Packet_in_2_icmpEcho1

    def test_Packet_in_2_icmpEcho1(self):
        print "*** Case2: HOST2のMAC未学習の時、HOST1からICMP Echoを受信 ***"

        sr = SimpleForward()
        dstMac = ROUTER_MACADDR1
        srcMac = HOST_MACADDR1
        srcIp = HOST_IPADDR1
        dstIp = HOST_IPADDR2
        targetMac = dstMac
        targetIp = dstIp
        ttl = 64

        datapath = _Datapath()
        e = ethernet(dstMac, srcMac, ether.ETH_TYPE_IP)

        iph = ipv4(4, 5, 0, 0, 0, 2, 0, ttl, 1, 0, srcIp, dstIp)
        echo = icmp.echo(1, 1, 'unit test')
        icmph = icmp.icmp(8, 0, 0, echo)

        p = Packet()
        p.add_protocol(e)
        p.add_protocol(iph)
        p.add_protocol(icmph)
        p.serialize()

        packetIn = OFPPacketIn(datapath, match=OFPMatch(in_port=1), data=buffer(p.data))

        ev = ofp_event.EventOFPPacketIn(packetIn)

        result = sr.packet_in_handler(ev)
        self.assertEqual(result, 1)
        print ""
开发者ID:TakeshiTseng,项目名称:simpleRouter,代码行数:32,代码来源:test_SimpleForward.py


示例2: _handle_icmp

    def _handle_icmp(self, ev, subname):
        msg = ev.msg
        datapath = msg.datapath
        pkt = packet.Packet(data=msg.data)
        pkt_ethernet = pkt.get_protocol(ethernet.ethernet)
        pkt_ipv4 = pkt.get_protocol(ipv4.ipv4)
        pkt_icmp = pkt.get_protocol(icmp.icmp)
        in_port = msg.match['in_port']
         
        # ignore icmp of other than icmp_echo_request
        if pkt_icmp.type != icmp.ICMP_ECHO_REQUEST:
            return
        # make packet object to return
        this_subnet=self.subnet[datapath.id][subname]
        pkt = packet.Packet()
        pkt.add_protocol(ethernet.ethernet(ethertype=pkt_ethernet.ethertype,
            dst=pkt_ethernet.src,
            src=this_subnet['mac']))
#             if vid != None:
#             pkt.add_protocol(vlan.vlan(vid=vid, ethertype = 0x0800))
        pkt.add_protocol(ipv4.ipv4(dst=pkt_ipv4.src,
            src=this_subnet['ip'],
            proto=pkt_ipv4.proto))
        pkt.add_protocol(icmp.icmp(type_=icmp.ICMP_ECHO_REPLY,
            code=icmp.ICMP_ECHO_REPLY_CODE,
            csum=0,
            data=pkt_icmp.data))
        self._send_packet(datapath, in_port, pkt)
        self.logger.info("icmp reply is sent: %s-%s via port=%s" % (pkt_ethernet.src, pkt_ipv4.src, in_port) )      
开发者ID:ktmrmshk,项目名称:OpenFlowRyuSwitches,代码行数:29,代码来源:basic_router.py


示例3: test_default_args

    def test_default_args(self):
        ic = icmp.icmp()
        buf = ic.serialize(bytearray(), None)
        res = struct.unpack(icmp.icmp._PACK_STR, six.binary_type(buf[:4]))

        eq_(res[0], 8)
        eq_(res[1], 0)
        eq_(buf[4:], b'\x00\x00\x00\x00')

        # with data
        ic = icmp.icmp(type_=icmp.ICMP_DEST_UNREACH, data=icmp.dest_unreach())
        buf = ic.serialize(bytearray(), None)
        res = struct.unpack(icmp.icmp._PACK_STR, six.binary_type(buf[:4]))

        eq_(res[0], 3)
        eq_(res[1], 0)
        eq_(buf[4:], b'\x00\x00\x00\x00')
开发者ID:5g-empower,项目名称:empower-ryu,代码行数:17,代码来源:test_icmp.py


示例4: _handle_icmp

    def _handle_icmp(self, msg, pkt, icmp_pkt):
        """
            reply to ICMP_ECHO_REQUEST(i.e. ping);
            may handle other types of ICMP msg in the future;
            return True if send a response
        """
        LOG.debug('Handling ICMP packet %s', icmp_pkt)

        if icmp_pkt.type != icmp.ICMP_ECHO_REQUEST:
            return False

        in_port_no = msg.in_port
        switch = self.dpid_to_switch[msg.datapath.id]
        ipv4_layer = self.find_packet(pkt, 'ipv4')
        ip_src = netaddr.IPAddress(ipv4_layer.src)
        ip_dst = netaddr.IPAddress(ipv4_layer.dst)

        if ip_dst == netaddr.IPAddress(util.bgper_config['local_ipv4']):
            self.write_to_tap(pkt.data, modifyMacAddress=True)
            LOG.debug('Forward ICMP packet to tap port.')
            return True

        need_reply = False
        for _k, p in switch.ports.iteritems():
            if p.gateway and p.gateway.gw_ip == ip_dst:
                need_reply = True
                break
        if not need_reply:
            return False

        echo_id = icmp_pkt.data.id
        echo_seq = icmp_pkt.data.seq
        echo_data = bytearray(icmp_pkt.data.data)

        icmp_data = icmp.echo(id_=echo_id, seq=echo_seq, data=echo_data)

        #send a echo reply packet
        ether_layer = self.find_packet(pkt, 'ethernet')
        ether_dst = ether_layer.src
        ether_src = str(switch.ports[in_port_no].hw_addr)
        e = ethernet.ethernet(ether_dst, ether_src, ether.ETH_TYPE_IP)
        #csum calculation should be paid attention to
        i = ipv4.ipv4(version=4, header_length=5, tos=0, total_length=0,
            identification=0, flags=0x000, offset=0, ttl=64, proto=1, csum=0,
            src=str(ip_dst), dst=str(ip_src), option=None)
        ic = icmp.icmp(type_=0, code=0, csum=0, data=icmp_data)
        p = packet.Packet()
        p.add_protocol(e)
        p.add_protocol(i)
        p.add_protocol(ic)
        p.serialize()
        datapath = msg.datapath
        datapath.send_packet_out(in_port=ofproto_v1_0.OFPP_NONE,
                actions=[datapath.ofproto_parser.OFPActionOutput(in_port_no)],
                data=p.data)
        LOG.debug('Ping replied %s -> %s', ip_dst, ip_src)
        return True
开发者ID:cannium,项目名称:openflow_routing_framework,代码行数:57,代码来源:routing.py


示例5: _handle_icmp

 def _handle_icmp(self, datapath, port, pkt_ethernet, pkt_ipv4, pkt_icmp):
     if pkt_icmp.type != icmp.ICMP_ECHO_REQUEST:
         return
     pkt = packet.Packet()
     pkt.add_protocol(ethernet.ethernet(ethertype=pkt_ethernet.ethertype, dst=pkt_ethernet.src, src=self.hw_addr))
     pkt.add_protocol(ipv4.ipv4(dst=pkt_ipv4.src, src=self.ip_addr, proto=pkt_ipv4.proto))
     pkt.add_protocol(
         icmp.icmp(type_=icmp.ICMP_ECHO_REPLY, code=icmp.ICMP_ECHO_REPLY_CODE, csum=0, data=pkt_icmp.data)
     )
     self._send_packet(datapath, port, pkt)
开发者ID:shinpeimuraoka,项目名称:ryu-book,代码行数:10,代码来源:ping_responder.py


示例6: setUp

    def setUp(self):
        self.type_ = icmp.ICMP_ECHO_REQUEST
        self.code = 0
        self.csum = 0
        self.data = None

        self.ic = icmp.icmp(self.type_, self.code, self.csum, self.data)

        self.buf = bytearray(struct.pack(icmp.icmp._PACK_STR, self.type_, self.code, self.csum))
        self.csum_calc = packet_utils.checksum(self.buf)
        struct.pack_into("!H", self.buf, 2, self.csum_calc)
开发者ID:John-Lin,项目名称:ryu,代码行数:11,代码来源:test_icmp.py


示例7: setUp_with_TimeExceeded

    def setUp_with_TimeExceeded(self):
        self.te_data = b"abc"
        self.te_data_len = len(self.te_data)
        self.data = icmp.TimeExceeded(data_len=self.te_data_len, data=self.te_data)

        self.type_ = icmp.ICMP_TIME_EXCEEDED
        self.code = 0
        self.ic = icmp.icmp(self.type_, self.code, self.csum, self.data)

        self.buf = bytearray(struct.pack(icmp.icmp._PACK_STR, self.type_, self.code, self.csum))
        self.buf += self.data.serialize()
        self.csum_calc = packet_utils.checksum(self.buf)
        struct.pack_into("!H", self.buf, 2, self.csum_calc)
开发者ID:John-Lin,项目名称:ryu,代码行数:13,代码来源:test_icmp.py


示例8: send_ping

    def send_ping(self, ip_dst):
        pkt = packet.Packet()
        if ip_dst in self.arp_table:
            mac_dst = self.arp_table[ip_dst]
        else:
            return
        pkt.add_protocol(ethernet.ethernet(ethertype=0x800,dst=mac_dst,\
                                                           src=self.hw_addr))

        pkt.add_protocol(ipv4.ipv4(dst= ip_dst, src=self.ip_addr,proto=1))
        pkt.add_protocol(icmp.icmp(type_= 8, code=0, csum=0))#Not sure about echo
        print("Ping packet sent")
        self._flood_packet(pkt)
开发者ID:npsccw,项目名称:SDN-Applications,代码行数:13,代码来源:ControlNode.py


示例9: _handle_icmp

    def _handle_icmp(self, msg, pkt, icmp_pkt):
        '''
            reply to ICMP_ECHO_REQUEST(i.e. ping);
            may handle other types of ICMP msg in the future;
            return True if send a responce
        '''
        #print 'icmp', icmp_pkt
        if icmp_pkt.type != icmp.ICMP_ECHO_REQUEST:
            return False

        in_port_no = msg.in_port
        switch = self.dpid_to_switch[msg.datapath.id]
        ipv4_layer = self.find_packet(pkt, 'ipv4')
        ip_src = ipv4_layer.src
        ip_dst = ipv4_layer.dst

        need_reply = False
        for _k, p in switch.ports.iteritems():
            if p.gateway and p.gateway.gw_ip == ip_dst:
                need_reply = True
                break
        if not need_reply:
            return False

        echo_id = icmp_pkt.data.id
        echo_seq = icmp_pkt.data.seq
        echo_data = bytearray(icmp_pkt.data.data)

        icmp_data = icmp.echo(id_=echo_id,seq=echo_seq,data=echo_data)

        #send a echo reply packet
        ether_layer = self.find_packet(pkt, 'ethernet')
        ether_dst = ether_layer.src
        ether_src = switch.ports[in_port_no].hw_addr
        e = ethernet.ethernet(ether_dst,ether_src,ether.ETH_TYPE_IP)
        #csum calculation should be paied attention
        i = ipv4.ipv4(version=4,header_length=5,tos=0,total_length=0,
            identification=0,flags=0x000,offset=0,ttl=64,proto=1,csum=0,
            src=ip_dst,dst=ip_src,option=None)
        ic = icmp.icmp(type_= 0,code=0,csum=0,data=icmp_data)
        p = packet.Packet()
        p.add_protocol(e)
        p.add_protocol(i)
        p.add_protocol(ic)
        p.serialize()
        datapath = msg.datapath
        datapath.send_packet_out(in_port=ofproto_v1_0.OFPP_NONE,
                actions=[datapath.ofproto_parser.OFPActionOutput(in_port_no)],
                data=p.data)
        print 'send a ping replay'
        return True
开发者ID:carriercomm,项目名称:openflow_routing,代码行数:51,代码来源:routing.py


示例10: _build_pkt

    def _build_pkt(self, fields, ops):
        pkt_out = packet.Packet()
        pkt_ipv4 = pkt_out.get_protocol(ipv4.ipv4)
        pkt_icmp = pkt_out.get_protocol(icmp.icmp)

        def addIPv4(pkt_out, fields):
            pkt_out.add_protocol(ipv4.ipv4(dst=fields['dstip'],
                                 src=fields['srcip'],
                                 proto=fields['proto']))
            return pkt_out

        pkt_out.add_protocol(ethernet.ethernet(ethertype=fields['ethtype'],
                                               dst=fields['dstmac'],
                                               src=fields['srcmac']))
        # Add if ARP                                           
        if 'arp' in fields['ptype']:
            pkt_out.add_protocol(arp.arp(opcode=arp.ARP_REPLY,
                                 src_mac=fields['srcmac'],
                                 src_ip=fields['srcip'],
                                 dst_mac=fields['dstmac'],
                                 dst_ip=fields['dstip']))
        # Add if IPv4
        if 'ipv4' in fields['ptype']:
            pkt_out = addIPv4(pkt_out,fields)
            
        # Add if ICMP
        if 'icmp' in fields['ptype']:
            pkt_out = addIPv4(pkt_out,fields)
            
            pkt_out.add_protocol(icmp.icmp(type_=icmp.ICMP_ECHO_REPLY,
                                 code=icmp.ICMP_ECHO_REPLY_CODE,
                                 csum=0,
                                 data=None))
        # Add if UDP    
        if 'udp' in fields['ptype']:
            pkt_out = addIPv4(pkt_out,fields)
            pkt_out.add_protocol(udp.udp(dst_port=fields['dstport'],
				bits=fields['bits'],option=fields['opt'],
                                src_port=fields['srcport']))
        # Add if TCP                         	 
        if 'tcp' in fields['ptype']:
            pkt_out = addIPv4(pkt_out,fields)
            pkt_out.add_protocol(tcp.tcp(dst_port=fields['dstport'],
				bits=fields['bits'],option=fields['opt'],
                                src_port=fields['srcport']))
        #Add covert channel information                    
        if fields['com'] != None:
            pkt_out.add_protocol(fields['com'])
            
        #Send crafted packet            
        self._send_packet(fields['dp'], ops['newport'], pkt_out)
开发者ID:Ryuretic,项目名称:Ryuretic,代码行数:51,代码来源:Ryuretic.py


示例11: _handle_icmp

    def _handle_icmp(self, datapath, port, pkt_ethernet, pkt_ipv4, pkt_icmp):
        if pkt_icmp.type != icmp.ICMP_ECHO_REQUEST:
            return
        if pkt_ipv4.dst in self.arp_table1:
           # index = self.ip_addr.index(pkt_ipv4.dst)

            pkt = packet.Packet()
            pkt.add_protocol(ethernet.ethernet(ethertype=pkt_ethernet.ethertype,
                                           dst=pkt_ethernet.src, src=self.arp_table1[pkt_ipv4.dst]))
            pkt.add_protocol(ipv4.ipv4(dst=pkt_ipv4.src, src=pkt_ipv4.dst,
                                       proto=pkt_ipv4.proto))
            pkt.add_protocol(icmp.icmp(type_=icmp.ICMP_ECHO_REPLY,
                                       code=icmp.ICMP_ECHO_CODE, csum=0, datapath=pkt_icmp.data))
            self._send_packet(datapath, port, pkt)
开发者ID:hyqdvd,项目名称:ryuCode,代码行数:14,代码来源:arp_dc1.py


示例12: _build_echo

    def _build_echo(self, _type, echo):
        e = self._build_ether(ether.ETH_TYPE_IP)
        ip = ipv4.ipv4(version=4, header_length=5, tos=0, total_length=84,
                       identification=0, flags=0, offset=0, ttl=64,
                       proto=inet.IPPROTO_ICMP, csum=0,
                       src=self.RYU_IP, dst=self.HOST_IP)
        ping = icmp.icmp(_type, code=0, csum=0, data=echo)

        p = packet.Packet()
        p.add_protocol(e)
        p.add_protocol(ip)
        p.add_protocol(ping)
        p.serialize()
        return p
开发者ID:09beeihaq,项目名称:Coursera-SDN-Assignments,代码行数:14,代码来源:test_arp.py


示例13: setUp_with_dest_unreach

    def setUp_with_dest_unreach(self):
        self.unreach_mtu = 10
        self.unreach_data = b"abc"
        self.unreach_data_len = len(self.unreach_data)
        self.data = icmp.dest_unreach(data_len=self.unreach_data_len, mtu=self.unreach_mtu, data=self.unreach_data)

        self.type_ = icmp.ICMP_DEST_UNREACH
        self.code = icmp.ICMP_HOST_UNREACH_CODE
        self.ic = icmp.icmp(self.type_, self.code, self.csum, self.data)

        self.buf = bytearray(struct.pack(icmp.icmp._PACK_STR, self.type_, self.code, self.csum))
        self.buf += self.data.serialize()
        self.csum_calc = packet_utils.checksum(self.buf)
        struct.pack_into("!H", self.buf, 2, self.csum_calc)
开发者ID:John-Lin,项目名称:ryu,代码行数:14,代码来源:test_icmp.py


示例14: createPacketIpv4

 def createPacketIpv4(self, datapath, port, pkt_ethernet, pkt_ipv, pkt_icmp):
     # create send packet
     sendpkt = packet.Packet()
     sendpkt.add_protocol(ethernet.ethernet(ethertype=pkt_ethernet.ethertype,
                                       dst=pkt_ethernet.dst,
                                        src=pkt_ethernet.src))
     sendpkt.add_protocol(ipv4.ipv4(dst=pkt_ipv.src,
                                src=pkt_ethernet.src,
                                proto=pkt_ipv.proto))
     sendpkt.add_protocol(icmp.icmp(type_=icmp.ICMP_ECHO_REPLY,
                                code=icmp.ICMP_ECHO_REPLY_CODE,
                                csum=0,
                                data=pkt_icmp.data))
     sendpkt.serialize()
     return sendpkt
开发者ID:takeuchi17401,项目名称:performance_test,代码行数:15,代码来源:send_persec_ipv4.py


示例15: send_ping

    def send_ping(self, datapath, src_mac, dst_mac, src_ip, dst_ip, outport=1, seq=0):
        ttl = 64

        e = ethernet.ethernet(dst_mac, src_mac, ether.ETH_TYPE_IP)
        iph = ipv4.ipv4(4, 5, 0, 0, 0, 2, 0, ttl, 1, 0, src_ip, dst_ip)
        echo = icmp.echo(1, seq, data=None)
        icmph = icmp.icmp(8, 0, 0, echo)
        
        pkt = packet.Packet()
        pkt.add_protocol(e)
        pkt.add_protocol(iph)
        pkt.add_protocol(icmph)
        
        self._send_packet(datapath, outport, pkt)
        self.logger.info("icmp echo req is sent: to %s" % (dst_ip,) )  
开发者ID:ktmrmshk,项目名称:OpenFlowRyuSwitches,代码行数:15,代码来源:basic_router.py


示例16: send_icmp

    def send_icmp(self, datapath, srcMac, srcIp, dstMac, dstIp, outPort, seq, data, id=1, type=8, ttl=64):
        e = ethernet.ethernet(dstMac, srcMac, ether.ETH_TYPE_IP) #Construye el protocolo ethernet
        iph = ipv4.ipv4(4, 5, 0, 0, 0, 2, 0, ttl, 1, 0, srcIp, dstIp) #Construye la parte del protocolo IP
        echo = icmp.echo(id, seq, data) #Construye la parte del echo que se añadirá al protocolo icmp
        icmph = icmp.icmp(type, 0, 0, echo) #Construye la parte del icmp

        p = Packet() #Crea el paquete
        p.add_protocol(e) #Añade el protocolo ethernet
        p.add_protocol(iph) #Añade el protocolo ip
        p.add_protocol(icmph) #Añade el protocolo icmp
        p.serialize() #Serializa todo

        actions = [datapath.ofproto_parser.OFPActionOutput(outPort, 0)] #Enviar por el puerto outPort
        #Mensaje a enviar
        out = datapath.ofproto_parser.OFPPacketOut(datapath=datapath, buffer_id=0xffffffff, in_port=datapath.ofproto.OFPP_CONTROLLER, actions=actions, data=p.data)
        datapath.send_msg(out) #Enviar mensaje
开发者ID:Madh93,项目名称:NatRouter,代码行数:16,代码来源:PAT.py


示例17: control_plane_icmp_handler

    def control_plane_icmp_handler(self, in_port, vlan, eth_src,
                                   ipv4_pkt, icmp_pkt):
        ofmsgs = []

        if icmp_pkt is not None:
            pkt = self.build_ethernet_pkt(
                eth_src, in_port, vlan, ether.ETH_TYPE_IP)
            ipv4_pkt = ipv4.ipv4(
                dst=ipv4_pkt.src, src=ipv4_pkt.dst, proto=ipv4_pkt.proto)
            icmp_pkt = icmp.icmp(
                type_=icmp.ICMP_ECHO_REPLY, code=icmp.ICMP_ECHO_REPLY_CODE,
                data=icmp_pkt.data)
            pkt.add_protocol(ipv4_pkt)
            pkt.add_protocol(icmp_pkt)
            pkt.serialize()
            ofmsgs.append(self.valve_packetout(in_port, pkt.data))

        return ofmsgs
开发者ID:dr-clark,项目名称:faucet,代码行数:18,代码来源:valve.py


示例18: ICMPPacket

    def ICMPPacket(self, datapath, in_port, pkt_ethernet, pkt_ipv4, pkt_icmp):
      if pkt_icmp.type == icmp.ICMP_ECHO_REQUEST:
	eer=ethernet.ethernet(ethertype=pkt_ethernet.ethertype,
						dst=pkt_ethernet.src,
						src=self.ip_mac_port[in_port][1])
						
	iper=ipv4.ipv4(dst=pkt_ipv4.src,
				    src=self.ip_mac_port[in_port][2],
				    proto=pkt_ipv4.proto)
				    
	icmper=icmp.icmp(type_=icmp.ICMP_ECHO_REPLY,
				    code=icmp.ICMP_ECHO_REPLY_CODE,
				    csum=0,
				    data=pkt_icmp.data)
	p = packet.Packet()
	p.add_protocol(eer)
	p.add_protocol(iper)
	p.add_protocol(icmper)
	
	self.send_packet(datapath, in_port, p)
开发者ID:AndresCidoncha,项目名称:LabRedes,代码行数:20,代码来源:routerping+(2).py


示例19: handleIcmpPacket

 def handleIcmpPacket(self, datapath, in_port, pkt_ethernet, pkt_ipv4, pkt_icmp):
     #This function builds an ICMP echo reply for the echo request received
     if pkt_icmp.type == icmp.ICMP_ECHO_REQUEST:
         eer=ethernet.ethernet(ethertype=pkt_ethernet.ethertype,
                     dst=pkt_ethernet.src,
                     src=self.interfaces_virtuales[self.tabla_vlan[in_port]][0])
                     
         iper=ipv4.ipv4(dst=pkt_ipv4.src,
                 src=self.interfaces_virtuales[self.tabla_vlan[in_port]][2],
                 proto=pkt_ipv4.proto)
                 
         icmper=icmp.icmp(type_=icmp.ICMP_ECHO_REPLY,
                 code=icmp.ICMP_ECHO_REPLY_CODE,
                 csum=0,
                 data=pkt_icmp.data)
         p = packet.Packet()
         p.add_protocol(eer)
         p.add_protocol(iper)
         p.add_protocol(icmper)
 
         self.sendPacket(datapath, in_port, p)
开发者ID:aabreuglez,项目名称:SDNOpenflow,代码行数:21,代码来源:switch.py


示例20: _virtual_ip_icmp_reply

 def _virtual_ip_icmp_reply(self, datapath, in_port, pkt):
     eth_hd = pkt.get_protocol(ethernet.ethernet)
     ipv4_hd = pkt.get_protocol(ipv4.ipv4)
     icmp_hd = pkt.get_protocol(icmp.icmp)
     if icmp_hd.type == icmp.ICMP_ECHO_REQUEST:
         vir_ip = ipv4_hd.dst
         if vir_ip not in self.virtual_ip:
             print ("WARNING: could be virtual ip routing table config err")
             return
         vir_mac = self.virtual_ip[vir_ip]
         icmp_reply = packet.Packet()
         icmp_reply.add_protocol(ethernet.ethernet(ethertype=eth_hd.ethertype,
                                                   dst=eth_hd.src,
                                                   src=vir_mac))
         icmp_reply.add_protocol(ipv4.ipv4(dst=ipv4_hd.src,
                                           src=vir_ip,
                                           proto=ipv4_hd.proto))
         icmp_reply.add_protocol(icmp.icmp(type_=icmp.ICMP_ECHO_REPLY,
                                           code=icmp.ICMP_ECHO_REPLY_CODE,
                                           data=icmp_hd.data))
         self._send_packet_port(datapath, in_port, icmp_reply)
开发者ID:WenqinSHAO,项目名称:Probing_OF,代码行数:21,代码来源:probing.py



注:本文中的ryu.lib.packet.icmp.icmp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python icmpv6.icmpv6函数代码示例发布时间:2022-05-27
下一篇:
Python arp.arp函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap