summaryrefslogtreecommitdiff
path: root/source4/lib/socket
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-06-07 12:55:09 +1000
committerAndrew Tridgell <tridge@samba.org>2011-06-07 12:55:37 +1000
commit3ccb72d7496aadbdf35b0aee3b2384466d9dd3b8 (patch)
treeddb94b23aebbbde3a4aea877380db7bac6c539de /source4/lib/socket
parent64380ff050c77b2b67c0fac4ada8650e834c4b4a (diff)
downloadsamba-3ccb72d7496aadbdf35b0aee3b2384466d9dd3b8.tar.gz
samba-3ccb72d7496aadbdf35b0aee3b2384466d9dd3b8.tar.bz2
samba-3ccb72d7496aadbdf35b0aee3b2384466d9dd3b8.zip
s4-ipv6: fixed iface_list_same_net() for IPv6
Diffstat (limited to 'source4/lib/socket')
-rw-r--r--source4/lib/socket/interface.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c
index 1bf1e4f62b..9cb8f5e611 100644
--- a/source4/lib/socket/interface.c
+++ b/source4/lib/socket/interface.c
@@ -481,9 +481,21 @@ bool iface_list_is_local(struct interface *ifaces, const char *dest)
*/
bool iface_list_same_net(const char *ip1, const char *ip2, const char *netmask)
{
- return same_net_v4(interpret_addr2(ip1),
- interpret_addr2(ip2),
- interpret_addr2(netmask));
+ struct sockaddr_storage ip1_ss, ip2_ss, nm_ss;
+
+ if (!interpret_string_addr(&ip1_ss, ip1, AI_NUMERICHOST)) {
+ return false;
+ }
+ if (!interpret_string_addr(&ip2_ss, ip2, AI_NUMERICHOST)) {
+ return false;
+ }
+ if (!interpret_string_addr(&nm_ss, netmask, AI_NUMERICHOST)) {
+ return false;
+ }
+
+ return same_net((struct sockaddr *)&ip1_ss,
+ (struct sockaddr *)&ip2_ss,
+ (struct sockaddr *)&nm_ss);
}
/**