Generic Support Calls
5-4
Add Static Gateway Route to the Route Table
NtAddStaticGateway
Syntax
HANDLE NtAddStaticGateway( IPN IPDestAddr, IPN IPDestMask, IPN IPGa-
teAddr );
Parameter(s)
IPDestAddr
IP address of destination (in network format)
IPDestMask
IP subnet mask of destination (in network format)
IPGateAddr
IP address of next hop gateway (in network format)
Return Value
Handle to newly created route or NULL on error.
Description
This function adds a static gateway route to the system route table.
IPDestAddr is the IP base address of the IP network of the network that is
made accessible via the IP gateway. This value should be pre-masked with the
IPDestMask so that:
(IPDestAddr & IPDestMask) = IPDestMask
This is used as a sanity check by the system. For a default route, the value is
zero.
IPDestMask is the mask of the IP network accessible by the IP gateway. For
a host route the value is 0xFFFFFFFF, while for a default route, the value is
zero.
IPGateAddr is the IP address of the gateway though which the specified IP net-
work is accessible. It must be an IP address that is available on a locally con-
nected network. I.e.: one gateway can not point to another.
The function returns a handle to the route created by this configuration entry.
All routes are represented as route handles internally to the stack. This is dis-
cussed further in the appendices at the end of this document. Note that the
handle returned here is not referenced (see the appendix for more details). All
it means the purposes of this function is that the handle can be discarded by
the caller. It will remain valid until the route is removed via NtRemoveStatic-
Gateway().
Note: In place of this function, the caller should consider using the con-
figuration system with the CFGTAG_ROUTE configuration entry (see
section 4.4.5).