Operating System - HP-UX
1827295 Members
2970 Online
109717 Solutions
New Discussion

Re: Ping : Building IP Header using RAW Sockets

 
rahul_5
New Member

Ping : Building IP Header using RAW Sockets

Hi,

Operating System : HP-UX 10.20
Compiler : gcc 3.0.4
Language : C

I am making a sample Ping Program (sending ICMP ECHO Packets) on HP-UX 10.20. I am trying to change the source address by using RAW Sockets with IP_HDRINCL socket option. (i.e. making own IP Header and sending ICMP ECHO Packets with source address changed.)

On HP-UX I get the error of IP_HDRINCL and hence sendto(): Invalid Argument.

My Question is :

1. Is IP_HDRINCL option supported on HP-UX 10.20 ? Because I am not able to find its defination on my machine. If not, then how to create & use RAW Sockets?

2. How to make own IP Header and Build ICMP ECHO Packets using RAW Sockets ??

Is there anything other ways /options on HP-UX for making own IP Header using RAW Sockets ?

I had gone through R.Stevens - Unix Network Programming. My code works fine on Linux. But it fails on HP-UX (10.20) due to above reason.

I can send the code if required.
Please Comment.

Thanks for ur help.
Regards

Rahul
1 REPLY 1
Jeremy_7
Frequent Advisor

Re: Ping : Building IP Header using RAW Sockets

Please send the code. I think IP_HDRINCL is not supported in 10.2 but I think I may have a work around for you.