tf6AddDefaultGateway
Table of Contents >> IPv6 Programmer's Reference
#include <trsocket.h> |
int tf6AddDefaultGateway | ( |
ttUserInterface interfaceHandle, | |
const struct sockaddr_storage TM_FAR * gwyIpAddrPtr, | |
int flags | |
); |
Function Description
This function is used to create an IPv6 default gateway. This sets the IPv6 router as the default gateway for all IPv6-capable interfaces or for a given interface when using Strong End System Model. The route created by this function is used to reach the default gateway and operates as the IPv6 default route. When a packet is sent and no route specifically matches the destination, this default route is used to deliver the content.
Parameters
- interfaceHandle
- This is the interface handle which identifies the network where the IPv6 default router resides.
- gwyIpAddrPtr
- This is the default gateway's IPv6 address. This memory is used to hold this information and must be allocated by the caller (i.e. reside in the caller's address space).
- flags
- If TM_6_GWY_NOT_TEMPORARY is set, then the static default gateway is permanent. If this flag is not set, the default gateway will be replaced by a gateway discovered in a router advertisement.
Returns
- TM_ENOERROR
- Success.
- TM_EINVAL
- This indicates failure. The kernel found invalid arguments in the call.
- TM_EAFNOSUPPORT
- This indicates failure due to malformed content within gwyIpAddrPtr. This can happen when the address is not an IPv6-formatted address (gwIpAddrPtr->addrFamily != AF_INET6 for example) or if the IPv6 address is an IPv4 mapped address.
- TM_EHOSTUNREACH
- This indicates failure because the default gateway cannot be reached.
- TM_EALREADY
- This indicates that another default gateway has been previously added.