浏览代码

arp: ignore ARP packets that are not REQUEST or RESPONSE.

Dario Nieuwenhuis 3 年之前
父节点
当前提交
db7b2249ed
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/iface/interface.rs

+ 6 - 0
src/iface/interface.rs

@@ -1011,6 +1011,12 @@ impl<'a> InterfaceInner<'a> {
                     return Ok(None);
                 }
 
+                // Only process REQUEST and RESPONSE.
+                if let ArpOperation::Unknown(_) = operation {
+                    net_debug!("arp: unknown operation code");
+                    return Err(Error::Malformed);
+                }
+
                 // Discard packets with non-unicast source addresses.
                 if !source_protocol_addr.is_unicast() || !source_hardware_addr.is_unicast() {
                     net_debug!("arp: non-unicast source address");