pub(crate) fn accepts(&self, ip_repr: &IpRepr, icmp_repr: &Icmpv4Repr,
                          cksum: &ChecksumCapabilities) -> bool {
        match (&self.endpoint, icmp_repr) {
            // If we are bound to ICMP errors associated to a UDP port, only
            // accept Destination Unreachable messages with the data containing
            // a UDP packet send from the local port we are bound to.
            (&Endpoint::Udp(endpoint), &Icmpv4Repr::DstUnreachable { data, .. })
                    if endpoint.addr.is_unspecified() || endpoint.addr == ip_repr.dst_addr() => {
                let packet = UdpPacket::new(data);
                match UdpRepr::parse(&packet, &ip_repr.src_addr(), &ip_repr.dst_addr(), cksum) {
                    Ok(repr) => endpoint.port == repr.src_port,
                    Err(_) => false,
                }
            }
            // If we are bound to a specific ICMP identifier value, only accept an
            // Echo Request/Reply with the identifier field matching the endpoint
            // port.
            (&Endpoint::Ident(bound_ident), &Icmpv4Repr::EchoRequest { ident, .. }) |
            (&Endpoint::Ident(bound_ident), &Icmpv4Repr::EchoReply { ident, .. }) =>
                ident == bound_ident,
            _ => false,
        }
    }
/// Filter determining which packets received by the interface are appended to
/// the given sockets received buffer.
Filter determining which packets received by the interface are appended to
the given sockets received buffer.
Filter determining which packets received by the interface are appended to the given sockets received buffer .
pub(crate) fn accepts(&self, ip_repr: &IpRepr, icmp_repr: &Icmpv4Repr,
                          cksum: &ChecksumCapabilities) -> bool {
        match (&self.endpoint, icmp_repr) {
            // If we are bound to ICMP errors associated to a UDP port, only
            // accept Destination Unreachable messages with the data containing
            // a UDP packet send from the local port we are bound to.
            (&Endpoint::Udp(endpoint), &Icmpv4Repr::DstUnreachable { data, .. })
                    if endpoint.addr.is_unspecified() || endpoint.addr == ip_repr.dst_addr() => {
                let packet = UdpPacket::new(data);
                match UdpRepr::parse(&packet, &ip_repr.src_addr(), &ip_repr.dst_addr(), cksum) {
                    Ok(repr) => endpoint.port == repr.src_port,
                    Err(_) => false,
                }
            }
            // If we are bound to a specific ICMP identifier value, only accept an
            // Echo Request/Reply with the identifier field matching the endpoint
            // port.
            (&Endpoint::Ident(bound_ident), &Icmpv4Repr::EchoRequest { ident, .. }) |
            (&Endpoint::Ident(bound_ident), &Icmpv4Repr::EchoReply { ident, .. }) =>
                ident == bound_ident,
            _ => false,
        }
    }
pub ( crate ) fn accepts ( & self , ip_repr : & IpRepr , icmp_repr : & Icmpv4Repr , cksum : & ChecksumCapabilities ) -> bool { match ( & self . endpoint , icmp_repr ) { // If we are bound to ICMP errors associated to a UDP port, only // accept Destination Unreachable messages with the data containing // a UDP packet send from the local port we are bound to. ( & Endpoint :: Udp ( endpoint ) , & Icmpv4Repr :: DstUnreachable { data , .. } ) if endpoint . addr . is_unspecified ( ) || endpoint . addr == ip_repr . dst_addr ( ) => { let packet = UdpPacket :: new ( data ) ; match UdpRepr :: parse ( & packet , & ip_repr . src_addr ( ) , & ip_repr . dst_addr ( ) , cksum ) { Ok ( repr ) => endpoint . port == repr . src_port , Err ( _ ) => false , } } // If we are bound to a specific ICMP identifier value, only accept an // Echo Request/Reply with the identifier field matching the endpoint // port. ( & Endpoint :: Ident ( bound_ident ) , & Icmpv4Repr :: EchoRequest { ident , .. } ) | ( & Endpoint :: Ident ( bound_ident ) , & Icmpv4Repr :: EchoReply { ident , .. } ) => ident == bound_ident , _ => false , } }
Filter determining which packets received by the interface are appended to
the given sockets received buffer.
Filter determining which packets received by the interface are appended to the given sockets received buffer .
&self
ip_repr
&IpRepr
icmp_repr
&Icmpv4Repr
cksum
&ChecksumCapabilities
&self
ip_repr
&IpRepr
icmp_repr
&Icmpv4Repr
cksum
&ChecksumCapabilities