Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Make CARP on IPv6 work
details: https://anonhg.NetBSD.org/src/rev/f82505474563
branches: trunk
changeset: 351799:f82505474563
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Mon Feb 27 08:26:53 2017 +0000
description:
Make CARP on IPv6 work
It passes ATF tests but no more, no less.
diffstat:
sys/netinet/ip_carp.c | 28 +++++++++++++++-------------
tests/net/carp/t_basic.sh | 4 +---
2 files changed, 16 insertions(+), 16 deletions(-)
diffs (115 lines):
diff -r 64703bbfb4dc -r f82505474563 sys/netinet/ip_carp.c
--- a/sys/netinet/ip_carp.c Mon Feb 27 07:25:59 2017 +0000
+++ b/sys/netinet/ip_carp.c Mon Feb 27 08:26:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_carp.c,v 1.84 2017/02/02 02:52:10 ozaki-r Exp $ */
+/* $NetBSD: ip_carp.c,v 1.85 2017/02/27 08:26:53 ozaki-r Exp $ */
/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */
/*
@@ -33,7 +33,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.84 2017/02/02 02:52:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.85 2017/02/27 08:26:53 ozaki-r Exp $");
/*
* TODO:
@@ -252,6 +252,12 @@
return (in_cksum(m, len));
}
+static __inline u_int16_t
+carp6_cksum(struct mbuf *m, uint32_t off, uint32_t len)
+{
+ return (in6_cksum(m, IPPROTO_CARP, off, len));
+}
+
static void
carp_hmac_prepare(struct carp_softc *sc)
{
@@ -601,16 +607,13 @@
return;
}
-
/* verify the CARP checksum */
- m->m_data += off;
- if (carp_cksum(m, sizeof(*ch))) {
+ if (carp6_cksum(m, off, sizeof(*ch))) {
CARP_STATINC(CARP_STAT_BADSUM);
CARP_LOG(sc, ("checksum failed, on %s", rcvif->if_xname));
m_freem(m);
return;
}
- m->m_data -= off;
carp_proto_input_c(m, ch, AF_INET6);
return;
@@ -1120,7 +1123,7 @@
}
}
#endif /* INET */
-#ifdef INET6_notyet
+#ifdef INET6
if (sc->sc_naddrs6) {
struct ip6_hdr *ip6;
struct ifaddr *ifa;
@@ -1161,7 +1164,7 @@
ip6->ip6_dst.s6_addr16[0] = htons(0xff02);
ip6->ip6_dst.s6_addr8[15] = 0x12;
- if (in6_setscope(&ip6->ip6_dst, sc->sc_carpdev, NULL) != 0) {
+ if (in6_setscope(&ip6->ip6_dst, &sc->sc_if, NULL) != 0) {
sc->sc_if.if_oerrors++;
m_freem(m);
CARP_LOG(sc, ("in6_setscope failed"));
@@ -1173,9 +1176,8 @@
if (carp_prepare_ad(m, sc, ch_ptr))
goto retry_later;
- m->m_data += sizeof(*ip6);
- ch_ptr->carp_cksum = carp_cksum(m, len - sizeof(*ip6));
- m->m_data -= sizeof(*ip6);
+ ch_ptr->carp_cksum = carp6_cksum(m, sizeof(*ip6),
+ len - sizeof(*ip6));
nanotime(&sc->sc_if.if_lastchange);
sc->sc_if.if_opackets++;
@@ -1530,7 +1532,7 @@
callout_schedule(&sc->sc_md_tmo, tvtohz(&tv));
break;
#endif /* INET */
-#ifdef INET6_notyet
+#ifdef INET6
case AF_INET6:
callout_schedule(&sc->sc_md6_tmo, tvtohz(&tv));
break;
@@ -1538,7 +1540,7 @@
default:
if (sc->sc_naddrs)
callout_schedule(&sc->sc_md_tmo, tvtohz(&tv));
-#ifdef INET6_notyet
+#ifdef INET6
if (sc->sc_naddrs6)
callout_schedule(&sc->sc_md6_tmo, tvtohz(&tv));
#endif /* INET6 */
diff -r 64703bbfb4dc -r f82505474563 tests/net/carp/t_basic.sh
--- a/tests/net/carp/t_basic.sh Mon Feb 27 07:25:59 2017 +0000
+++ b/tests/net/carp/t_basic.sh Mon Feb 27 08:26:53 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_basic.sh,v 1.3 2017/02/27 07:25:59 ozaki-r Exp $
+# $NetBSD: t_basic.sh,v 1.4 2017/02/27 08:26:53 ozaki-r Exp $
#
# Copyright (c) 2017 Internet Initiative Japan Inc.
# All rights reserved.
@@ -273,8 +273,6 @@
{
local op=$1
- atf_expect_fail 'The implementation of CARP on IPv6 is incomplete yet.'
-
rump_server_start $SOCK_CLIENT netinet6
rump_server_start $SOCK_MASTER netinet6
rump_server_start $SOCK_BACKUP netinet6
Home |
Main Index |
Thread Index |
Old Index