RtnInstallStaticRoute

RtnInstallStaticRoute installs a static IPv4 or IPv6 route in RtxTcpIp stack’s forwarding database.

Syntax

int RtnInstallStaticRoute(
    void *ndptr,
    const char *pTarget,
    int prefixLen,
    const char *pNextHop
);

Parameters

ndptr

Network Device Pointer. Opaque network device identifier (pointer).

pTarget

String representation of target IPv4 or IPv6 address.

prefixLen

The prefix length (length of the IP mask) for the destination route.  Must be less than or equal to 32 for IPv4 route or less than or equal to 128 for IPv6 route.

pNextHop

String representation of next-hop router (gateway) for the route. May be NULL if the route is on-link(local). If there is no next-hop router because the route is reachable directly from an interface set this value to be NULL.

Return Value

0 (zero) if the function succeeds, a non-zero value if the function fails.

Remarks

To add an IPv6 route when the destination is off-link so that there is an IPv6 next-hop router, it is best to use the IPv6 link-local address of the next-hop router. Anytime the target or next-hop is link local IPv6 address you MUST specify the scope ID which is part of IPv6 textual IP address. The scope ID as an integer, or as the name of Real Time Network Device (RTND), can be provided by appending a % sign to the end of the address followed by the scope ID or interface name.

Requirements

Minimum Supported Version RTX64 2013
Header rtnapi.h
Library RtTcpip.lib