c - WinPcap: Discarded WiFi Packet -


consider winpcap tutorial sending single packet. start running it, relatively straightforward:

  1. copy , paste code ide c (in case code::blocks)
  2. add #define have_remote 1st line
  3. set build options (link libraries , directories)
  4. set proper mac addresses
  5. fill array data want send
  6. compile , execute (as administrator)

it works nice , documented. if run other tutorial capturing packets, see packet transmitted properly.

however, if set 13th array element 0~5, packet not transmitted properly. example, before sending down packet, add following line of code:

packet[12]=5;

this way, packet being transmitted, no longer transmitted (without error message). doesn't make sense. according documentation, array element part of payload (ie: no longer mac address, length or header), , integer 0 255.

issue
why 13th array element causing packets no longer transmitted?

packet[12] , packet[13] contain used ethertype, example, ip 0x0800.

see here , here list of ethertype numbers.

which doesn't make sense. according documentation, array element part of payload (ie: no longer mac address, length or header), , integer 0 255.

it doesn't seem that:

pcap_sendpacket() takes arguments buffer containing data send, length of buffer , adapter send it. notice buffer sent net is, without manipulation. means application has create correct protocol headers in order send meaningful.

so need assemble full packet yourself, including ip-header, tcp-header, checksums etc.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -