次の方法で共有


SetIpInterfaceEntry (NETIOAPI) (Compact 2013)

3/26/2014

This function sets the properties of an IP interface on a local device.

Syntax

NETIOAPI_API
  SetIpInterfaceEntry(
    IN OUT PMIB_IPINTERFACE_ROW  Row
    );

Parameters

  • Row
    A pointer to a MIB_IPINTERFACE_ROW structure entry for an interface. On input, your driver must set the Family member of the MIB_IPINTERFACE_ROW to AF_INET6 or AF_INET and your driver must specify the InterfaceLuid member or the InterfaceIndex member of MIB_IPINTERFACE_ROW. On a successful return, the InterfaceLuid member of the MIB_IPINTERFACE_ROW is filled in if the InterfaceIndex member of the MIB_IPINTERFACE_ROW entry was specified.

Return Value

Error Code

Meaning

STATUS_SUCCESS

The function succeeds.

STATUS_INVALID_PARAMETER

An invalid parameter was passed to the function. This error is returned if a NULL pointer is passed in the Row parameter, the Family member of the MIB_IPINTERFACE_ROW structure that the Row parameter points to was not specified as AF_INET or AF_INET6, or both InterfaceLuid and InterfaceIndex members of the MIB_IPINTERFACE_ROW structure were unspecified.

STATUS_NOT_FOUND

The specified interface could not be found. This error is returned if the function cannot find the network interface that is specified by the InterfaceLuid or InterfaceIndex member of the MIB_IPINTERFACE_ROW structure that the Row parameter points to.

Other

Use the FormatMessage function to obtain the message string for the returned error.

Remarks

Your driver must use the InitializeIpInterfaceEntry function to initialize the fields of a MIB_IPINTERFACE_ROW structure entry with default values. A driver can then change the fields in the MIB_IPINTERFACE_ROW entry that it wants to modify, and then call the SetIpInterfaceEntry function.

On input, your driver must initialize the following members of the MIB_IPINTERFACE_ROW structure that the Row parameter points to.

  • Family
    Set to either AF_INET or AF_INET6.
  • InterfaceLuid or InterfaceIndex
    These members are used in the order that is listed earlier. So if InterfaceLuid is specified, this member is used to determine the interface. If no value was set for the InterfaceLuid member (the value of this member was set to zero), the InterfaceIndex member is next used to determine the interface.

On output, the InterfaceLuid member of the MIB_IPINTERFACE_ROW structure that the Row parameter points to is filled in if the InterfaceIndex was specified.

SetIpInterfaceEntry ignores the MaxReassemblySize, MinRouterAdvertisementInterval, MaxRouterAdvertisementInterval , Connected, SupportsWakeUpPatterns, SupportsNeighborDiscovery, SupportsRouterDiscovery, ReachableTime, TransmitOffload, and ReceiveOffload members of the MIB_IPINTERFACE_ROW structure that the Row parameter points to. These members are set by the network stack and cannot be changed by using the SetIpInterfaceEntry function.

On later versions of the Windows operating systems, by default, a strong host model is used. If a source IP address is specified in the route lookup by using the GetBestRoute2 (NETIOAPI) function, the route lookup is restricted to the interface of the source IP address. The route metric modification by RAS has no effect because the list of potential routes does not even have the route for the VPN interface. This enables traffic to the Internet. Your driver can use the DisableDefaultRoutes member of the MIB_IPINTERFACE_ROW structure to disable by using the default route on an interface. VPN clients can use this member as a security measure to restrict split tunnelling when split tunneling is not required by the VPN client. A VPN client can call the SetIpInterfaceEntry function to set the DisableDefaultRoutes member to TRUE when it is required. A VPN client can query the current state of the DisableDefaultRoutes member by calling the GetIpInterfaceEntry (NETIOAPI) function.

See Also

Reference

IP Helper Kernel-Mode Functions
GetBestRoute2 (NETIOAPI)
GetIfEntry2 (NETIOAPI)
GetIfTable2 (NETIOAPI)
GetIfTable2Ex (NETIOAPI)
GetIpInterfaceEntry (NETIOAPI)
GetIpInterfaceTable (NETIOAPI)
InitializeIpInterfaceEntry (NETIOAPI)
MIB_IF_ROW2
MIB_IF_TABLE2
MIB_IPINTERFACE_ROW
MIB_IPINTERFACE_TABLE
NotifyIpInterfaceChange (NETIOAPI)