HPlogo HP-UX IPv6 Porting Guide: HP-UX 11i v2 September 2004

Chapter 14 Verifying IPv6 Installation

» 

Technical documentation

Complete book in PDF

 » Table of Contents

The following code fragment shows how an application can determine programmatically whether IPv6 is implemented on HP-UX. An application can check the existence of the /dev/ip6 device file at compile-time and/or run-time to determine whether IPv6 APIs and the IPv6 stack are on the system. If /dev/ip6 does not exist, an application continues to use IPv4 APIs.

if ((fd = open("dev/ip6", O_RDWR)) == -1)
/*
* /dev/ip6 failed to open., Therefore the IPv6 product
*is not installed on the system. An application should use the
* existing IPv4 code.
*/

...

else
/*
* dev/ip6 exists, so the IPv6 product is probably installed.
* IPv6 APIs can handle both IPv4 and IPv6 traffic */
NOTE: Starting with HP-UX 11i v2, IPv6 is automatically included in HP-UX.
© 2004 Hewlett-Packard Development Company, L.P.