Make `Error::Unaddressable` ignored for ICMP sockets as well.

This commit is contained in:
Egor Karavaev 2017-11-13 02:15:36 +03:00 committed by whitequark
parent eb7d0e346e
commit 1e809daf7a
1 changed files with 6 additions and 4 deletions

View File

@ -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) =>