shared: add nm_ip_addr_is_null() helper

This commit is contained in:
Thomas Haller 2019-03-14 11:16:19 +01:00
parent ccf59be7f5
commit 0ccb25c5fa

View file

@ -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)
{