How can i receive the wrong Ethernet frames and disable the CRC/FCS calcul?

后端 未结 2 2016
悲&欢浪女
悲&欢浪女 2020-12-16 05:58

I generate a traffic between two PCs running Linux (by sending Ethernet frames), the goal of this is to capture some errors frames. The problem is when the Phy layer detect

2条回答
  •  情深已故
    2020-12-16 06:50

    you can open a raw socket using socket() call. for example the following call opens a raw TCP socket:

    int fd = socket (PF_INET, SOCK_RAW, IPPROTO_TCP);
    

    you can change the protocol to whichever you want and you can be sure that you receive every packet.

    The above code will only get you a capture of good packets as the damaged packets don't even make it to OS and are dropped either at switch first or at the line card driver connected to your PC. More discussion on the same topic can be found here at Wireshark wiki page

提交回复
热议问题