pub fn handle_icmp_packet(_ip_packet: &Ipv4Packet, icmp_packet: &IcmpPacket) -> Option<Vec<u8>> {
    // if the incoming packet is an echo request, handle it and send back a proper response
    if icmp_packet.get_icmp_type() == IcmpTypes::EchoRequest
        && icmp_packet.get_icmp_code() == IcmpCode(0)
    {
        Some(build_icmp_echo_response(icmp_packet.payload()))
    }
    // ignore all other ICMP types
    else {
        debug!(
            "Received unhandled ICMP packet [type={:?}, code={:?}]",
            icmp_packet.get_icmp_type(),
            icmp_packet.get_icmp_code()
        );
        None
    }
}
/// Handle an incoming ICMP packet and optionally return a response ICMP packet
Handle an incoming ICMP packet and optionally return a response ICMP packet
Handle an incoming ICMP packet and optionally return a response ICMP packet
pub fn handle_icmp_packet(_ip_packet: &Ipv4Packet, icmp_packet: &IcmpPacket) -> Option<Vec<u8>> {
    // if the incoming packet is an echo request, handle it and send back a proper response
    if icmp_packet.get_icmp_type() == IcmpTypes::EchoRequest
        && icmp_packet.get_icmp_code() == IcmpCode(0)
    {
        Some(build_icmp_echo_response(icmp_packet.payload()))
    }
    // ignore all other ICMP types
    else {
        debug!(
            "Received unhandled ICMP packet [type={:?}, code={:?}]",
            icmp_packet.get_icmp_type(),
            icmp_packet.get_icmp_code()
        );
        None
    }
}
pub fn handle_icmp_packet ( _ip_packet : & Ipv4Packet , icmp_packet : & IcmpPacket ) -> Option < Vec < u8 > > { // if the incoming packet is an echo request, handle it and send back a proper response if icmp_packet . get_icmp_type ( ) == IcmpTypes :: EchoRequest && icmp_packet . get_icmp_code ( ) == IcmpCode ( 0 ) { Some ( build_icmp_echo_response ( icmp_packet . payload ( ) ) ) } // ignore all other ICMP types else { debug ! ( " " icmp_packet get_icmp_type ( ) icmp_packet get_icmp_code ( ) ) ; None } }
Handle an incoming ICMP packet and optionally return a response ICMP packet
Handle an incoming ICMP packet and optionally return a response ICMP packet
_ip_packet
&Ipv4Packet
icmp_packet
&IcmpPacket
_ip_packet
&Ipv4Packet
icmp_packet
&IcmpPacket