Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/iface/ethernet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,12 +1026,9 @@ impl<'b, 'c, 'e> InterfaceInner<'b, 'c, 'e> {
!self.has_multicast_group(ipv4_repr.dst_addr) {
// Ignore IP packets not directed at us, or broadcast, or any of the multicast groups.
// If AnyIP is enabled, also check if the packet is routed locally.
if !self.any_ip {
return Ok(None);
} else if match self.routes.lookup(&IpAddress::Ipv4(ipv4_repr.dst_addr), timestamp) {
Some(router_addr) => !self.has_ip_addr(router_addr),
None => true,
} {
if !self.any_ip ||
self.routes.lookup(&IpAddress::Ipv4(ipv4_repr.dst_addr), timestamp)
.map_or(true, |router_addr| !self.has_ip_addr(router_addr)) {
return Ok(None);
}
}
Expand Down Expand Up @@ -1188,10 +1185,9 @@ impl<'b, 'c, 'e> InterfaceInner<'b, 'c, 'e> {
let ip_addr = ip_repr.src_addr.into();
match lladdr {
Some(lladdr) if lladdr.is_unicast() && target_addr.is_unicast() => {
if flags.contains(NdiscNeighborFlags::OVERRIDE) {
if flags.contains(NdiscNeighborFlags::OVERRIDE) ||
!self.neighbor_cache.lookup(&ip_addr, timestamp).found() {
self.neighbor_cache.fill(ip_addr, lladdr, timestamp)
} else if !self.neighbor_cache.lookup(&ip_addr, timestamp).found() {
self.neighbor_cache.fill(ip_addr, lladdr, timestamp)
}
},
_ => (),
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@
feature = "socket-tcp")))]
compile_error!("at least one socket needs to be enabled"); */

// FIXME(dlrobertson): clippy fails with this lint
#![allow(clippy::if_same_then_else)]
#![allow(clippy::manual_non_exhaustive)]
#![allow(clippy::match_like_matches_macro)]
#![allow(clippy::redundant_field_names)]
#![allow(clippy::identity_op)]
Expand Down
8 changes: 2 additions & 6 deletions src/phy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ impl Checksum {

/// A description of checksum behavior for every supported protocol.
#[derive(Debug, Clone, Default)]
#[non_exhaustive]
pub struct ChecksumCapabilities {
pub ipv4: Checksum,
pub udp: Checksum,
Expand All @@ -166,7 +167,6 @@ pub struct ChecksumCapabilities {
pub icmpv4: Checksum,
#[cfg(feature = "proto-ipv6")]
pub icmpv6: Checksum,
dummy: (),
}

impl ChecksumCapabilities {
Expand All @@ -181,7 +181,6 @@ impl ChecksumCapabilities {
icmpv4: Checksum::None,
#[cfg(feature = "proto-ipv6")]
icmpv6: Checksum::None,
..Self::default()
}
}
}
Expand All @@ -191,6 +190,7 @@ impl ChecksumCapabilities {
/// Higher-level protocols may achieve higher throughput or lower latency if they consider
/// the bandwidth or packet size limitations.
#[derive(Debug, Clone, Default)]
#[non_exhaustive]
pub struct DeviceCapabilities {
/// Maximum transmission unit.
///
Expand All @@ -214,10 +214,6 @@ pub struct DeviceCapabilities {
/// If the network device is capable of verifying or computing checksums for some protocols,
/// it can request that the stack not do so in software to improve performance.
pub checksum: ChecksumCapabilities,

/// Only present to prevent people from trying to initialize every field of DeviceLimits,
/// which would not let us add new fields in the future.
pub(crate) dummy: ()
}

/// An interface for sending and receiving raw network frames.
Expand Down
1 change: 1 addition & 0 deletions src/socket/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1905,6 +1905,7 @@ impl<'a> TcpSocket<'a> {
Ok(())
}

#[allow(clippy::if_same_then_else)]
pub(crate) fn poll_at(&self) -> PollAt {
// The logic here mirrors the beginning of dispatch() closely.
if !self.remote_endpoint.is_specified() {
Expand Down
1 change: 1 addition & 0 deletions src/wire/arp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl<T: AsRef<[u8]>> Packet<T> {
///
/// [set_hardware_len]: #method.set_hardware_len
/// [set_protocol_len]: #method.set_protocol_len
#[allow(clippy::if_same_then_else)]
pub fn check_len(&self) -> Result<()> {
let len = self.buffer.as_ref().len();
if len < field::OPER.end {
Expand Down
1 change: 1 addition & 0 deletions src/wire/ipv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ impl<T: AsRef<[u8]>> Packet<T> {
///
/// [set_header_len]: #method.set_header_len
/// [set_total_len]: #method.set_total_len
#[allow(clippy::if_same_then_else)]
pub fn check_len(&self) -> Result<()> {
let len = self.buffer.as_ref().len();
if len < field::DST_ADDR.end {
Expand Down