route: add remove_default_ipvX_route
parent
ab47db24e0
commit
ef58fc67a4
|
@ -106,6 +106,24 @@ impl<'a> Routes<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Remove the default ipv4 gateway
|
||||
///
|
||||
/// On success, returns the previous default route, if any.
|
||||
#[cfg(feature = "proto-ipv4")]
|
||||
pub fn remove_default_ipv4_route(&mut self) -> Option<Route> {
|
||||
let cidr = IpCidr::new(IpAddress::v4(0, 0, 0, 0), 0);
|
||||
self.storage.remove(&cidr)
|
||||
}
|
||||
|
||||
/// Remove the default ipv6 gateway
|
||||
///
|
||||
/// On success, returns the previous default route, if any.
|
||||
#[cfg(feature = "proto-ipv6")]
|
||||
pub fn remove_default_ipv6_route(&mut self) -> Option<Route> {
|
||||
let cidr = IpCidr::new(IpAddress::v6(0, 0, 0, 0, 0, 0, 0, 0), 0);
|
||||
self.storage.remove(&cidr)
|
||||
}
|
||||
|
||||
pub(crate) fn lookup(&self, addr: &IpAddress, timestamp: Instant) ->
|
||||
Option<IpAddress> {
|
||||
assert!(addr.is_unicast());
|
||||
|
|
Loading…
Reference in New Issue