Function encode_icmp_error
pub fn encode_icmp_error(
invoking: IpPacket<'_>,
source: IpAddr,
kind: IcmpErrorKind,
output: &mut [u8],
) -> Result<Option<usize>, IpPacketError>Available on crate feature
net only.Expand description
Encode an IP packet carrying an ICMP error and a bounded quotation of invoking.
Returns None when error generation is suppressed: an error in response to
an error, an unusable source, a non-initial IPv4 fragment, or a multicast
destination (except IPv6 Packet Too Big). The caller must also suppress errors
for link-layer broadcasts and subnet-directed IPv4 broadcasts, which cannot
be identified without link configuration, and apply a rate limit.
Replies are at most 576 bytes for IPv4 and 1280 for IPv6; they do not reflect
arbitrary peer-sized payloads. source is an address selected by the caller’s
routing policy, not automatically the invoking packet’s destination.