TCP/IP Programming Manual
Comparing IP Addresses
If your application compares IP addresses or tests IP addresses for equality, the in6_addr structure
changes you made in Making Structure Changes (page 54) change the comparison of int quantities
to a comparison of structures. This modification breaks the code and causes compiler errors.
Make either of the following changes to your application, as needed:
AF_INET6 CodeAF_INET Code
(memcmp(addr1, addr2, sizeof(struct in6_addr)) == 0)(addr1->s_addr == addr2->s_addr)
Change the equality expression to one that uses the memcmp (memory comparison) function.
AF_INET6 CodeAF_INET Code
IN6_ARE_ADDR_EQUAL(addr1, addr2)(addr1->s_addr == addr2->s_addr)
Change the equality expression to one that uses the IN6_ARE_ADDR_EQUAL macro. See
Address-Testing Macros (page 52) for a list of IPv6 address testing macros.
Comparing an IP Address to the Wild Card Address
If your application compares an IP address to the wild card address, the in6_addr structure
changes you made in Making Structure Changes (page 54) change the comparison of int quantities
to a comparison of structures. This modification breaks the code and cause compiler errors.
Make either of the following changes to your application, as needed:
AF_INET6 CodeAF_INET Code
IN6_IS_ADDR_UNSPECIFIED(addr)(addr->s_addr == INADDR_ANY)
Change the equality expression to one that uses the IN6_IS_ADDR_UNSPECIFIED macro. See
Address-Testing Macros (page 52) for a list of IPv6 address testing macros.
AF_INET6 CodeAF_INET Code
(memcmp(addr, in6addr_any, sizeof(struct in6_addr)) == 0)(addr->s_addr == INADDR_ANY)
Change the equality expression to one that uses the memcmp (memory comparison) function.
Using int Data Types to Hold IP Addresses
If your application uses int data types to hold IP addresses, the in6_addr structure changes you
made in Making Structure Changes (page 54) changes the assignment. This modification breaks
the code and causes compiler errors.
Make the following changes to your application, as needed:
AF_INET6 CodeAF_INET Code
struct in6_addr foostruct in_addr foo;
struct in6_addr bar;int bar;
..
..
..
bar = foo;bar = foo.s_addr;
1. Change the data type for bar from int to a struct in6_addr.
2. Change the assignment statement for bar to remove the s_addr field reference.
58 Porting and Developing IPv6 Applications (NonStop TCP/IPv6 and CIP Only)