简体   繁体   English

在python中从UDP数据包中删除填充(Linux)

[英]Removing padding from UDP packets in python (Linux)

I am trying to remove null padding from UDP packets sent from a Linux computer. 我正在尝试从Linux计算机发送的UDP数据包中删除空填充。 Currently it pads the size of the packet to 60 bytes . 目前,它会将数据包的大小填充到60个字节

I am constructing a raw socket using AF_PACKET and SOCK_RAW . 我正在使用AF_PACKETSOCK_RAW构造原始套接字。 I created everything from the ethernet frame header, ip header (in which I specify a packet size of less than 60) and the udp packet itself. 我从以太网帧头,ip头(在其中我指定小于60的数据包大小)和udp数据包本身创建了所有内容。

I send over a local network and the observed packet in wireshark has null padding. 我通过本地网络发送,wireshark中观察到的数据包具有空填充。 Any advice on how to overcome this issue? 关于如何克服这个问题有什么建议吗?

This is pretty much impossible without playing around with the Linux drivers. 如果不使用Linux驱动程序,这几乎是不可能的。 This isn't the best answer but it should guide anyone else looking to do this in the right direction.3 这不是最好的答案,但它应该指导其他寻求正确方向的人。3

Type sudo ethtool -d eth0 to see if your driver has pad short packets enabled. 键入sudo ethtool -d eth0来查看您的驱动程序是否启用了填充短数据包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM