Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 To help find the cause of kernel complaints suc...



details:   https://anonhg.NetBSD.org/src/rev/1daa65c2daca
branches:  trunk
changeset: 756383:1daa65c2daca
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Thu Jul 15 19:15:30 2010 +0000

description:
To help find the cause of kernel complaints such as "/netbsd:
nd6_storelladdr: sdl_alen == 0, dst=... if=wm1", add printfs for some
"impossible" conditions, and make the nd6_storelladdr() printf more
informative by printing the value of sdl_alen.

diffstat:

 sys/netinet6/nd6.c |  36 ++++++++++++++++++++++++++----------
 1 files changed, 26 insertions(+), 10 deletions(-)

diffs (79 lines):

diff -r afb0ffeaa512 -r 1daa65c2daca sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Thu Jul 15 19:02:26 2010 +0000
+++ b/sys/netinet6/nd6.c        Thu Jul 15 19:15:30 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.c,v 1.135 2009/11/06 20:41:22 dyoung Exp $ */
+/*     $NetBSD: nd6.c,v 1.136 2010/07/15 19:15:30 dyoung Exp $ */
 /*     $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $   */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.135 2009/11/06 20:41:22 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.136 2010/07/15 19:15:30 dyoung Exp $");
 
 #include "opt_ipsec.h"
 
@@ -1232,9 +1232,13 @@
                         * treated as on-link but is currently not
                         * (RTF_LLINFO && ln == NULL case).
                         */
-                       sockaddr_dl_init(&u.sdl, sizeof(u.ss),
+                       if (sockaddr_dl_init(&u.sdl, sizeof(u.ss),
                            ifp->if_index, ifp->if_type,
-                           NULL, namelen, NULL, addrlen);
+                           NULL, namelen, NULL, addrlen) == NULL) {
+                               printf("%s.%d: sockaddr_dl_init(, %zu, ) "
+                                   "failed on %s\n", __func__, __LINE__,
+                                   sizeof(u.ss), if_name(ifp));
+                       }
                        rt_setgate(rt, &u.sa);
                        gate = rt->rt_gateway;
                        RT_DPRINTF("rt->_rt_key = %p\n", (void *)rt->_rt_key);
@@ -1351,8 +1355,15 @@
                        ln->ln_byhint = 0;
                        if ((mac = nd6_ifptomac(ifp)) != NULL) {
                                /* XXX check for error */
-                               (void)sockaddr_dl_setaddr(satosdl(gate),
-                                   gate->sa_len, mac, ifp->if_addrlen);
+                               if (sockaddr_dl_setaddr(satosdl(gate),
+                                   gate->sa_len, mac,
+                                   ifp->if_addrlen) == NULL) {
+                                       printf("%s.%d: "
+                                           "sockaddr_dl_setaddr(, %d, ) "
+                                           "failed on %s\n", __func__,
+                                           __LINE__, gate->sa_len,
+                                           if_name(ifp));
+                               }
                        }
                        if (nd6_useloopback) {
                                ifp = rt->rt_ifp = lo0ifp;      /* XXX */
@@ -1777,8 +1788,12 @@
                 * XXX is it dependent to ifp->if_type?
                 */
                /* XXX check for error */
-               (void)sockaddr_dl_setaddr(sdl, sdl->sdl_len, lladdr,
-                   ifp->if_addrlen);
+               if (sockaddr_dl_setaddr(sdl, sdl->sdl_len, lladdr,
+                   ifp->if_addrlen) == NULL) {
+                       printf("%s.%d: sockaddr_dl_setaddr(, %d, ) "
+                           "failed on %s\n", __func__, __LINE__,
+                           sdl->sdl_len, if_name(ifp));
+               }
        }
 
        if (!is_newentry) {
@@ -2197,8 +2212,9 @@
        sdl = satocsdl(rt->rt_gateway);
        if (sdl->sdl_alen == 0 || sdl->sdl_alen > dstsize) {
                /* this should be impossible, but we bark here for debugging */
-               printf("%s: sdl_alen == 0, dst=%s, if=%s\n", __func__,
-                   ip6_sprintf(&satocsin6(dst)->sin6_addr), if_name(ifp));
+               printf("%s: sdl_alen == %" PRIu8 ", dst=%s, if=%s\n", __func__,
+                   sdl->sdl_alen, ip6_sprintf(&satocsin6(dst)->sin6_addr),
+                   if_name(ifp));
                m_freem(m);
                return 0;
        }



Home | Main Index | Thread Index | Old Index