summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Patou <mat@samba.org>2011-10-14 13:45:48 -0700
committerJeremy Allison <jra@samba.org>2011-10-14 13:45:48 -0700
commitabe5afc580dcaaab70f136904d98fa83bfae7b6e (patch)
tree5bba96d4aed1c106ab9d05bda5a369e61ecde57e
parentacc28706b54f2c7038d0b6cee106d99f1a6797ac (diff)
downloadsamba-abe5afc580dcaaab70f136904d98fa83bfae7b6e.tar.gz
samba-abe5afc580dcaaab70f136904d98fa83bfae7b6e.tar.bz2
samba-abe5afc580dcaaab70f136904d98fa83bfae7b6e.zip
Fix bug with Samba not recognising an 6to4 IPv6 interface.
"The 6to4 interface has the flags IFF_POINTTOPOINT interface but no ifa_dstaddr as it's not at the IPv6 level a point to point interface (at least from my understanding), as we don't have a IFF_BROADCAST flag set (I have the impression that this flag is only set on a interface that has also an IPv4 address) the first test is not valid also, which result in a skipped interface."
-rw-r--r--lib/socket/interfaces.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/socket/interfaces.c b/lib/socket/interfaces.c
index 618714d1a7..9bdecb243d 100644
--- a/lib/socket/interfaces.c
+++ b/lib/socket/interfaces.c
@@ -195,6 +195,19 @@ static int _get_interfaces(TALLOC_CTX *mem_ctx, struct iface_struct **pifaces)
memcpy(&ifaces[total].bcast,
ifptr->ifa_dstaddr,
copy_size);
+#if defined(HAVE_IPV6)
+ } else if (ifptr->ifa_addr->sa_family == AF_INET6) {
+ const struct sockaddr_in6 *sin6 =
+ (const struct sockaddr_in6 *)ifptr->ifa_addr;
+ const struct in6_addr *in6 =
+ (const struct in6_addr *)&sin6->sin6_addr;
+
+ if (IN6_IS_ADDR_LINKLOCAL(in6) || IN6_IS_ADDR_V4COMPAT(in6)) {
+ continue;
+ }
+ /* IPv6 does not have broadcast it uses multicast. */
+ memset(&ifaces[total].bcast, '\0', copy_size);
+#endif
} else {
continue;
}