Commit fbfac8f8 authored by Thomas Haller's avatar Thomas Haller

shared: add nm_ip_addr_is_null() helper

parent f224d6a8
......@@ -126,6 +126,16 @@ typedef struct {
extern const NMIPAddr nm_ip_addr_zero;
static inline gboolean
nm_ip_addr_is_null (int addr_family, gconstpointer addr)
{
nm_assert (addr);
if (addr_family == AF_INET6)
return IN6_IS_ADDR_UNSPECIFIED ((const struct in6_addr *) addr);
nm_assert (addr_family == AF_INET);
return ((const struct in_addr *) addr)->s_addr == 0;
}
static inline void
nm_ip_addr_set (int addr_family, gpointer dst, gconstpointer src)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment