Networking_IpConfig_Apply Function

Header: #include <applibs/networking.h>

Applies an IP configuration to a network interface.

int Networking_IpConfig_Apply(const char *networkInterfaceName, const Networking_IpConfig *ipConfig);

Parameters

  • networkInterfaceName The name of the network interface to configure.

  • ipConfig A pointer to the Networking_IpConfig struct that contains the IP configuration to apply.

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.

  • ENOENT: the networkInterfaceName parameter refers to an interface that does not exist.

  • EPERM: this operation is not allowed on the network interface.

  • EFAULT: the networkInterfaceName or ipConfig parameter is NULL.

  • EAGAIN: the networking stack isn't ready yet.

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, or -1 for failure, in which case errno will be set to the error value.

Remarks

This function does not verify whether the static IP address is compatible with the dynamic IP addresses received through an interface using a DHCP client.

This function does not verify whether a DHCP server is available on the network and if a dynamic IP address is configured.

If overlapping IP address configurations are present on a device, the behavior of this function is undefined.

Application manifest requirements

The application manifest must include the NetworkConfig capability.

Concepts and samples