pub(crate) fn send_icmpv6_packet_too_big<D: EventDispatcher, B: BufferMut>(
    ctx: &mut Context<D>,
    device: DeviceId,
    frame_dst: FrameDestination,
    src_ip: Ipv6Addr,
    dst_ip: Ipv6Addr,
    proto: IpProto,
    mtu: u32,
    mut original_packet: B,
    header_len: usize,
) {
    increment_counter!(ctx, "send_icmpv6_packet_too_big");

    // Check the conditions of RFC 1122 section 3.2.2 in order to determine
    // whether we MUST NOT send an ICMP error message. should_send_icmp_error
    // does not handle the "ICMP error message" case, so we check that
    // separately with a call to is_icmp_error_message.
    if !should_send_icmp_error(frame_dst, src_ip, dst_ip)
        || is_icmp_error_message(proto, &original_packet.as_ref()[header_len..])
    {
        return;
    }

    // Per RFC 4443, body contains as much of the original body as possible
    // without exceeding IPv6 minimum MTU.
    original_packet.shrink_back_to(IPV6_MIN_MTU as usize);
    send_icmp_response(ctx, device, src_ip, dst_ip, IpProto::Icmpv6, |local_ip| {
        BufferSerializer::new_vec(original_packet).encapsulate(
            IcmpPacketBuilder::<Ipv6, &[u8], _>::new(
                local_ip,
                src_ip,
                IcmpUnusedCode,
                Icmpv6PacketTooBig::new(mtu),
            ),
        )
    });
}
/// Send an ICMPv6 message in response to receiving a packet whose size exceeds
/// the MTU of the next hop interface.
///
/// `send_icmpv6_packet_too_big` sends an ICMPv6 "packet too big" message in
/// response to receiving an IP packet from `src_ip` to `dst_ip` whose size
/// exceeds the `mtu` of the next hop interface.
Send an ICMPv6 message in response to receiving a packet whose size exceeds
the MTU of the next hop interface.


Send an ICMPv6 message in response to receiving a packet whose size exceeds the MTU of the next hop interface .
pub(crate) fn send_icmpv6_packet_too_big<D: EventDispatcher, B: BufferMut>(
    ctx: &mut Context<D>,
    device: DeviceId,
    frame_dst: FrameDestination,
    src_ip: Ipv6Addr,
    dst_ip: Ipv6Addr,
    proto: IpProto,
    mtu: u32,
    mut original_packet: B,
    header_len: usize,
) {
    increment_counter!(ctx, "send_icmpv6_packet_too_big");
    // Check the conditions of RFC 1122 section 3.2.2 in order to determine
    // whether we MUST NOT send an ICMP error message. should_send_icmp_error
    // does not handle the "ICMP error message" case, so we check that
    // separately with a call to is_icmp_error_message.
    if !should_send_icmp_error(frame_dst, src_ip, dst_ip)
        || is_icmp_error_message(proto, &original_packet.as_ref()[header_len..])
    {
        return;
    }
    // Per RFC 4443, body contains as much of the original body as possible
    // without exceeding IPv6 minimum MTU.
    original_packet.shrink_back_to(IPV6_MIN_MTU as usize);
    send_icmp_response(ctx, device, src_ip, dst_ip, IpProto::Icmpv6, |local_ip| {
        BufferSerializer::new_vec(original_packet).encapsulate(
            IcmpPacketBuilder::<Ipv6, &[u8], _>::new(
                local_ip,
                src_ip,
                IcmpUnusedCode,
                Icmpv6PacketTooBig::new(mtu),
            ),
        )
    });
}
pub ( crate ) fn send_icmpv6_packet_too_big < D : EventDispatcher , B : BufferMut > ( ctx : & mut Context < D > , device : DeviceId , frame_dst : FrameDestination , src_ip : Ipv6Addr , dst_ip : Ipv6Addr , proto : IpProto , mtu : u32 , mut original_packet : B , header_len : usize , ) { increment_counter ! ( ctx " " ) ; // Check the conditions of RFC 1122 section 3.2.2 in order to determine // whether we MUST NOT send an ICMP error message. should_send_icmp_error // does not handle the "ICMP error message" case, so we check that // separately with a call to is_icmp_error_message. if ! should_send_icmp_error ( frame_dst , src_ip , dst_ip ) || is_icmp_error_message ( proto , & original_packet . as_ref ( ) [ header_len .. ] ) { return ; } // Per RFC 4443, body contains as much of the original body as possible // without exceeding IPv6 minimum MTU. original_packet . shrink_back_to ( IPV6_MIN_MTU as usize ) ; send_icmp_response ( ctx , device , src_ip , dst_ip , IpProto :: Icmpv6 , | local_ip | { BufferSerializer :: new_vec ( original_packet ) . encapsulate ( IcmpPacketBuilder :: < Ipv6 , & [ u8 ] , _ > :: new ( local_ip , src_ip , IcmpUnusedCode , Icmpv6PacketTooBig :: new ( mtu ) , ) , ) } ) ; }
Send an ICMPv6 message in response to receiving a packet whose size exceeds
the MTU of the next hop interface.
Send an ICMPv6 message in response to receiving a packet whose size exceeds the MTU of the next hop interface .
ctx
&mut Context<D>
device
DeviceId
frame_dst
FrameDestination
src_ip
Ipv6Addr
dst_ip
Ipv6Addr
proto
IpProto
mtu
u32
original_packet
B
header_len
usize
ctx
&mut Context<D>
device
DeviceId
frame_dst
FrameDestination
src_ip
Ipv6Addr
dst_ip
Ipv6Addr
proto
IpProto
mtu
u32
original_packet
B
header_len
usize