[SOLVED] creating IP header using IP_HDRINCL option is not working
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
creating IP header using IP_HDRINCL option is not working
i wanted to send icmp packet with custom ip header so i wrote the following code but when i run the program nothing happens there is no packet in wireshark and there is no error from the program and i don't know what is happening
I have not had a chance to look at your code and have not recently done much socket programming, so no specific advice to offer.
It is always helpful to those offering help if you can tell us what you have done to troubleshoot it so far, and where you are getting stuck understanding what is happening. That helps others to more quickly understand the problem and will often lead you to a better understanding yourself, and sometimes lead to a solution!
I would suggest that you check each of those lib function calls and verify the args are valid and that you are correctly handling their return values. And add few temporary messages to show you the state of important values at various points, which should lead you to the point that something is failing or not as expected.
Yes I have solved the problem. I forgot to change the endianness while creating the header using htons() for fields having multiple bytes(ip_off,ip_len) worked
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.