c - WinPcap: Discarded WiFi Packet -
consider winpcap tutorial sending single packet. start running it, relatively straightforward:
- copy , paste code ide c (in case code::blocks)
- add
#define have_remote
1st line - set build options (link libraries , directories)
- set proper mac addresses
- fill array data want send
- 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
Post a Comment