Programming Guidelines on Transition to Ipv6
Total Page:16
File Type:pdf, Size:1020Kb
Programming guidelines on transition to IPv6 Tomás P. de Miguel and Eva M. Castro [email protected] [email protected] Department of Telematic Systems Engineering (DIT) Technical University of Madrid (UPM) Systems and Communications Group (GSyC) Experimental Sciences and Technology Department (ESCET) Rey Juan Carlos University (URJC) January 2003, v14 Programming Guidelines on Transition to IPv6 Acknowledgements This research has been supported by LONG (Laboratories Over Next Generation networks) project, IST-1999-20393. We would like to thanks Latif Ladid and Jim Bound for their support and encouragement. Thanks to the people who made suggestions and provided feedback to this document specially Jordi Palet, which improve the accuracy and presentation of the text. 2 / 2 Programming Guidelines on Transition to IPv6 PROGRAMMING GUIDELINES ON TRANSITION TO IPV6 .................................................. 1 ACKNOWLEDGEMENTS .................................................................................................... 2 FIGURES............................................................................................................................ 4 TABLES ............................................................................................................................. 4 1. INTRODUCTION ........................................................................................................ 5 2. TRANSITION TO IPV6 WITHOUT CHANGING APPLICATIONS ................................... 6 3. TRANSITION SCENARIOS .......................................................................................... 8 4. PORTING APPLICATIONS ........................................................................................ 11 4.1 ANALYZING EXISTING PROGRAMS ................................................................... 11 4.1.1 Application transport module................................................................. 12 4.1.2 Other application modules with IP address dependencies..................... 13 4.2 IPV4/IPV6 INTEROPERABILITY ........................................................................ 17 4.2.1 IPv6/IPv4 clients connecting to an IPv4 server at IPv4-only node........ 17 4.2.2 IPv6/IPv4 clients connecting to an IPv6 server at IPv6-only node........ 18 4.2.3 IPv6/IPv4 clients connecting to an IPv4 server at dual stack node ....... 19 4.2.4 IPv6/IPv4 clients connecting to an IPv6 server at dual stack node ....... 20 4.2.5 IPv4/IPv6 clients connecting to an IPv4-only server and IPv6-only server at dual stack node........................................................................................ 21 4.2.6 Client/server and network type interoperability..................................... 21 4.3 PORTING SOURCE CODE .................................................................................. 22 4.3.1 Socket Address Structures ...................................................................... 23 4.3.2 Socket functions ...................................................................................... 24 4.3.3 Required modifications when porting to IPv6........................................ 25 4.3.4 Address conversion functions ................................................................. 28 4.3.5 Resolving names ..................................................................................... 30 4.3.6 Multicasting............................................................................................ 32 5. GUIDELINES ON DEVELOPING NEW APPLICATIONS ............................................... 35 6. CONCLUSIONS ........................................................................................................ 37 7. BIBLIOGRAPHY....................................................................................................... 40 8. APPENDIX: EXAMPLES OF REAL PORTING PROCESS ............................................. 41 8.1 ORIGINAL DAYTIME VERSION .......................................................................... 41 8.1.1 IPv4 Daytime server (TCP/UDP)........................................................... 41 8.1.2 IPv4 Daytime client (TCP/UDP)............................................................ 46 8.2 THE UNICAST DAYTIME PORTED TO IPV6......................................................... 50 8.2.1 Daytime server (TCP/UDP) ................................................................... 50 8.2.2 Example: Daytime client (TCP/UDP). ................................................... 55 8.3 THE MULTICAST DAYTIME ............................................................................... 59 3 / 3 Programming Guidelines on Transition to IPv6 Figures FIGURE 1: APPLICATION INTERFACE TRANSLATORS......................................................................................6 FIGURE 2: TRANSITION SCENARIOS...............................................................................................................9 FIGURE 3: APPLICATIONS PROTOCOL INDEPENDENT OF IPV4 OR IPV6........................................................13 FIGURE 4: TRANSFER UNIT (TU) SIZE PROBLEM IF NOT PMTU-D IMPLEMENTED. .....................................16 FIGURE 5: IPV4/IPV6 CLIENTS CONNECTING TO AN IPV4 SERVER AT IPV4-ONLY NODE. ............................18 FIGURE 6: IPV4/IPV6 CLIENTS CONNECTING TO AN IPV6 SERVER AT IPV6-ONLY NODE. ............................19 FIGURE 7: IPV4/IPV6 CLIENTS CONNECTING TO AN IPV4 SERVER AT DUAL STACK NODE. ..........................20 FIGURE 8: IPV4/IPV6 CLIENTS CONNECTING TO AN IPV6 SERVER AT DUAL STACK NODE. ..........................20 FIGURE 9: IPV4/IPV6 CLIENTS CONNECTING TO AN IPV4-ONLY SERVER AND IPV6-ONLY SERVER AT DUAL STACK NODE. .....................................................................................................................................21 Tables TABLE 1: SPECIAL ADDRESSES....................................................................................................................14 TABLE 2: CLIENT SERVER AND NETWORK TYPE COMBINATIONS. ................................................................21 TABLE 3: MACROS FOR TESTING TYPE OF ADDRESSES.................................................................................32 TABLE 4: MULTICAST SOCKET OPTIONS......................................................................................................32 TABLE 5: IPV4 OR IPV6 ACTIVATION..........................................................................................................36 4 / 4 Programming Guidelines on Transition to IPv6 1. Introduction The transition between today’s IPv4 Internet and the future IPv6-based one will be a long process during which both protocol versions will coexist. Moving from IPv4 to IPv6 is not straightforward and guidelines to simplify transition between the two versions have to be standardised. Network transition has been discussed in detail; however applications should be reviewed to complete the porting process. Existing applications are written assuming IPv4. Only very recently IPv6 has been taken into account. Unless most of basic distributed applications are available now; there is too much work to do yet. The aim of this paper is to provide general recommendations to be taken into account during the porting process of applications and services to IPv6. This will allow developers to move smoothly their applications into the new environment. The document is divided in three parts. The first analyzes in which conditions is possible the transition to IPv6 without changing applications. This chapter includes recommendations on how to proceed when source code is not available and explains which mechanisms can be used. The second is the main document part. It starts describing IPv6 transition scenarios from the application point of view. The paper is focused on analyzing existing applications looking for characteristics, which usually should be reviewed during transition to IPv6. It includes a brief description of basic socket interface extensions for IPv6, fully described in RFC2553 [BISE]. The paper concludes providing general recommendations for new IPv6 applications. In the future all IPv4 networks will be IPv6; however during a long period mixed scenarios with both IPv4 and IPv6 will be the real environments. Therefore, new applications should be designed to work only in a pure IPv6 environment, but a design to allow mixed IPv4 and IPv6 environment is better now. The document includes some examples of code porting process, used to illustrate the required changes in the client and server components. Porting guidelines are valid for any programming language, however for simplicity, application examples are provided only in C language. All these examples have been tested in a SuSE Linux 7.3 distribution, kernel version 2.4.10. The LONG Project has revised detailed rules and socket interface description for other popular programming languages [LD31]. 5 / 5 Programming Guidelines on Transition to IPv6 2. Transition to IPv6 without changing applications Many methodologies have been studied to support transition to IPv6 depending on initial network architectures. To make IPv6 network available to the user it’s necessary to provide a great number of IPv6 applications. Although, existing applications are written assuming IPv4, it isn’t desirable to wait until all necessary applications will be ready to start network transition. The simple approach during initial transition stages is to use IPv4 applications over the new