Permalink
Browse files

in in6_ifadd(), make sure that we do not have this address already.

This should usually not happen, but we can still see this case, e.g., if we
have manually configured the exact address to be configured.

(this is an unexpected side effect of a clarification in rfc2462bis)
  • Loading branch information...
1 parent 182b0e6 commit 79164903ca303b18e2205228792f9dfb5ed32528 jinmei committed Oct 21, 2004
Showing with 13 additions and 1 deletion.
  1. +13 −1 kame/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $KAME: nd6_rtr.c,v 1.262 2004/08/17 10:18:58 jinmei Exp $ */
+/* $KAME: nd6_rtr.c,v 1.263 2004/10/21 01:52:51 jinmei Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -2156,6 +2156,18 @@ in6_ifadd(pr, mcast)
ifra.ifra_flags |= IN6_IFF_AUTOCONF; /* obey autoconf */
/*
+ * Make sure that we do not have this address already. This should
+ * usually not happen, but we can still see this case, e.g., if we
+ * have manually configured the exact address to be configured.
+ */
+ if (in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr) != NULL) {
+ /* this should be rare enough to make an explicit log */
+ log(LOG_INFO, "in6_ifadd: %s is already configured\n",
+ ip6_sprintf(&ifra.ifra_addr.sin6_addr));
+ return (NULL);
+ }
+
+ /*
* Allocate ifaddr structure, link into chain, etc.
* If we are going to create a new address upon receiving a multicasted
* RA, we need to impose a random delay before starting DAD.

0 comments on commit 7916490

Please sign in to comment.