/// Sends out any pending frames that are waiting for link layer address
/// resolution.
///
/// `mac_resolved` is the common logic used when a link layer address is
/// resolved either by ARP or NDP.
Sends out any pending frames that are waiting for link layer address
resolution.

`mac_resolved` is the common logic used when a link layer address is
resolved either by ARP or NDP.
Sends out any pending frames that are waiting for link layer address resolution . ` mac_resolved ` is the common logic used when a link layer address is resolved either by ARP or NDP .
fn mac_resolved<C: EthernetIpLinkDeviceContext>(
    ctx: &mut C,
    device_id: C::DeviceId,
    address: IpAddr,
    dst_mac: Mac,
) {
    let state = &mut ctx.get_state_mut_with(device_id).link;
    let src_mac = state.mac;
    let ether_type = match &address {
        IpAddr::V4(_) => EtherType::Ipv4,
        IpAddr::V6(_) => EtherType::Ipv6,
    };
    if let Some(pending) = state.take_pending_frames(address) {
        for frame in pending {
            // NOTE(brunodalbo): We already performed MTU checking when we saved
            //  the buffer waiting for address resolution. It should be noted
            //  that the MTU check back then didn't account for ethernet frame
            //  padding required by EthernetFrameBuilder, but that's fine (as it
            //  stands right now) because the MTU is guaranteed to be larger
            //  than an Ethernet minimum frame body size.
            let res = ctx.send_frame(
                device_id.into(),
                frame.encapsulate(EthernetFrameBuilder::new(src_mac.get(), dst_mac, ether_type)),
            );
            if let Err(_) = res {
                // TODO(joshlf): Do we want to handle this differently?
                debug!("Failed to send pending frame; MTU changed since frame was queued");
            }
        }
    }
}
fn mac_resolved < C : EthernetIpLinkDeviceContext > ( ctx : & mut C , device_id : C :: DeviceId , address : IpAddr , dst_mac : Mac , ) { let state = & mut ctx . get_state_mut_with ( device_id ) . link ; let src_mac = state . mac ; let ether_type = match & address { IpAddr :: V4 ( _ ) => EtherType :: Ipv4 , IpAddr :: V6 ( _ ) => EtherType :: Ipv6 , } ; if let Some ( pending ) = state . take_pending_frames ( address ) { for frame in pending { // NOTE(brunodalbo): We already performed MTU checking when we saved //  the buffer waiting for address resolution. It should be noted //  that the MTU check back then didn't account for ethernet frame //  padding required by EthernetFrameBuilder, but that's fine (as it //  stands right now) because the MTU is guaranteed to be larger //  than an Ethernet minimum frame body size. let res = ctx . send_frame ( device_id . into ( ) , frame . encapsulate ( EthernetFrameBuilder :: new ( src_mac . get ( ) , dst_mac , ether_type ) ) , ) ; if let Err ( _ ) = res { // TODO(joshlf): Do we want to handle this differently? debug ! ( " " ) ; } } } }
Sends out any pending frames that are waiting for link layer address
resolution.
Sends out any pending frames that are waiting for link layer address resolution .
ctx
&mut C
device_id
C::DeviceId
address
IpAddr
dst_mac
Mac