EthernetInterface::set_ipv4_gateway should panic on non-unicast addrs.

This commit is contained in:
whitequark 2017-12-22 13:07:11 +00:00
parent f1a7fbe973
commit 85487bf3bc
1 changed files with 4 additions and 0 deletions

View File

@ -250,9 +250,13 @@ impl<'b, 'c, DeviceT> Interface<'b, 'c, DeviceT>
}
/// Set the IPv4 gateway of the interface.
///
/// # Panics
/// This function panics if the given address is not unicast.
pub fn set_ipv4_gateway<GatewayAddrT>(&mut self, gateway: GatewayAddrT)
where GatewayAddrT: Into<Option<Ipv4Address>> {
self.inner.ipv4_gateway = gateway.into();
self.inner.ipv4_gateway.map(|addr| InterfaceInner::check_gateway_addr(&addr));
}
/// Transmit packets queued in the given sockets, and receive packets queued