Linux 中的 DHCP 單播封包處理

Linux 中的 DHCP 單播封包處理

我正在嘗試捕獲並處理(在第 3 方分析應用程式中)來自 ERSPAN 會話的 DHCP 封包,但無法執行此操作。有接收 ERSPAN 流量的 PHY 介面和取得解封裝封包的 erspan-type 介面(ip link add inspan type erspan seq key 10 local 10.171.165.65 erspan_ver 1)

我使用 nftables 來匹配和處理最簡單的規則:

table netdev inspan {
  chain catch {
    type filter hook ingress device "inspan" priority filter ; policy accept;
    iifname "inspan" udp dport 67 counter meta nftrace set 1 accept
  }
}

僅顯示廣播資料包(ip baddr 255.255.255.255):

# nft monitor trace

trace id 6fd1132b inet filter input packet: iif "inspan" ether saddr 00:1a:64:33:8d:fa ether daddr ff:ff:ff:ff:ff:ff ip saddr 0.0.0.0 ip daddr 255.255.255.255 ip dscp cs0 ip ecn not-ect ip ttl 128 ip id 20986 ip protocol udp ip length 328 udp sport 68 udp dport 67 udp length 308 @th,64,96 0x1010600d5d272d200000000
trace id 6fd1132b inet filter input rule iifname "inspan" udp dport 67 counter packets 0 bytes 0 meta nftrace set 1 accept (verdict accept)

而所有單播封包(存在於 PHY 上封裝的 ERSPAN 流量中)在此追蹤中都會遺失,就像它們在 PHY 和 inspan 之間的某個位置消耗(和丟棄)一樣。

請注意,其他所有內容都出現在 inspan 中(使用 tcpdump 查看時) - 任何其他 TCP、UDP 等,除了 DHCP uincast,且它不依賴鏈中所有介面的 promisc 設定。

系統看起來很乾淨。這是Ubuntu 22.04,但沒有任何DHCP伺服器、DHCP客戶端、netplan、ifupdown和其他與DHCP相關的東西; systemd-networkd 完全停用(出於測試目的,我手動設定網路)。

有什麼想法單播 DHCP 封包遺失嗎?對我來說,看起來內核中的某些東西捕獲了這些資料包並丟棄它們,因為它們不是針對該主機的。

謝謝。

相關內容