title: C creating a raw UDP packet
body: <p>I am interested in creating a DNS (using UDP protocol to send it) response packet, however I found limited information how to create your own packet.</p>
  
  <p>Most tutorials are like this <a href="https://opensourceforu.com/2015/03/a-guide-to-using-raw-sockets/" rel="nofollow noreferrer">https://opensourceforu.com/2015/03/a-guide-to-using-raw-sockets/</a></p>
  
  <p>They use structs to fill in the fields and connect them into 1 sequence. But I am concerned that the compiler can pad the struct, making it "corrupted" (make the packet longer then it should be)</p>
  
  <p><strong>I fully know that there are struct attributes, that don't allow the compiler to pad structs, but I don't want to use them</strong></p>
  
  <p>Can anyone point me some resources on packet creation. I can use Libpcap and raw sockets</p>