3.2.4.60 R_DhcpAddSubnetElementV6 (Opnum 59)

The R_DhcpAddSubnetElementV6 method adds an IPv6 prefix element (such as IPv6 reservation or IPv6 exclusion range) to the IPv6 prefix in the DHCPv6 server.

 DWORD R_DhcpAddSubnetElementV6(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DHCP_IPV6_ADDRESS SubnetAddress,
   [in, ref] LPDHCP_SUBNET_ELEMENT_DATA_V6 AddElementInfo
 );

ServerIpAddress: The IP address/host name of the DHCP server. This parameter is unused.

SubnetAddress: This is of type DHCP_IPV6_ADDRESS (section 2.2.1.2.28) that contains the IPv6 address of the subnet for which the IPv6 prefix element is added.

AddElementInfo: This is a pointer to structure DHCP_SUBNET_ELEMENT_DATA_V6 (section 2.2.1.2.60) that contains the IPv6 prefix element that needs to be added to the IPv6 prefix.

Return Values: A 32-bit unsigned integer value that indicates return status. A return value ERROR_SUCCESS (0x00000000) indicates that the operation was completed successfully, else it contains a Win32 error code, as specified in [MS-ERREF]. This error code value can correspond to a DHCP-specific failure, which takes a value between 20000 and 20099, or any generic failure.

Return value/code

Description

0x00000000

ERROR_SUCCESS

The call was successful.

0x00000057

ERROR_INVALID_PARAMETER

An invalid parameter is specified in the AddElementInfo parameter.

0x000007DE

ERROR_DUPLICATE_TAG

The specified exclusion range conflicts with existing exclusion ranges.

0x00004E2D

ERROR_DHCP_JET_ERROR

An error occurred while accessing the DHCP server database.

0x00004E36

ERROR_DHCP_RESERVEDIP_EXITS

An IPv6 reservation exists for one or both of the following:

The opnum field value for this method is 59.

When processing this call, the DHCP server MUST do the following:

  • Validate whether this method is authorized for read/write access per section 3.5.5. If not, return the error ERROR_ACCESS_DENIED.

  • If the AddElementInfo pointer is NULL, return ERROR_INVALID_PARAMETER.

  • Retrieve the DHCPv6Scope object corresponding to SubnetAddress from DHCPv6ScopeList of the DHCPv6 server in which the IPv6 prefix element needs to be added. If no DHCPv6Scope object corresponds to SubnetAddress, return ERROR_FILE_NOT_FOUND.

  • If ElementType is Dhcpv6ExcludedIpRanges and the exclusion range specified in AddElementInfo partially overlaps with any of the entries in DHCPv6Scope.DHCPv6ExclusionRangeList, return ERROR_DUPLICATE_TAG; else add the IPv6 exclusion range to DHCPv6ExclusionRangeList.

  • If ElementType is Dhcpv6ExcludedIpRanges and the start address is greater than the end address, add this entry to DHCPv6Scope.DHCPv6ExclusionRangeList. Note that IPv6 addresses can be leased out from this inverted range.

  • If ElementType is Dhcpv6ExcludedIpRanges and the specified exclusion range is outside of the subnet prefix specified in the SubnetAddress parameter, add this entry to DHCPv6Scope.DHCPv6ExclusionRangeList. This range will not exclude any IPv6 addresses on the DHCPv6 server.

  • If ElementType is set to Dhcpv6ReservedIps and there is no DHCPv6Reservation object in DHCPv6Scope.DHCPv6ReservationList that has a ReservedAddress equal to the ReservedIpAddress passed in AddElementInfo, and there is no entry in DHCPv6Scope.DHCPv6ClientInfoList corresponding to the DHCPv6 client-identifier and the interface identifier as specified in the reservation information, then create DHCPv6Reservation and DHCPv6ClientInfo objects corresponding to the information provided in AddElementInfo, and add them to DHCPv6ReservationList and DHCPv6ClientInfoList, respectively.<61>

  • If ElementType is set to Dhcpv6ReservedIps and there is a DHCPv6Reservation object in DHCPv6ReservationList for the IPv6 address or DHCPv6 client identifier, and an interface definition pair already exists for the reserved address specified in the reservation information, return ERROR_DHCP_RESERVEDIP_EXITS.<62>

  • If ElementType is Dhcpv6ReservedIps and there is already an entry in DHCPv6ClientInfoList for the DHCPv6 client identifier and the interface identifier with the same IPv6 address as specified in the reservation information, then add the IPv6 reservation to DHCPv6ReservationList and DHCPv6ClientInfoList as above. If there is an existing entry in DHCPv6ClientInfoList (which is of type DHCPv6ClientInfo) for the DHCPv6 client identifier and the interface, but with a different IPv6 address, and a corresponding entry in DHCPv6ReservationList (which is of type DHCPv6Reservation) also exists for the client, then return ERROR_DHCP_RESERVEDIP_EXITS. If there is an existing entry in DHCPv6ClientInfoList for the client with a different IPv6 address, but no corresponding entry in DHCPv6ReservationList exists, remove the existing entry from DHCPv6ClientInfoList, create a new DHCPv6ClientInfo object from the data in AddElementInfo, and add it to DHCPv6ClientInfoList. Also add a corresponding entry in DHCPv6ReservationList.<63>

  • If the ElementType is Dhcpv6ReservedIps and there is already an entry in DHCPv6ClientInfoList for the IPv6 address specified in the reservation information but the DHCPv6 client-identifier and interface identifier are different, then delete this entry, create a new DHCPv6ClientInfo object, and add it to DHCPv6ClientInfoList. Also add a corresponding DHCPv6Reservation entry to DHCPv6ReservationList.<64>

  • If ElementType is Dhcpv6ReservedIps and the specified reservation address is outside the subnet prefix specified in the SubnetAddress parameter, then create a new DHCPv6Reservation object from the information in AddElementInfo, and add it to DHCPv6ReservationList.This reservation does not cause the specified IPv6 address to be leased out to the DHCPv6 client that is specified by the DHCPv6 client-identifier (section 2.2.1.2.5.3) and the interface identifier (section 2.2.1.2.58) in the reservation.

  • If ElementType is set to Dhcpv6IpRanges, do no processing and return ERROR_SUCCESS.

Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying RPC protocol [MS-RPCE].