From 99a5775da918d1975fd8a92893a1c6652baa8ba7 Mon Sep 17 00:00:00 2001
From: Masahide NAKAMURA <nakam@linux-ipv6.org>
Date: Mon, 5 Feb 2007 00:23:25 +0900
Subject: [BUGFIX] CN: Omit to send BE to non-unicast destination.

RFC3775 9.3.3 says that "If the Source Address field does not contain
a unicast address, the Binding Error message MUST NOT be sent."
This patch makes the daemon not to send BE on such case.
---
 src/mh.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mh.c b/src/mh.c
index 0e946fb..06882d4 100644
--- a/src/mh.c
+++ b/src/mh.c
@@ -874,6 +874,14 @@ void mh_send_be(struct in6_addr *dst, struct in6_addr *hoa,
 	struct iovec iov;
 	struct in6_addr_bundle out;
 
+	if (IN6_IS_ADDR_UNSPECIFIED(dst) ||
+	    IN6_IS_ADDR_LOOPBACK(dst) ||
+	    IN6_IS_ADDR_MULTICAST(dst)) {
+		MDBG("Omit BE for non-unicast "
+		     "%x:%x:%x:%x:%x:%x:%x:%x\n", NIP6ADDR(dst));
+		return;
+	}
+
 	out.remote_coa = NULL;
 	out.local_coa = NULL;
 	be = mh_create(&iov, IP6_MH_TYPE_BERROR);
-- 
1.5.0.3

