Networking_IpConfig_ReleaseIp Function

Header: #include <applibs/networking.h>

Releases the device dynamic IP address.

Note

Requires Azure Sphere OS version 22.02 or above.

int Networking_IpConfig_ReleaseIp(const char *networkInterfaceName);

Parameters

  • networkInterfaceName A pointer to the name of the network interface to update.

Errors

Returns -1 if an error is encountered and sets errno to the error value.

  • EACCES: the calling application doesn't have the NetworkConfig capability.

  • EFAULT: the networkInterfaceName parameter is NULL.

  • ENOENT: the network interface does not exist.

  • EPERM: the IP address cannot be released, such as in a static IP configuration.

Any other errno may also be specified; such errors aren't deterministic and the same behavior might not be retained through system updates.

Return value

Returns 0 for success, -1 for failure, in which case errno is set to the error value.

Remarks

If an IP had been acquired via DHCP, this API synchronously sends out the DHCP release message, but there is no guarantee that it is received. This API stops the DHCP protocol from attempting to acquire an IP address until Networking_IpConfig_RenewIp is called.

The application manifest must include the NetworkConfig capability.

Concepts and samples