Re: netmask access from a c program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Vardhan,

Your inquiry is off topic for this forum.

You may be able to use these commands:
ping -c 1 -t 1 -M mask <ipaddr>
ping -c 1 -t 1 -R <ipaddr>

The ping command uses the ICMP (RFC 792).  ICMP stands for "Internet Control
Message Protocol".

You can either shell out to the command line and use ping directly, or
create your own ICMP API.

The first will send a ICMP_MASKREQ to the remote IP address.  If the remote
IP address is configured to respond to a ping, and is configured to respond
to ICMP_MASKREQ, you should get back what you want.

The second will get the routing information.

The only use for querying for the netmask that I can imagine is for auditing
purposes.  (Diagnostic purposes wouldn't be useful, because if it is not set
up right, you probably can't ping it.)

I recommend the "TCP/IP Illustrated" books by (the late, and much missed)
Dr. Richard Stevens:
http://www.amazon.com/dp/0201633469/
http://www.amazon.com/dp/020163354X/
http://www.amazon.com/dp/0201634953/

I don't have my books on hand to confirm that the ICMP / ping details are in
there.  But I'd be surprised if they weren't.

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux