pub enum IpParseErrorAction {
    DiscardPacket,
    DiscardPacketSendIcmp,
    DiscardPacketSendIcmpNoMulticast,
}
Expand description

Action to take when an IP node fails to parse a received IP packet.

These actions are taken from RFC 8200 section 4.2. Although these actions are defined by an IPv6 RFC, IPv4 nodes that fail to parse a received packet will take similar actions.

Variants§

§

DiscardPacket

Discard the packet and do nothing further.

§

DiscardPacketSendIcmp

Discard the packet and send an ICMP response.

§

DiscardPacketSendIcmpNoMulticast

Discard the packet and send an ICMP response if the packet’s destination address was not a multicast address.

Implementations§

source§

impl IpParseErrorAction

source

pub fn should_send_icmp<A: IpAddress>(&self, dst_addr: &A) -> bool

Determines whether or not an ICMP message should be sent.

Returns true if the caller should send an ICMP response. The caller should send an ICMP response if an action is set to DiscardPacketSendIcmp, or if an action is set to DiscardPacketSendIcmpNoMulticast and dst_addr (the destination address of the original packet that lead to a parsing error) is not a multicast address.

source

pub fn should_send_icmp_to_multicast(&self) -> bool

Determines whether or not an ICMP message should be sent even if the original packet’s destination address is a multicast.

Per RFC 1122 section 3.2.2 and RFC 4443 section 2.4, ICMP messages MUST NOT be sent in response to packets destined to a multicast or broadcast address. However, RFC 4443 section 2.4 includes an exception to this rule if certain criteria are met when parsing IPv6 extension header options. should_send_icmp_to_multicast returns true if the criteria are met. See RFC 4443 section 2.4 for more details about the exception.

Trait Implementations§

source§

impl Clone for IpParseErrorAction

source§

fn clone(&self) -> IpParseErrorAction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for IpParseErrorAction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for IpParseErrorAction

source§

fn eq(&self, other: &IpParseErrorAction) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for IpParseErrorAction

source§

impl StructuralPartialEq for IpParseErrorAction

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more