wiki:MapGuideRfc118

Version 3 (modified by wuma, 13 years ago) ( diff )

--

MapGuide RFC 118 - Support IPv6

This page contains a change request (RFC) for the MapGuide Open Source project. More MapGuide RFCs can be found on the RFCs page.

Status

RFC Template Version(1.0)
Submission Date04 July 2011
Last Modified04 July 2011
AuthorMars Wu
RFC Statusdraft
Implementation Statuspending
Proposed Milestone2.3
Assigned PSC guide(s)Bruce Dechant
Voting History(vote date)
+1
+0
-0
-1
no vote

Overview

This RFC proposes a solution to make MGOS work with both IPv4 and IPv6.

Motivation

IPv6 is the trend of network. Supporting IPv6 will be a must-have for MGOS in the future.

Proposed Solution

To make MGOS support IPv6, couple things need be done:

  1. Enable IPv6 for ACE.

ACE supports both IPv4 and IPv6. But by default, ACE is compiled without IPv6 support. To change this, one compiler predriective should be defined:

#define ACE_HAS_IPV6

It should be defined in config.h so that it could be effective for both Windows and Linux

  1. Port the IP address validation logic.

There is existing logic to validate if the IP address specified in the configuration file is valid. But the logic always assumes the IP address is in v4 format. We need port the logic to consider both v4 format and v6 format. One example is like below in in \Common\MapGuideCommon\Util\IpUtil.cpp.

void MgIpUtil::ValidateAddress(CREFSTRING address, bool strict)
{
...

    if (STRING::npos != address.rfind(L':'))
    {
        MgStringCollection arguments;
        arguments.Add(L"1");
        arguments.Add(address);

        MgStringCollection whyArguments;
        whyArguments.Add(L":");

        throw new MgInvalidArgumentException(L"MgIpUtil.ValidateAddress",
            __LINE__, __WFILE__, &arguments,
            L"MgStringContainsReservedCharacters", &whyArguments);
    }
...
}

It treats the character ":" as invalid. But for IPv6, ":" is used as a splitter for the address segments.

  1. Make MapGuide Server listen to IPv6 address

When the service of MapGuide Server starts, it uses following code to listen to the client, site and admin ports: Server\src\Core\Server.cpp

ACE_INET_Addr clientAddr((u_short)pServerManager->GetClientPort));
ACE_INET_Addr adminAddr((u_short)pServerManager->GetAdminPort());
ACE_INET_Addr siteAddr((u_short)pServerManager->GetSitePort());

But this way it always listens to IPv4 address no matter if IPv6 is available. Then the 3 ACE_INET_Addr instances need be created by another constructor:

ACE_INET_Addr (u_short port_number,
               const wchar_t host_name[],
               int address_family = AF_UNSPEC);

by passing in an IPv6 address as host_name, MapGuide Server can listen to the IPv6 address instead of IPv4 address. But if the given host_name is a specific IP Address, the Client (Web Extension, Support Server, Admin etc.) has to connect to the Server through the given IP Address. E.g. if there is a computer whose IP Addresses are:

IPv4	127.0.0.1
	192.168.0.10
IPv6	::1
	fe80::9c4b:2cb5:5cda:5c3f%11

MapGuide Server should be able to be connected with either 127.0.0.1 or 192.168.0.10 for IPv4 and either ::1 or fe80::9c4b:2cb5:5cda:5c3f%11 for IPv6. But if we pass 127.0.0.1 as the host_name, MapGuide Server will NOT listen to 192.168.0.10. The same for IPv6. The solution is: we don’t pass in a specific IP Address, instead:

  • For IPv4, we pass in 0.0.0.0. Then it will listen to all IPv4 addresses.
  • For IPv6, we pass in ::. Then it will listen to all IPv6 address.

Implications

Test Plan

Funding / Resources

Autodesk supplied.

Note: See TracWiki for help on using the wiki.