0
votes

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.

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.

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

1
Are you trying to send malformed packets? The minimum size of an ethernet frame is 60 bytes from memory, and the linux device driver will pad out smaller frames to this size. - Peter Gibson
64 bytes including the checksum according to en.wikipedia.org/wiki/Ethernet_frame#Structure - Peter Gibson
Yea trying to send a malformed packet, is there a way to avoid the linux device driver padding it to that size? - tt_Gantz

1 Answers

1
votes

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

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