Mon Apr 2 18:25:35 2012 UTC ()
Pull up following revision(s) (requested by bouyer in ticket #145):
	sys/netinet/ip_carp.c: revision 1.48
Do not sleep in callout context, this will hang the clock soft interrupt.
Should fix PR kern/46217.


(riz)
diff -r1.47 -r1.47.4.1 src/sys/netinet/ip_carp.c

cvs diff -r1.47 -r1.47.4.1 src/sys/netinet/ip_carp.c (expand / switch to unified diff)

--- src/sys/netinet/ip_carp.c 2011/11/19 22:51:25 1.47
+++ src/sys/netinet/ip_carp.c 2012/04/02 18:25:35 1.47.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ip_carp.c,v 1.47 2011/11/19 22:51:25 tls Exp $ */ 1/* $NetBSD: ip_carp.c,v 1.47.4.1 2012/04/02 18:25:35 riz Exp $ */
2/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */ 2/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 2002 Michael Shalayeff. All rights reserved. 5 * Copyright (c) 2002 Michael Shalayeff. All rights reserved.
6 * Copyright (c) 2003 Ryan McBride. All rights reserved. 6 * Copyright (c) 2003 Ryan McBride. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, 20 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGE. 27 * THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30#include "opt_inet.h" 30#include "opt_inet.h"
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.47 2011/11/19 22:51:25 tls Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.47.4.1 2012/04/02 18:25:35 riz Exp $");
34 34
35/* 35/*
36 * TODO: 36 * TODO:
37 * - iface reconfigure 37 * - iface reconfigure
38 * - support for hardware checksum calculations; 38 * - support for hardware checksum calculations;
39 * 39 *
40 */ 40 */
41 41
42#include <sys/param.h> 42#include <sys/param.h>
43#include <sys/proc.h> 43#include <sys/proc.h>
44#include <sys/mbuf.h> 44#include <sys/mbuf.h>
45#include <sys/socket.h> 45#include <sys/socket.h>
46#include <sys/socketvar.h> 46#include <sys/socketvar.h>
@@ -1136,53 +1136,47 @@ void @@ -1136,53 +1136,47 @@ void
1136carp_send_arp(struct carp_softc *sc) 1136carp_send_arp(struct carp_softc *sc)
1137{ 1137{
1138 struct ifaddr *ifa; 1138 struct ifaddr *ifa;
1139 struct in_addr *in; 1139 struct in_addr *in;
1140 int s = splsoftnet(); 1140 int s = splsoftnet();
1141 1141
1142 IFADDR_FOREACH(ifa, &sc->sc_if) { 1142 IFADDR_FOREACH(ifa, &sc->sc_if) {
1143 1143
1144 if (ifa->ifa_addr->sa_family != AF_INET) 1144 if (ifa->ifa_addr->sa_family != AF_INET)
1145 continue; 1145 continue;
1146 1146
1147 in = &ifatoia(ifa)->ia_addr.sin_addr; 1147 in = &ifatoia(ifa)->ia_addr.sin_addr;
1148 arprequest(sc->sc_carpdev, in, in, CLLADDR(sc->sc_if.if_sadl)); 1148 arprequest(sc->sc_carpdev, in, in, CLLADDR(sc->sc_if.if_sadl));
1149 
1150 /* XXX: why does this need to delay? */ 
1151 kpause("carpdel", false, MAX(1, mstohz(1)), NULL); 
1152 } 1149 }
1153 splx(s); 1150 splx(s);
1154} 1151}
1155 1152
1156#ifdef INET6 1153#ifdef INET6
1157void 1154void
1158carp_send_na(struct carp_softc *sc) 1155carp_send_na(struct carp_softc *sc)
1159{ 1156{
1160 struct ifaddr *ifa; 1157 struct ifaddr *ifa;
1161 struct in6_addr *in6; 1158 struct in6_addr *in6;
1162 static struct in6_addr mcast = IN6ADDR_LINKLOCAL_ALLNODES_INIT; 1159 static struct in6_addr mcast = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
1163 int s = splsoftnet(); 1160 int s = splsoftnet();
1164 1161
1165 IFADDR_FOREACH(ifa, &sc->sc_if) { 1162 IFADDR_FOREACH(ifa, &sc->sc_if) {
1166 1163
1167 if (ifa->ifa_addr->sa_family != AF_INET6) 1164 if (ifa->ifa_addr->sa_family != AF_INET6)
1168 continue; 1165 continue;
1169 1166
1170 in6 = &ifatoia6(ifa)->ia_addr.sin6_addr; 1167 in6 = &ifatoia6(ifa)->ia_addr.sin6_addr;
1171 nd6_na_output(sc->sc_carpdev, &mcast, in6, 1168 nd6_na_output(sc->sc_carpdev, &mcast, in6,
1172 ND_NA_FLAG_OVERRIDE, 1, NULL); 1169 ND_NA_FLAG_OVERRIDE, 1, NULL);
1173 
1174 /* XXX: why does this need to delay? */ 
1175 kpause("carpdel6", false, MAX(1, mstohz(1)), NULL); 
1176 } 1170 }
1177 splx(s); 1171 splx(s);
1178} 1172}
1179#endif /* INET6 */ 1173#endif /* INET6 */
1180 1174
1181/* 1175/*
1182 * Based on bridge_hash() in if_bridge.c 1176 * Based on bridge_hash() in if_bridge.c
1183 */ 1177 */
1184#define mix(a,b,c) \ 1178#define mix(a,b,c) \
1185 do { \ 1179 do { \
1186 a -= b; a -= c; a ^= (c >> 13); \ 1180 a -= b; a -= c; a ^= (c >> 13); \
1187 b -= c; b -= a; b ^= (a << 8); \ 1181 b -= c; b -= a; b ^= (a << 8); \
1188 c -= a; c -= b; c ^= (b >> 13); \ 1182 c -= a; c -= b; c ^= (b >> 13); \