0

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?

Jongware
  • 22,200
  • 8
  • 54
  • 100
tt_Gantz
  • 2,786
  • 3
  • 23
  • 43
  • 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 Sep 30 '14 at 06:04
  • 64 bytes including the checksum according to http://en.wikipedia.org/wiki/Ethernet_frame#Structure – Peter Gibson Sep 30 '14 at 06:06
  • Yea trying to send a malformed packet, is there a way to avoid the linux device driver padding it to that size? – tt_Gantz Sep 30 '14 at 07:40

1 Answers1

2

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.

tt_Gantz
  • 2,786
  • 3
  • 23
  • 43