Index: EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/nd6_rtr.c
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/nd6_rtr.c	(revision 321)
+++ EcnlProtoTool/trunk/asp3_dcre/tinet/netinet6/nd6_rtr.c	(revision 331)
@@ -2,5 +2,5 @@
  *  TINET (TCP/IP Protocol Stack)
  * 
- *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
+ *  Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering
  *                   Tomakomai National College of Technology, JAPAN
  *
@@ -93,4 +93,5 @@
 #include <net/ppp_ipcp.h>
 #include <net/net.h>
+#include <net/net_endian.h>
 #include <net/net_var.h>
 #include <net/net_buf.h>
@@ -100,13 +101,12 @@
 #include <netinet/in.h>
 #include <netinet/in_var.h>
-#include <netinet6/in6.h>
-#include <netinet6/in6_var.h>
+#include <netinet/ip.h>
+#include <netinet/ip_var.h>
+#include <netinet/ip_icmp.h>
+
 #include <netinet6/nd6.h>
 #include <netinet6/in6_ifattach.h>
-#include <netinet/ip6.h>
-#include <netinet/icmp6.h>
-#include <netinet6/ip6_var.h>
-
-#include <net/if6_var.h>
+
+#include <net/if_var.h>
 
 /*
@@ -116,5 +116,5 @@
 extern const char *itron_strerror (ER ercd);
 
-#ifdef SUPPORT_INET6
+#ifdef _IP6_CFG
 
 #if NUM_ND6_DEF_RTR_ENTRY > 0
@@ -284,5 +284,5 @@
 	 */
 	for (ix = NUM_IN6_IFADDR_ENTRY; ix -- > 0; ) {
-		ia = &ifp->in_ifaddrs[ix];
+		ia = &ifp->in6_ifaddrs[ix];
 		if ((ia->flags & (IN6_IFF_DEFINED | IN6_IFF_AUTOCONF)) != 0 &&
 		     ia->prefix_index != ND6_PREFIX_IX_INVALID) {
@@ -299,5 +299,5 @@
 		 */
 		for (ix = NUM_IN6_IFADDR_ENTRY; ix -- > 0; ) {
-			ia = &ifp->in_ifaddrs[ix];
+			ia = &ifp->in6_ifaddrs[ix];
 			if ((ia->flags & (IN6_IFF_DEFINED | IN6_IFF_AUTOCONF)) != 0 &&
 			     ia->prefix_index != ND6_PREFIX_IX_INVALID) {
@@ -316,5 +316,5 @@
 		 */
 		for (ix = NUM_IN6_IFADDR_ENTRY; ix -- > 0; ) {
-			ia = &ifp->in_ifaddrs[ix];
+			ia = &ifp->in6_ifaddrs[ix];
 			if ((ia->flags & (IN6_IFF_DEFINED | IN6_IFF_AUTOCONF)) != 0)
 				ia->flags &= ~IN6_IFF_DETACHED;
@@ -448,5 +448,5 @@
 	/* 各メンバに値を設定する。*/
 	fdr->plistmap = 0;
-	fdr->addr     = *src;
+	memcpy(&fdr->addr, src, sizeof(T_IN6_ADDR));
 	fdr->lifetime = lifetime * SYSTIM_HZ;		/* lifetime の単位は秒 */
 	fdr->flags    = flags;
@@ -478,5 +478,5 @@
 	int_t		ix;
 
-	lla = &ifp->in_ifaddrs[IPV6_IFADDR_IX_LINKLOCAL];
+	lla = &ifp->in6_ifaddrs[IPV6_IFADDR_IX_LINKLOCAL];
 
 	/*
@@ -585,5 +585,5 @@
 
 	/* リンクローカルアドレスが未登録であれば何もしない。*/
-	lla = &ifp->in_ifaddrs[IPV6_IFADDR_IX_LINKLOCAL];
+	lla = &ifp->in6_ifaddrs[IPV6_IFADDR_IX_LINKLOCAL];
 	if ((lla->flags & IN6_IFF_DEFINED) == 0)
 		return E_OK;
@@ -594,5 +594,5 @@
 	 */
 	for (ix = NUM_IN6_IFADDR_ENTRY; ix --; ) {
-		ia = &ifp->in_ifaddrs[ix];
+		ia = &ifp->in6_ifaddrs[ix];
 		if (ia->prefix_index == (pr - nd6_prefix))
 			break;
@@ -634,5 +634,5 @@
 	 */
 	for (ix = NUM_IN6_IFADDR_ENTRY; ix --; ) {
-		ia = &ifp->in_ifaddrs[ix];
+		ia = &ifp->in6_ifaddrs[ix];
 		if (ia->prefix_index == (pr - nd6_prefix))
 			break;
@@ -692,5 +692,4 @@
 	T_ND6_PREFIX	*pr = NULL;
 	int_t		ix;
-	ER		error;
 
 	/* プレフィックスリストから空きのプレフィックスエントリを探索する。*/
@@ -723,5 +722,5 @@
 
 	if ((pr->flags & ND6_PREFIX_FLAG_ONLINK) != 0) {
-		if ((error = nd6_prefix_onlink(pr)) != E_OK)
+		if (nd6_prefix_onlink(pr) != E_OK)
 			return NULL;
 		}
@@ -812,4 +811,11 @@
 			}
 
+#if 1		/* プレフィックスが未登録の場合だけ表示する。*/
+		syslog(LOG_NOTICE, "[ND6 RTR] add prefix: flags[MOH]: %02x, addr: %s\n"
+		                   "                                      from: %s.",
+		                   nd6_def_router[router_index].flags,
+		                   ipv62str(NULL, &pi->prefix),
+		                   ipv62str(NULL, &nd6_def_router[router_index].addr));
+#endif
 		if ((pr->flags & ND6_PREFIX_FLAG_ONLINK) == 0) {
 			/*
@@ -836,5 +842,5 @@
 	 */
 	for (ix = NUM_IN6_IFADDR_ENTRY; ix --; ) {
-		ia = &ifp->in_ifaddrs[ix];
+		ia = &ifp->in6_ifaddrs[ix];
 		if ((ia->flags & IN6_IFF_DEFINED) != 0 &&
 		    ia->prefix_len == pr->prefix_len &&
@@ -892,5 +898,5 @@
 				}
 
-			lla = &ifp->in_ifaddrs[IPV6_IFADDR_IX_LINKLOCAL];
+			lla = &ifp->in6_ifaddrs[IPV6_IFADDR_IX_LINKLOCAL];
 
 			/* プレフィックスマスクを生成する。*/
@@ -922,5 +928,5 @@
 
 			for (ix = NUM_IN6_IFADDR_ENTRY; ix --; ) {
-				ia = &ifp->in_ifaddrs[ix];
+				ia = &ifp->in6_ifaddrs[ix];
 				if ((ia->flags & IN6_IFF_DEFINED) == 0) {
 					in6_ifadd(pr, ia, router_index);
@@ -971,5 +977,5 @@
 	T_NET_BUF		*output;
 	T_IN6_IFADDR		*ifa;
-	T_IN6_ADDR		*saddr;
+	const T_IN6_ADDR	*saddr;
 	uint16_t		len;
 
@@ -1017,5 +1023,5 @@
 
 T_DEF_ROUTER *
-nd6_defrtrlist_lookup (T_IN6_ADDR *src)
+nd6_defrtrlist_lookup (const T_IN6_ADDR *src)
 {
 	T_DEF_ROUTER	*dr = NULL;
@@ -1036,5 +1042,5 @@
  */
 
-T_IN6_ADDR *
+const T_IN6_ADDR *
 nd6_router_lookup (void)
 {
@@ -1260,6 +1266,9 @@
 				syslog(LOG_NOTICE, "[ND6 RTR] preferred(%d) > valid time(%d).", ntohl(pi->preferred), ntohl(pi->valid));
 			else {
-				syslog(LOG_NOTICE, "[ND6 RTR] update prefix: %s from %s.",
-				                   ipv62str(NULL, &pi->prefix), ipv62str(NULL, &ip6h->src));
+#if 0	/* プレフィックスが未登録の場合だけ表示する。*/
+				syslog(LOG_NOTICE, "[ND6 RTR] update prefix: flags[MOH]: %02x, addr: %s\n"
+				                   "                                         from: %s.",
+				                   rah->nd_ra_flags, ipv62str(NULL, &pi->prefix), ipv62str(NULL, &ip6h->src));
+#endif
 				if (rix >= 0) {
 					/*
@@ -1391,5 +1400,5 @@
 
 T_ND6_PREFIX *
-nd6_onlink_prefix_lookup (T_IN6_ADDR *dst)
+nd6_onlink_prefix_lookup (const T_IN6_ADDR *dst)
 {
 	SYSTIM		now;
@@ -1427,3 +1436,3 @@
 	}
 
-#endif /* of #ifdef SUPPORT_INET6 */
+#endif /* of #ifdef _IP6_CFG */
