I have one IP packet, which includes IGMP packet. I want to simulate this using RAW socket programming. the checksum field of IP packet is e1c9, now how to assign this value in programming. I tried iphdr->iph_chksum="e1c9";
also iphdr->iph_chksum=57801;
is the above thing right?
it is not working properly, please tell me the exact way?
The C syntax for hexadecimal values is 0xe1c9
in this case. you should however ensure that you are using the correct byte order, you will probably need to pass the value through htons
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.