在python中从UDP数据包中删除填充(Linux) [英] Removing padding from UDP packets in python (Linux)

查看:158
本文介绍了在python中从UDP数据包中删除填充(Linux)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Linux计算机发送的UDP数据包中删除空填充.目前,它会将数据包的大小填充为 60个字节 .

I am trying to remove null padding from UDP packets sent from a Linux computer. Currently it pads the size of the packet to 60 bytes.

我正在使用AF_PACKETSOCK_RAW构造原始套接字.我从以太网帧头,ip头(其中我指定的数据包大小小于60)和udp数据包本身创建了所有内容.

I am constructing a raw socket using AF_PACKET and SOCK_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.

我通过本地网络发送,wireshark中观察到的数据包具有空填充. 关于如何解决此问题有什么建议吗?

I send over a local network and the observed packet in wireshark has null padding. Any advice on how to overcome this issue?

推荐答案

如果不使用Linux驱动程序,这几乎是不可能的.这不是最好的答案,但它应该指导其他寻求正确方向的人.3

This is pretty much impossible without playing around with the Linux drivers. This isn't the best answer but it should guide anyone else looking to do this in the right direction.3

类型 须藤ethtool -d eth0 查看您的驱动程序是否启用了填充短数据包.

Type sudo ethtool -d eth0 to see if your driver has pad short packets enabled.

这篇关于在python中从UDP数据包中删除填充(Linux)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆