pub fn build_icmp6_destination_unreachable_response(
    original_ip_packet: &Ipv6Packet,
    my_src_address: &Ipv6Addr,
    my_dst_address: &Ipv6Addr,
) -> Vec<u8> {
    // ICMP destination unreachable messages have 4 8bit words of unused space between header and actual payload
    const RESERVED_WORDS: usize = 4;

    let mut result = vec![
        0;
        MutableIcmpv6Packet::minimum_packet_size()
            + original_ip_packet.packet_size()
            + RESERVED_WORDS
    ];

    let mut packet = MutableIcmpv6Packet::new(&mut result)
        .expect("Could not build into buffer to construct destination unreachable ICMPv6 packet");
    packet.populate(&Icmpv6 {
        icmpv6_type: Icmpv6Types::DestinationUnreachable,
        icmpv6_code: Icmpv6Code(4),
        checksum: 0,
        payload: [&[0; RESERVED_WORDS], original_ip_packet.packet()].concat(),
    });
    packet.set_checksum(checksum(
        &packet.to_immutable(),
        my_src_address,
        my_dst_address,
    ));

    result
}
/// Build an *ICMPv6 destination unreachable* packet.
///
/// The *destination unreachable* packets should be generated when a higher level protocol cannot
/// be delivered.
///
/// This packet includes the original IPv6 packet in it's payload to provide the sender with some
/// context.
///
/// `src_address` and `dst_address` need to be provided to calculate an ICMPv6 checksum.
Build an *ICMPv6 destination unreachable* packet.
The *destination unreachable* packets should be generated when a higher level protocol cannot
be delivered.

This packet includes the original IPv6 packet in it's payload to provide the sender with some
context.

`src_address` and `dst_address` need to be provided to calculate an ICMPv6 checksum.
Build an * ICMPv6 destination unreachable * packet . The * destination unreachable * packets should be generated when a higher level protocol cannot be delivered . This packet includes the original IPv6 packet in it ' s payload to provide the sender with some context . ` src_address ` and ` dst_address ` need to be provided to calculate an ICMPv6 checksum .
pub fn build_icmp6_destination_unreachable_response(
    original_ip_packet: &Ipv6Packet,
    my_src_address: &Ipv6Addr,
    my_dst_address: &Ipv6Addr,
) -> Vec<u8> {
    // ICMP destination unreachable messages have 4 8bit words of unused space between header and actual payload
    const RESERVED_WORDS: usize = 4;
    let mut result = vec![
        0;
        MutableIcmpv6Packet::minimum_packet_size()
            + original_ip_packet.packet_size()
            + RESERVED_WORDS
    ];
    let mut packet = MutableIcmpv6Packet::new(&mut result)
        .expect("Could not build into buffer to construct destination unreachable ICMPv6 packet");
    packet.populate(&Icmpv6 {
        icmpv6_type: Icmpv6Types::DestinationUnreachable,
        icmpv6_code: Icmpv6Code(4),
        checksum: 0,
        payload: [&[0; RESERVED_WORDS], original_ip_packet.packet()].concat(),
    });
    packet.set_checksum(checksum(
        &packet.to_immutable(),
        my_src_address,
        my_dst_address,
    ));
    result
}
pub fn build_icmp6_destination_unreachable_response ( original_ip_packet : & Ipv6Packet , my_src_address : & Ipv6Addr , my_dst_address : & Ipv6Addr , ) -> Vec < u8 > { // ICMP destination unreachable messages have 4 8bit words of unused space between header and actual payload const RESERVED_WORDS : usize = 4 ; let mut result = vec ! [ 0 MutableIcmpv6Packet minimum_packet_size ( ) original_ip_packet packet_size ( ) RESERVED_WORDS ] ; let mut packet = MutableIcmpv6Packet :: new ( & mut result ) . expect ( " " ) ; packet . populate ( & Icmpv6 { icmpv6_type : Icmpv6Types :: DestinationUnreachable , icmpv6_code : Icmpv6Code ( 4 ) , checksum : 0 , payload : [ & [ 0 ; RESERVED_WORDS ] , original_ip_packet . packet ( ) ] . concat ( ) , } ) ; packet . set_checksum ( checksum ( & packet . to_immutable ( ) , my_src_address , my_dst_address , ) ) ; result }
Build an *ICMPv6 destination unreachable* packet.
Build an * ICMPv6 destination unreachable * packet .
original_ip_packet
&Ipv6Packet
my_src_address
&Ipv6Addr
my_dst_address
&Ipv6Addr
original_ip_packet
&Ipv6Packet
my_src_address
&Ipv6Addr
my_dst_address
&Ipv6Addr