120 likes | 818 Views
IPv4 and IPv6 Interoperability. IPv4 client, IPv6 server over dual-stack server host IPv6 client over dual-stack client host, IPv4 server IPv6 address macro, function and option Source code portability. IPv4 Client, IPv6 Server over Dual-Stack Server Host. IPv4 client TCP IPv4 data
E N D
IPv4 and IPv6 Interoperability • IPv4 client, IPv6 server over dual-stack server host • IPv6 client over dual-stack client host, IPv4 server • IPv6 address macro, function and option • Source code portability
IPv4 Client, IPv6 Server over Dual-Stack Server Host IPv4 client TCP IPv4 data link IPv6 server TCP IPv4 IPv6 data link IPv6 client TCP IPv6 data link IPv6 listening socket bounded to 0::0, port 8888 IPv4-mapped IPv6 address IPv6 address 5f1b:df00:ce3e:e200: 20:800:2b37:6426 206.62.226.43 Ether IPv4 TCP TCP hdr hdr hdr data type dport 8000 8888 Ether IPv6 TCP TCP hdr hdr hdr data type dport 86dd 8888
Dual-Stack Kernel at Server Side AF_INET SOCK_STREAM sockaddr_in AF_INET SOCK_DGRAM sockaddr_in IPv4 sockets AF_INET6 SOCK_STREAM sockaddr_in6 AF_INET6 SOCK_DGRAM sockaddr_in6 IPv6 sockets TCP UDP IPv4 IPv6 IPv6 IPv4 address returned by accept or recvfrom IPv4- mapped IPv4- mapped IPv6 IPv4 IPv6 datagram IPv4 datagram
Dual-Stack Kernel at Client Side AF_INET SOCK_STREAM sockaddr_in AF_INET SOCK_DGRAM sockaddr_in IPv4 sockets AF_INET6 SOCK_STREAM sockaddr_in6 AF_INET6 SOCK_DGRAM sockaddr_in6 IPv6 sockets TCP UDP IPv4 IPv6 IPv6 IPv4 address for connect or sendto IPv4- mapped IPv4- mapped IPv6 IPv4 IPv6 datagram IPv4 datagram
Interoperability between IPv4 and IPv6 Clients and Servers IPv4 server IPv6 server IPv4 server IPv6 server IPv4-only host IPv6-only host dual-stack host dual-stack host (A only) (AAAA only) (A and AAAA) (A and AAAA) IPv4 client, IPv4 (no) IPv4 IPv4 IPv4-only host IPv6 client, (no) IPv6 (no) IPv6 IPv6-only host IPv4 client, IPv4 (no) IPv4 IPv4 dual-stack host IPv6 client, IPv4 IPv6 (no*) IPv6 dual-stack host *: IPv4-mapped IPv6 address if client chooses A record; no if client chooses AAAA record Note that most implementations of IPv6 client/server will be on dual-stack hosts. (Second row and second column may disappear.)
IPv6 Address Macro, Function, Option • IPv6 address testing macros: • IN6_IS_ADDR_* (e.g. V4MAPPED) • Protocol independent socket address functions: • sock_* (e.g. cmp_addr) (section 3.8) • IPv6_ADDRFORM socket option: • change a socket type between IPv4 and IPv6, by setsockopt function with IPv6_ADDRFORM option
Source Code Portability • Automatic program conversion from IPv4 to IPv6 (sockaddr_in, AF_INET, etc) and #ifdef to use IPv6 when possible • Deal with socket address structures as opaque objects: • remove gethostbyname and gethostbyaddr, use getaddrinfo and getnameinfo (which use #ifdef internally)