From aecf4a6244730d904a75f88ec9ea7eba0be9dd34 Mon Sep 17 00:00:00 2001 From: glebius Date: Mon, 30 Jan 2006 08:39:09 +0000 Subject: Add some initial locking to gif(4). It doesn't covers the whole driver, however IPv4-in-IPv4 tunnels are now stable on SMP. Details: - Add per-softc mutex. - Hold the mutex on output. The main problem was the rtentry, placed in softc. It could be freed by ip_output(). Meanwhile, another thread being in in_gif_output() can read and write this rtentry. Reported by: many Tested by: Alexander Shiryaev --- sys/netinet/in_gif.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sys/netinet/in_gif.c') diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c index cc6b64d..b69346c 100644 --- a/sys/netinet/in_gif.c +++ b/sys/netinet/in_gif.c @@ -104,6 +104,8 @@ in_gif_output(ifp, family, m) int proto, error; u_int8_t tos; + GIF_LOCK_ASSERT(sc); + if (sin_src == NULL || sin_dst == NULL || sin_src->sin_family != AF_INET || sin_dst->sin_family != AF_INET) { -- cgit v1.1