Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/netinet Pull up following revision(s) (requested by i...



details:   https://anonhg.NetBSD.org/src/rev/d330dd3c97f1
branches:  netbsd-6
changeset: 777093:d330dd3c97f1
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sat Aug 27 14:39:10 2016 +0000

description:
Pull up following revision(s) (requested by is in ticket #1394):
        sys/netinet/ip_carp.c: revision 1.76
Print the IPv6 or IPv4 source addresses of packets with wrong hash, to
help debugging.

diffstat:

 sys/netinet/ip_carp.c |  27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diffs (57 lines):

diff -r 7f64f68881d0 -r d330dd3c97f1 sys/netinet/ip_carp.c
--- a/sys/netinet/ip_carp.c     Sat Aug 27 14:34:55 2016 +0000
+++ b/sys/netinet/ip_carp.c     Sat Aug 27 14:39:10 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_carp.c,v 1.47.4.3 2014/06/03 15:34:00 msaitoh Exp $ */
+/*     $NetBSD: ip_carp.c,v 1.47.4.4 2016/08/27 14:39:10 bouyer Exp $  */
 /*     $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $   */
 
 /*
@@ -31,7 +31,7 @@
 #include "opt_mbuftrace.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.47.4.3 2014/06/03 15:34:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.47.4.4 2016/08/27 14:39:10 bouyer Exp $");
 
 /*
  * TODO:
@@ -92,6 +92,7 @@
 #include <netinet6/ip6_var.h>
 #include <netinet6/nd6.h>
 #include <netinet6/scope6_var.h>
+#include <netinet6/in6_var.h>
 #endif
 
 #include <net/bpf.h>
@@ -673,9 +674,29 @@
 
        /* verify the hash */
        if (carp_hmac_verify(sc, ch->carp_counter, ch->carp_md)) {
+               struct ip *ip;
+               struct ip6_hdr *ip6;
+
                CARP_STATINC(CARP_STAT_BADAUTH);
                sc->sc_if.if_ierrors++;
-               CARP_LOG(sc, ("incorrect hash"));
+
+               switch(af) {
+               
+               case AF_INET:
+                       ip = mtod(m, struct ip *);
+                       CARP_LOG(sc, ("incorrect hash from %s", 
+                           in_fmtaddr(ip->ip_src)));
+                       break;
+
+               case AF_INET6:
+                       ip6 = mtod(m, struct ip6_hdr *);
+                       CARP_LOG(sc, ("incorrect hash from %s",
+                               ip6_sprintf(&ip6->ip6_src)));
+                       break;
+
+               default: CARP_LOG(sc, ("incorrect hash"));
+                       break;
+               }
                m_freem(m);
                return;
        }



Home | Main Index | Thread Index | Old Index