summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/ah_input.c
diff options
context:
space:
mode:
authorjlemon <jlemon@FreeBSD.org>2000-11-25 07:35:38 +0000
committerjlemon <jlemon@FreeBSD.org>2000-11-25 07:35:38 +0000
commit954e1d2ccdb661d5c8b7f69340d118fa7ba7fb85 (patch)
tree0a4e9f6dcd5fa64a78f5991ac425f3ca97aba154 /sys/netinet6/ah_input.c
parent2daca11cae375091daf49a7cd704e5e4e1be27db (diff)
downloadFreeBSD-src-954e1d2ccdb661d5c8b7f69340d118fa7ba7fb85.zip
FreeBSD-src-954e1d2ccdb661d5c8b7f69340d118fa7ba7fb85.tar.gz
Lock down the network interface queues. The queue mutex must be obtained
before adding/removing packets from the queue. Also, the if_obytes and if_omcasts fields should only be manipulated under protection of the mutex. IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on the queue. An IF_LOCK macro is provided, as well as the old (mutex-less) versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which needs them, but their use is discouraged. Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF, which takes care of locking/enqueue, and also statistics updating/start if necessary.
Diffstat (limited to 'sys/netinet6/ah_input.c')
-rw-r--r--sys/netinet6/ah_input.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/sys/netinet6/ah_input.c b/sys/netinet6/ah_input.c
index 1aaa0c4..b0489d1 100644
--- a/sys/netinet6/ah_input.c
+++ b/sys/netinet6/ah_input.c
@@ -470,16 +470,13 @@ ah4_input(m, va_alist)
key_sa_recordxfer(sav, m);
- s = splimp();
- if (IF_QFULL(&ipintrq)) {
+ if (! IF_HANDOFF(&ipintrq, m, NULL)) {
ipsecstat.in_inval++;
- splx(s);
+ m = NULL;
goto fail;
}
- IF_ENQUEUE(&ipintrq, m);
m = NULL;
schednetisr(NETISR_IP); /*can be skipped but to make sure*/
- splx(s);
nxt = IPPROTO_DONE;
} else {
/*
@@ -596,7 +593,6 @@ ah6_input(mp, offp, proto)
u_char *cksum;
struct secasvar *sav = NULL;
u_int16_t nxt;
- int s;
#ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, off, sizeof(struct ah), IPPROTO_DONE);
@@ -875,16 +871,13 @@ ah6_input(mp, offp, proto)
key_sa_recordxfer(sav, m);
- s = splimp();
- if (IF_QFULL(&ip6intrq)) {
+ if (! IF_HANDOFF(&ip6intrq, m, NULL)) {
ipsec6stat.in_inval++;
- splx(s);
+ m = NULL;
goto fail;
}
- IF_ENQUEUE(&ip6intrq, m);
m = NULL;
schednetisr(NETISR_IPV6); /*can be skipped but to make sure*/
- splx(s);
nxt = IPPROTO_DONE;
} else {
/*
OpenPOWER on IntegriCloud