From 907f3659a43a1c1e1bbce68e8b9de9ab0ce6dac3 Mon Sep 17 00:00:00 2001 From: Egor Karavaev Date: Mon, 13 Nov 2017 02:15:36 +0300 Subject: [PATCH] Make `Error::Unaddressable` ignored for ICMP sockets as well. --- src/iface/ethernet.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/iface/ethernet.rs b/src/iface/ethernet.rs index 0e5586a4..51ce7ec0 100644 --- a/src/iface/ethernet.rs +++ b/src/iface/ethernet.rs @@ -227,11 +227,13 @@ impl<'b, 'c, DeviceT> Interface<'b, 'c, DeviceT> Socket::Icmp(ref mut socket) => socket.dispatch(&caps, |response| { let tx_token = device.transmit().ok_or(Error::Exhausted)?; - match response { - (IpRepr::Ipv4(repr), icmp_repr) => - inner.dispatch(tx_token, timestamp, Packet::Icmpv4((repr, icmp_repr))), + device_result = match response { + (IpRepr::Ipv4(ipv4_repr), icmpv4_repr) => + inner.dispatch(tx_token, timestamp, + Packet::Icmpv4((ipv4_repr, icmpv4_repr))), _ => Err(Error::Unaddressable), - } + }; + device_result }), #[cfg(feature = "socket-udp")] Socket::Udp(ref mut socket) =>