Jump to: navigation, search

Table of Contents >> IPv6 Programmer's Reference

#include <trsocket.h>

int tfNgAddDefaultGatewayTunnel (
ttUserInterface interfaceHandle,
const struct sockaddr_storage * endpointIpAddrPtr,
const struct sockaddr_storage * srcIpAddrPtr
Conditional parameter. See details in Parameters below.

Function Description

This function only supports IPv6. This function is used to create a default gateway tunnel for running IPv6 over IPv4 A host that is on a link without any IPv6routers but which can reach an IPv6 router via the existing IPv4 routing infrastructure (i.e. the IPv6 router is reachable via an IPv4 address, specified by endpointIpAddrPtr) can use this API to set this IPv6 router as the default gateway for all IPv6- capable interfaces if TM_USE_STRONG_ESL is not defined, or for the specified interface otherwise. The configured tunnel created by this function is used to reach this default gateway (i.e. over IPv4), and operates as the IPv6 default route, meaning that it will only be used to route an IPv6 packet if there are no other routes that match the destination IP address of the packet.


  • interfaceHandle
    Interface ID as returned by tfAddInterface(). NOTE: This parameter is conditional and only present when TM_USE_STRONG_ESL is defined at compile time. For more information, please see Appendix C: Strong End System Model / Weak End System Model.
  • endpointIpAddrPtr
    Pointer to the tunnel end point IPv4 address, which is the IPv4 address of the IPv6 router. This memory is used to hold this information and must be allocated by the caller (i.e. reside in the caller's address space).
  • srcIpAddrPtr
    Pointer to the IPv6 source address for IPv6 tunneled traffic generated on this host.
  • flags
    If TM_6_GWY_NOT_TEMPORARY is not set, then the static default gateway tunnel will be replaced by a gateway discovered in a router advertisement.


    One of the parameters was invalid.
    This indicates failure due to malformed content within endpointIpAddrPtr, or srcIpAddrPtr. This can happen when endPointIpAddrPtr is not an IPv4- formatted address (endPointIpAddrPtr->addrFamily != AF_INET for example), or when srcIpAddrPtr is not an IPv6-formatted address (srcIpAddrPtr->addrFamily != AF_INET6 for example) or if the IPv6 address is an IPv4 mapped address.
    The tunnel endpoint was unreachable.
    A default gateway tunnel has already been configured.

Table of Contents >> IPv6 Programmer's Reference