Skip to content

Commit 3dfcb11

Browse files
committedMar 6, 2017
Follow-up to b9e79d1; always process broadcast frames.
1 parent b9e79d1 commit 3dfcb11

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
 

‎src/iface/ethernet.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ impl<'a, 'b, 'c, DeviceT: Device + 'a> Interface<'a, 'b, 'c, DeviceT> {
119119
let rx_buffer = try!(self.device.receive());
120120
let eth_frame = try!(EthernetFrame::new(&rx_buffer));
121121

122-
if eth_frame.dst_addr() != self.hardware_addr { return Ok(()) }
122+
if !eth_frame.dst_addr().is_broadcast() &&
123+
eth_frame.dst_addr() != self.hardware_addr {
124+
return Ok(())
125+
}
123126

124127
let mut response = Response::Nop;
125128
match eth_frame.ethertype() {

‎src/wire/ethernet.rs

+5
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ impl Address {
4545
&self.0
4646
}
4747

48+
/// Query whether this address is the broadcast address.
49+
pub fn is_broadcast(&self) -> bool {
50+
self.0 == [0xff; 6]
51+
}
52+
4853
/// Query whether the "multicast" bit in the OUI is set.
4954
pub fn is_multicast(&self) -> bool {
5055
self.0[0] & 0x01 != 0

0 commit comments

Comments
 (0)
Please sign in to comment.