From a138d21769de1498435a908513175219a96d024f Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Thu, 24 Jun 2004 02:05:47 +0000 Subject: [PATCH] In ip_ctloutput(), acquire the inpcb lock around some of the basic inpcb flag and status updates. --- sys/netinet/ip_output.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 520de054ee8d..6ee1f680bbba 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1437,11 +1437,14 @@ ip_ctloutput(so, sopt) case IP_TTL: inp->inp_ip_ttl = optval; break; -#define OPTSET(bit) \ - if (optval) \ - inp->inp_flags |= bit; \ - else \ - inp->inp_flags &= ~bit; +#define OPTSET(bit) do { \ + INP_LOCK(inp); \ + if (optval) \ + inp->inp_flags |= bit; \ + else \ + inp->inp_flags &= ~bit; \ + INP_UNLOCK(inp); \ +} while (0) case IP_RECVOPTS: OPTSET(INP_RECVOPTS); @@ -1489,6 +1492,7 @@ ip_ctloutput(so, sopt) if (error) break; + INP_LOCK(inp); switch (optval) { case IP_PORTRANGE_DEFAULT: inp->inp_flags &= ~(INP_LOWPORT); @@ -1509,6 +1513,7 @@ ip_ctloutput(so, sopt) error = EINVAL; break; } + INP_UNLOCK(inp); break; #if defined(IPSEC) || defined(FAST_IPSEC)