pub fn handle_icmp6_packet(
    packet: &Icmpv6Packet,
    response_src_address: &Ipv6Addr,
    response_dst_address: &Ipv6Addr,
) -> Option<Vec<u8>> {
    // if the incoming packet is an echo request, handle it and send back a proper response
    if packet.get_icmpv6_type() == Icmpv6Types::EchoRequest
        && packet.get_icmpv6_code() == Icmpv6Code(0)
    {
        trace!("Handling ICMPv6 echo request by building an ICMPv6 echo response");
        Some(build_icmp6_echo_response(
            &packet.payload(),
            response_src_address,
            response_dst_address,
        ))
    }
    // ignore all other ICMP types
    else {
        debug!(
            "Received unhandled ICMPv6 packet [type={:?}, code={:?}]",
            packet.get_icmpv6_type(),
            packet.get_icmpv6_code()
        );
        None
    }
}
/// Handle an incoming ICMPv6 packet and optionally return a response ICMPv6 packet
Handle an incoming ICMPv6 packet and optionally return a response ICMPv6 packet
Handle an incoming ICMPv6 packet and optionally return a response ICMPv6 packet
pub fn handle_icmp6_packet(
    packet: &Icmpv6Packet,
    response_src_address: &Ipv6Addr,
    response_dst_address: &Ipv6Addr,
) -> Option<Vec<u8>> {
    // if the incoming packet is an echo request, handle it and send back a proper response
    if packet.get_icmpv6_type() == Icmpv6Types::EchoRequest
        && packet.get_icmpv6_code() == Icmpv6Code(0)
    {
        trace!("Handling ICMPv6 echo request by building an ICMPv6 echo response");
        Some(build_icmp6_echo_response(
            &packet.payload(),
            response_src_address,
            response_dst_address,
        ))
    }
    // ignore all other ICMP types
    else {
        debug!(
            "Received unhandled ICMPv6 packet [type={:?}, code={:?}]",
            packet.get_icmpv6_type(),
            packet.get_icmpv6_code()
        );
        None
    }
}
pub fn handle_icmp6_packet ( packet : & Icmpv6Packet , response_src_address : & Ipv6Addr , response_dst_address : & Ipv6Addr , ) -> Option < Vec < u8 > > { // if the incoming packet is an echo request, handle it and send back a proper response if packet . get_icmpv6_type ( ) == Icmpv6Types :: EchoRequest && packet . get_icmpv6_code ( ) == Icmpv6Code ( 0 ) { trace ! ( " " ) ; Some ( build_icmp6_echo_response ( & packet . payload ( ) , response_src_address , response_dst_address , ) ) } // ignore all other ICMP types else { debug ! ( " " packet get_icmpv6_type ( ) packet get_icmpv6_code ( ) ) ; None } }
Handle an incoming ICMPv6 packet and optionally return a response ICMPv6 packet
Handle an incoming ICMPv6 packet and optionally return a response ICMPv6 packet
packet
&Icmpv6Packet
response_src_address
&Ipv6Addr
response_dst_address
&Ipv6Addr
packet
&Icmpv6Packet
response_src_address
&Ipv6Addr
response_dst_address
&Ipv6Addr