天天看點

linux報資料幀錯誤,linux – 如何接收錯誤的以太網幀并禁用CRC / FCS計算?

您沒有指定哪個作業系統,但我至少可以代表Linux:

它可能在您的核心,NIC和驅動程式以及ethtool版本上.

我們需要告訴驅動程式/硬體做兩件通常不會做的事情:

1)将FCS字段傳遞到網絡堆棧. (通常這會在被傳遞之前被截斷)

2)不丢棄具有錯誤FCS字段的資料包,而是按原樣傳遞它們

有兩種ethtool選項可以實作以下各項:

ethtool -K eth0 rx-fcs on #1 above: give us the FCS field

ethtool -K eth0 rx-all on #2 above: even receive bad packets

有了這些,我可以使用wireshark或tcpdump來檢視FCS字段,即使它們不正确. (在我的情況下,我有一些網絡裝置,它使用準确的時間戳即時替換校驗和 – 這會導緻資料包顯示為“壞”,并使用上述内容進行恢複)

并非所有卡都會實作這一點!他們可能将上述ethtool選項“修複”或不回應.

以1G的速度,我看到e1000卡運作良好.在10G我還沒有找到一個可以做到這一點的網卡,而且必須依賴更複雜的資料采集卡.

同樣,我不知道最低核心/ ethtool版本要求是什麼,但我确實記得要更新CentOS伺服器以使其工作.

我也知道r8169和e1000驅動程式/卡可以做到,但根本不能說任何其他組合.

另請注意,您将無法在發送它們的計算機上捕獲傳出的FCS值,因為它們在過程中很晚才添加(可能已解除安裝到卡本身),是以pcap無法看到.

在Linux 3.10.11核心上,使用ethtool 3.10:

$ethtool -k eth0

Features for eth0:

rx-checksumming: on

tx-checksumming: on

tx-checksum-ipv4: off [fixed]

tx-checksum-ip-generic: on

tx-checksum-ipv6: off [fixed]

tx-checksum-fcoe-crc: off [fixed]

tx-checksum-sctp: off [fixed]

scatter-gather: on

tx-scatter-gather: on

tx-scatter-gather-fraglist: off [fixed]

tcp-segmentation-offload: on

tx-tcp-segmentation: on

tx-tcp-ecn-segmentation: off [fixed]

tx-tcp6-segmentation: on

udp-fragmentation-offload: off [fixed]

generic-segmentation-offload: on

generic-receive-offload: on

large-receive-offload: off [fixed]

rx-vlan-offload: on

tx-vlan-offload: on

ntuple-filters: off [fixed]

receive-hashing: on

highdma: on [fixed]

rx-vlan-filter: on [fixed]

vlan-challenged: off [fixed]

tx-lockless: off [fixed]

netns-local: off [fixed]

tx-gso-robust: off [fixed]

tx-fcoe-segmentation: off [fixed]

tx-gre-segmentation: off [fixed]

tx-udp_tnl-segmentation: off [fixed]

fcoe-mtu: off [fixed]

tx-nocache-copy: on

loopback: off [fixed]

rx-fcs: off

rx-all: off

tx-vlan-stag-hw-insert: off [fixed]

rx-vlan-stag-hw-parse: off [fixed]

rx-vlan-stag-filter: off [fixed]

然後:

$sudo ethtool -K eth0 rx-fcs on rx-all on

給我:

$ethtool -k eth0

Features for eth0:

rx-checksumming: on

tx-checksumming: on

tx-checksum-ipv4: off [fixed]

tx-checksum-ip-generic: on

tx-checksum-ipv6: off [fixed]

tx-checksum-fcoe-crc: off [fixed]

tx-checksum-sctp: off [fixed]

scatter-gather: on

tx-scatter-gather: on

tx-scatter-gather-fraglist: off [fixed]

tcp-segmentation-offload: on

tx-tcp-segmentation: on

tx-tcp-ecn-segmentation: off [fixed]

tx-tcp6-segmentation: on

udp-fragmentation-offload: off [fixed]

generic-segmentation-offload: on

generic-receive-offload: on

large-receive-offload: off [fixed]

rx-vlan-offload: on

tx-vlan-offload: on

ntuple-filters: off [fixed]

receive-hashing: on

highdma: on [fixed]

rx-vlan-filter: on [fixed]

vlan-challenged: off [fixed]

tx-lockless: off [fixed]

netns-local: off [fixed]

tx-gso-robust: off [fixed]

tx-fcoe-segmentation: off [fixed]

tx-gre-segmentation: off [fixed]

tx-udp_tnl-segmentation: off [fixed]

fcoe-mtu: off [fixed]

tx-nocache-copy: on

loopback: off [fixed]

rx-fcs: on

rx-all: on

tx-vlan-stag-hw-insert: off [fixed]

rx-vlan-stag-hw-parse: off [fixed]

rx-vlan-stag-filter: off [fixed]