English 中文(简体)
Ethernet checksum checking in wireless stack
原标题:

When receiving a raw ethernet packet over a wireless connection, where does the ethernet checksum get calculated, and where are errors handled?

Does the wireless stack handle this, or is it handled in the upper layers?

最佳回答

Checksums may be carried out in various places. Recent Ethernet cards offload the checksums from the network stack. I have had to disable hardware checksumming to make network forensics easier. This should make obvious sense as without this functionality hardware would always silently drop packets.

问题回答

Usually, the Ethernet level FCS (Frame Check Sequence) is handled in the hardware MAC (Media Access Controller). Note that we are talking about a CRC here and not just a checksum (there isn t a "checksum" at the Ethernet frame level).

If an FCS mismatch is detected, it will most probably be discarded at the HW MAC level: a statistics counter will then be updated.

In other words, it is no use "bothering" the software stack with an unusable frame.

As the other posters have said the FCS is normally checked by the NIC itself or by the driver. However, in the case where you read up raw ethernet frames I think it depends completely on the driver. For instance, in WiFi NICs that can be set in "monitor" or "promiscous" modes you usually don t want them to discard frames with bad FCS since that may signify an error that you are looking for.

One data point: the Intel 4965AGN Linux driver sets the FCS field in all captured packets to 0 in monitor mode. If you run Wireshark you can see that it calculates the expected FCS and complains that the 0-field is invalid. Wether this means that it discards frames with bad FCS in the MAC, or if those are also passed up is unfortunately unclear.

So if the original question is "Do I have to check the FCS myself when capturing raw packets" the answer in the 4965AGN case is "you can t", and may be "yes" if you get the real FCS from the NIC.

Most network hardware will allow you to set an option in the hardware to "store bad packets." This allows you to see packets in which the ethernet CRC failed. If you pass a bad ethernet frame to the stack, it will most likely be rejected due to a bad upper layer checksum. The stack does not check ethernet CRCs; this is left to the NIC, and CRC computation in software is time-consuming.

Keep in mind that stacked network protocols usually calculate checksums at various points in the stack. TCP will typically calculate a CRC at the network layer, IP header checksum at the IP layer, and TCP checksum at the TCP layer. The application may also verify the integrity of the data.





相关问题
How can I program a wireless adapter?

Is it possible to program a wireless adapter attached to a computer? I need to modify how they work, not just using them to perform a task such as scanning or connecting. I have already tried the ...

Is it possible to program a Wireless Access Point? [closed]

I need to modify the way the wireless access point handle its authentication method. Is it possible to change the behaviour of wireless access point a little bit? If so, by using what library? On what ...

Ad-hoc connection disappearing

I create an ad-hoc connection between my Ubuntu 9.10 laptop (wlan0) and my iPod touch, but the connection only lasts for seconds before it is dropped. Why might this be happening? I use the following ...

Windows 7 Virtual WiFi using C#?

Windows 7 introduced Virtual WiFi which allows you to create hotspots. However I can t find any tutorials on doing it in C#. I found Virtual Router (It is open source and is written in C#) but I can t ...

Ethernet checksum checking in wireless stack

When receiving a raw ethernet packet over a wireless connection, where does the ethernet checksum get calculated, and where are errors handled? Does the wireless stack handle this, or is it handled ...

Lightweight network visualization tool

I ve been trying to find a tool for monitoring my home network. Before I go into the details, I ve looked at a ton of different software and they re either an overkill or don t have what I m looking ...

decoding 802.11 b

I have a raw grabbed data from spectrometer that was working on wifi (802.11b) channel 6. (two laptops in ad-hoc ping each other). I would like to decode this data in matlab. I see them as complex ...

Ericsson f3507g WWAN (3G Broadband) and AT commands

I have a lenovo x200t tablet with WWAN built into it. I m trying to connect to the internet using AT commands and a C# program which I am making so that the program can connect to the net and upload ...

热门标签