<div class="content" name="R_DhcpCreateSubnetV6" uuid="a212532a-d084-489e-b0a1-ee5682af2cb0"><p>The <b>R_DhcpCreateSubnetV6</b> method creates a new IPv6
prefix on the DHCPv6 server.</p><dl>
<dd>
<div><pre> DWORD R_DhcpCreateSubnetV6(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DHCP_IPV6_ADDRESS SubnetAddress,
   [in, ref] LPDHCP_SUBNET_INFO_V6 SubnetInfo
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the DHCP server. This parameter is unused.</p><p><b>SubnetAddress: </b>A pointer of type <a href="48b74c46-bf64-40db-92b9-6e61cee1bd33" data-linktype="relative-path">DHCP_IPV6_ADDRESS (section 2.2.1.2.28)</a>
that contains the IPv6 address of the subnet.</p><p><b>SubnetInfo: </b>A pointer to a structure of type <a href="9c609d1d-6ed0-40f6-bb2c-5228a8da03ea" data-linktype="relative-path">DHCP_SUBNET_INFO_V6 (section 2.2.1.2.56)</a>
that contains information about the IPv6 prefix to be added to the DHCPv6
server. The <b>Prefix</b> field is not stored in the database; any value
specified for this field does not alter the behavior of this method.</p><p><b>Return Values: </b>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 <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.
This error code value can correspond to a DHCP-specific failure, which takes a
value between 20000 and 20099, or any generic failure.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000 ERROR_SUCCESS</td>
  <td>The call was successful.</td>
 </tr><tr>
  <td>0x00004E2D ERROR_DHCP_JET_ERROR</td>
  <td>An error occurred while accessing the DHCP server database.</td>
 </tr><tr>
  <td>0x00004E7B ERROR_DHCP_INVALID_SUBNET_PREFIX</td>
  <td>The subnet prefix is invalid.</td>
 </tr></tbody></table>
</dd></dl><p>The opnum field value for this method is 57.</p><p>When processing this call, the DHCP server MUST do the
following:</p><ul><li><p><span><span> 
</span></span>Validate if this method is authorized for read/write access per
section <a href="38840bd0-0a5a-47ed-bc69-0dd870d33aec" data-linktype="relative-path">3.5.5</a>. If not,
return the error ERROR_ACCESS_DENIED.</p>
</li><li><p><span><span> 
</span></span>If the <b>SubnetInfo</b> input parameter is NULL, return
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>Validate that the subnet prefix specified in <b>SubnetAddress</b>
is not a <a href="a9d6a415-4de6-4058-befe-ca2e42764485#gt_e2c2c73e-9b5f-48ea-8902-41819735ca31" data-linktype="relative-path">unicast address</a>
and that the scope level is not link-local; otherwise, return
ERROR_DHCP_INVALID_SUBNET_PREFIX.<a id="Appendix_A_Target_60"></a><a aria-label="Product behavior note 60" href="afab0546-79ae-4764-8dab-27a85cca5145#Appendix_A_60" data-linktype="relative-path">&lt;60&gt;</a></p>
</li><li><p><span><span> 
</span></span>If the subnet prefix specified in <b>SubnetAddress</b> is already
configured on the DHCPv6 server, return ERROR_DUPLICATE_TAG.</p>
</li><li><p><span><span> 
</span></span>Create a <b>DHCPv6Scope</b> object and initialize the <b>DHCPv6Scope.SubnetInfoV6</b>
object with the information contained in <b>SubnetInfo</b>. Initialize <b>DHCPv6Scope.DHCPv6ExclusionRangeList</b>,
<b>DHCPv6Scope.DHCPv6ReservationList</b>, <b>DHCPv6Scope.DHCPv6ClientInfoList</b>,
and <b>DHCPv6Scope.DHCPv6ScopeOptionList</b> objects as empty lists. Add this <b>DHCPv6Scope</b>
object to <b>DHCPv6ScopeList</b> in sorted order of the <b>SubnetAddress</b>
field of the <b>DHCPv6Scope.SubnetInfoV6</b> object. </p>
</li><li><p><span><span> 
</span></span>Return ERROR_SUCCESS.</p>
</li></ul><p><b>Exceptions Thrown:</b> No exceptions are thrown beyond
those thrown by the underlying RPC protocol <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>.</p></div>