mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 22:20:19 +01:00
glib-aux: add nm_ip_addr_from_packed_array() helper
This commit is contained in:
parent
0abc14b3a0
commit
82cd0a8689
1 changed files with 8 additions and 0 deletions
|
|
@ -290,6 +290,14 @@ nm_ip4_addr_is_localhost(in_addr_t addr4)
|
|||
return (addr4 & htonl(0xFF000000u)) == htonl(0x7F000000u);
|
||||
}
|
||||
|
||||
static inline gconstpointer
|
||||
nm_ip_addr_from_packed_array(int addr_family, gconstpointer ipaddr_arr, gsize idx)
|
||||
{
|
||||
return NM_IS_IPv4(addr_family)
|
||||
? ((gconstpointer) & (((const struct in_addr *) ipaddr_arr)[idx]))
|
||||
: ((gconstpointer) & (((const struct in6_addr *) ipaddr_arr)[idx]));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct ether_addr;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue