diff options
Diffstat (limited to 'src/iaddr.c')
-rw-r--r-- | src/iaddr.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/iaddr.c b/src/iaddr.c index 43f0b8f..bbe47be 100644 --- a/src/iaddr.c +++ b/src/iaddr.c @@ -66,3 +66,16 @@ int ia_equal(iaddr x, iaddr y) } return FALSE; } + +int ia_equalp(iaddr* x, iaddr* y) +{ + if (x->af != y->af) + return FALSE; + switch (x->af) { + case AF_INET: + return (x->u.a4.s_addr == y->u.a4.s_addr); + case AF_INET6: + return (memcmp(&x->u.a6.s6_addr, &y->u.a6.s6_addr, sizeof(x->u.a6.s6_addr)) == 0); + } + return FALSE; +} |