WslcSetContainerSettingsNetworks¶
STDAPI WslcSetContainerSettingsNetworks(
_In_ WslcContainerSettings* containerSettings,
_In_reads_opt_(networkCount) const WslcContainerNetwork* networks,
_In_ uint32_t networkCount);
| Parameter | Type | Direction |
|---|---|---|
containerSettings |
WslcContainerSettings* |
in |
networks |
const WslcContainerNetwork* |
in, optional |
networkCount |
uint32_t |
in |
Return value: HRESULT. Returns E_INVALIDARG if networks and networkCount disagree on being empty, a network name is null or empty, or aliases and aliasCount disagree on being empty or an alias is null.
Notes:
- The first network is the primary network.
- Cannot be combined with WslcSetContainerSettingsNetworkingMode; WslcCreateContainer returns
E_INVALIDARGif both are set. - Aliases,
ipv4Addressandipv6Addressare only supported on user-defined networks (notbridge,host,none, orcontainer:<name>); WslcCreateContainer returnsE_INVALIDARGotherwise. - Each network can have its own
ipv4Addressandipv6Address. Set either toNULLto let the network assign one. Anipv6Addressrequires a network with IPv6 enabled. - The
networksarray and the strings and addresses it references are not copied and must stay valid untilWslcCreateContainerreturns. - Pass
NULLand0to clear.
Example:
PCSTR aliases[] = { "web" };
IN_ADDR backendIp = { 0 };
inet_pton(AF_INET, "10.0.1.10", &backendIp);
WslcContainerNetwork networks[2] = { 0 };
networks[0].name = "frontend";
networks[0].aliases = aliases;
networks[0].aliasCount = (uint32_t)_countof(aliases);
networks[1].name = "backend";
networks[1].ipv4Address = &backendIp;
HRESULT hr = WslcSetContainerSettingsNetworks(
&containerSettings,
networks,
(uint32_t)_countof(networks));