Presentation is loading. Please wait.

Presentation is loading. Please wait.

IPv6 Technologies and Advanced Services page 1 Porting applications to IPv6 OpenH323 and IPv6 support K. Stamos Computer Engineer, University of Patras.

Similar presentations


Presentation on theme: "IPv6 Technologies and Advanced Services page 1 Porting applications to IPv6 OpenH323 and IPv6 support K. Stamos Computer Engineer, University of Patras."— Presentation transcript:

1 IPv6 Technologies and Advanced Services page 1 Porting applications to IPv6 OpenH323 and IPv6 support K. Stamos Computer Engineer, University of Patras Research Engineer, RU6/RACTI

2 IPv6 Technologies and Advanced Services page 2 Porting applications to IPv6 Contents — IPv6 changes at the way network applications are developed — socket API changes — Developing IP-independent applications — Activities on porting applications to IPv6 — Examples – case study (OpenH323)

3 IPv6 Technologies and Advanced Services page 3 Porting applications to IPv6 IPv4 - IPv6 Interoperability at dual stack machines IPv4 serverIPv6 server IPv4 client IPv4 communication IPv4 communication, server sees the IPv4- mapped IPv6 address IPv6 client May communicate if the IPv6 client uses an IPv4- mapped IPv6 address IPv6 communication

4 IPv6 Technologies and Advanced Services page 4 Porting applications to IPv6 Basic address differences — IPv4: —32 bits long —decimal —Comprise of 4 numbers in [0…255] —No short notation —Last subnet ΙΡ is the broadcast —Loopback — IPv6: —128 bits long —hexadecimal —Short notation (e.g. 3FFE:B00::1) —No broadcast addresses —Loopback ::1 —Several scopes (link-local, site-local, global)

5 IPv6 Technologies and Advanced Services page 5 Porting applications to IPv6 Basic socket usage — Server: —socket —bind —listen —accept —read/write/recvfrom/sendto… — Client —socket —connect —read/write/recvfrom/sendto… — Same basic procedure for both ΙΡ protocols

6 IPv6 Technologies and Advanced Services page 6 Porting applications to IPv6 socket API changes – IPv4 struct in_addr { unsigned int s_addr; /* IPv4 address */ }; struct sockaddr_in { sa_family_t sin_family; /* AF_INET */ in_port_t sin_port; /* Port */ struct in_addr sin_addr; /* Internet address */ /* Padding */ unsigned char sin_zero[sizeof (struct sockaddr) - sizeof (sa_family_t) - sizeof (in_port_t) - sizeof (struct in_addr)]; };

7 IPv6 Technologies and Advanced Services page 7 Porting applications to IPv6 socket API changes – IPv6 struct in6_addr { union { uint8_t u6_addr8[16]; uint16_t u6_addr16[8]; uint32_t u6_addr32[4]; } in6_u; }; struct sockaddr_in6 { sa_family_t sin6_family; /* AF_INET6 */ in_port_t sin6_port; /* Transport layer port # */ struct in6_addr sin6_addr; /* IPv6 address */ uint32_t sin6_flowinfo; /* IPv6 flow info */ uint32_t sin6_scope_id; /* IPv6 scope-id */ };

8 IPv6 Technologies and Advanced Services page 8 Porting applications to IPv6 ΙΡ independent structure Large enough to store any type of address, 128 bytes are reserved #if ULONG_MAX > 0xffffffff # define __ss_aligntype __uint64_t #else # define __ss_aligntype __uint32_t #endif #define _SS_SIZE 128 #define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype))) struct sockaddr_storage { sa_family_t ss_family; /* Protocol family */ __ss_aligntype __ss_align; /* Desired alignment */ char __ss_padding[_SS_PADSIZE]; };

9 IPv6 Technologies and Advanced Services page 9 Porting applications to IPv6 Backwards IPv4 compatibility — 2 separate source code versions, 2 executables (IPv4- only, IPv6-only) — 1 source code version, 2 executables (using macros to produce different executables at compilation) — 1 source code version, 1 IP-independent executable —Take appropriate action using run-time checks —Use IPv6 protocol, and support IPv4 interoperability with IPv4- mapped IPv6 addresses (will not work on IPv4-only machines)

10 IPv6 Technologies and Advanced Services page 10 Porting applications to IPv6 Main modifications — Change GUI where address is presented — Change data structures (sockaddr_in) — Change constants (INADDR_ANY, AF_INET, etc.) — Change functions (e.g. inet_ntoa, gethostbyname) — Hard-coded addresses — Comparing addresses (IPv6 are not single numbers) — Functions that take address parameters / return addresses — Replace / remove IPv4-specific options, e.g. TOS — RFC 2732 (URL addresses in [])

11 IPv6 Technologies and Advanced Services page 11 Porting applications to IPv6 Code changes — Create socket socket(PF_INET6, SOCK_STREAM, 0); /* TCP socket */ socket(PF_INET6, SOCK_DGRAM, 0); /* UDP socket */ — Passing socket to the kernel struct sockaddr_in6 addr; socklen_t addrlen = sizeof(addr); /* Fill addr struct with IPv6 address before calling bind */ bind(sockfd,(struct sockaddr *)&addr, addrlen); — Passing socket from the kernel to the application struct sockaddr_in6 addr; socklen_t addrlen = sizeof(addr); accept(sockfd,(struct sockaddr *)&addr, &addrlen); /* addr structure an IPv6 address */

12 IPv6 Technologies and Advanced Services page 12 Porting applications to IPv6 Address conversion functions /* IPv4 address conversion from printable to binary */ int inet_aton (const char *cp, struct in_addr *inp); in_addr_t inet_addr( const char *cp); /* IPv4 address conversion from binary to printable form */ char *inet_ntoa(struct in_addr in); /* IPv4/IPv6 address conversion from printable to binary */ int inet_pton(int family, const char *src, void *dst); /* IPv4/IPv6 address conversion from binary to printable form */ const char *inet_ntop(int family, const void *src, char *dst, size_t cnt); IPv4 IPv6

13 IPv6 Technologies and Advanced Services page 13 Porting applications to IPv6 Using DNS service struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ int ai_family; /* AF_UNSPEC, AF_INET, AF_INET6 */ int ai_socktype; /* SOCK_STREAM, SOCK_DGRAM... */ int ai_protocol; /* IPPROTO_IP, IPPROTO_IPV6 */ size_t ai_addrlen; /* ai_addr length */ struct sockaddr ai_addr; /* socket structure for the address */ char ai_canonname; /* cannonical name */ struct addrinfo ai_next; /* next addrinfo structure */ }; int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); void freeaddrinfo(struct addrinfo *res);

14 IPv6 Technologies and Advanced Services page 14 Porting applications to IPv6 Automated tools — Available for several platforms: —Checkv4 for Windows (Microsoft) —Socket Scrubber for Solaris (Sun) —IPv6 Porting Assistant for Tru64 Unix (Compaq) — Mainly suitable for C\C++ code — Useful for large source code bases — They are usually not sufficient

15 IPv6 Technologies and Advanced Services page 15 Porting applications to IPv6 Case Study – OpenH323 — Open-source project that aims at producing a library for implementing H.323 applications — OpenH323 library: rapid development of applications using the H.323 protocol, takes over low-level details and leaves high-level logic for the programmer — PWLib: open-source library, deals with providing basic functionalities of the operating system (sockets, threads, I/O, GUI etc.) —Supports multiple OS (Windows, Unix)

16 IPv6 Technologies and Advanced Services page 16 Porting applications to IPv6 OpenH323 structure — A total of about 400 classes and ~1/2Μ C++ lines of code — Porting and testing activities in the framework of 6NET

17 IPv6 Technologies and Advanced Services page 17 Porting applications to IPv6 Main obstacles — Implicit IPv4 references (e.g. loops, address comparisons7) — Linux-Windows IPv6 implementations compatibility problems — Windows experimental stack (Win 2000) does not fully support RFCs —in Windows XP most problems have been solved — Code size

18 IPv6 Technologies and Advanced Services page 18 Porting applications to IPv6 Completion verification — High-level testing — Low-level testing — Comparative (back-to-back) testing — IPv6 trials for OpenMCU / OpenPhone / GnomeMeeting

19 IPv6 Technologies and Advanced Services page 19 Porting applications to IPv6 Conclusions — Porting to IPv6 is a vital step in the adoption of the new Internet Protocol —The degree of effort required varies in each case — Large source code bases with a lot of low-level functions (like OpenH323) are amongst the most difficult — Further development of automated tools will be useful — Already, a very large number of applications are available for IPv6

20 IPv6 Technologies and Advanced Services page 20 Porting applications to IPv6 Thank you — Questions


Download ppt "IPv6 Technologies and Advanced Services page 1 Porting applications to IPv6 OpenH323 and IPv6 support K. Stamos Computer Engineer, University of Patras."

Similar presentations


Ads by Google