summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_var.h
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2008-12-06 13:19:54 +0000
committerrrs <rrs@FreeBSD.org>2008-12-06 13:19:54 +0000
commit0f2b9dafa358fb3b64efed4842cd31650ceea672 (patch)
tree773b646ae7f5af08e1421071f2aa493698537042 /sys/netinet/sctp_var.h
parentf4594595d3de298d45caf389d9cee0d893cedfc0 (diff)
downloadFreeBSD-src-0f2b9dafa358fb3b64efed4842cd31650ceea672.zip
FreeBSD-src-0f2b9dafa358fb3b64efed4842cd31650ceea672.tar.gz
Code from the hack-session known as the IETF (and a
bit of debugging afterwards): - Fix protection code for notification generation. - Decouple associd from vtag - Allow vtags to have less strigent requirements in non-uniqueness. o don't pre-hash them when you issue one in a cookie. o Allow duplicates and use addresses and ports to discriminate amongst the duplicates during lookup. - Add support for the NAT draft draft-ietf-behave-sctpnat-00, this is still experimental and needs more extensive testing with the Jason Butt ipfw changes. - Support for the SENDER_DRY event to get DTLS in OpenSSL working with a set of patches from Michael Tuexen (hopefully heading to OpenSSL soon). - Update the support of SCTP-AUTH by Peter Lei. - Use macros for refcounting. - Fix MTU for UDP encapsulation. - Fix reporting back of unsent data. - Update assoc send counter handling to be consistent with endpoint sent counter. - Fix a bug in PR-SCTP. - Fix so we only send another FWD-TSN when a SACK arrives IF and only if the adv-peer-ack point progressed. However we still make sure a timer is running if we do have an adv_peer_ack point. - Fix PR-SCTP bug where chunks were retransmitted if they are sent unreliable but not abandoned yet. With the help of: Michael Teuxen and Peter Lei :-) MFC after: 4 weeks
Diffstat (limited to 'sys/netinet/sctp_var.h')
-rw-r--r--sys/netinet/sctp_var.h71
1 files changed, 17 insertions, 54 deletions
diff --git a/sys/netinet/sctp_var.h b/sys/netinet/sctp_var.h
index 9340c1c..934af00 100644
--- a/sys/netinet/sctp_var.h
+++ b/sys/netinet/sctp_var.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -86,6 +86,10 @@ extern struct pr_usrreqs sctp_usrreqs;
}
#define sctp_free_a_strmoq(_stcb, _strmoq) { \
+ if ((_strmoq)->holds_key_ref) { \
+ sctp_auth_key_release(stcb, sp->auth_keyid); \
+ (_strmoq)->holds_key_ref = 0; \
+ } \
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), (_strmoq)); \
SCTP_DECR_STRMOQ_COUNT(); \
}
@@ -94,11 +98,15 @@ extern struct pr_usrreqs sctp_usrreqs;
(_strmoq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_strmoq), struct sctp_stream_queue_pending); \
if ((_strmoq)) { \
SCTP_INCR_STRMOQ_COUNT(); \
+ (_strmoq)->holds_key_ref = 0; \
} \
}
-
#define sctp_free_a_chunk(_stcb, _chk) { \
+ if ((_chk)->holds_key_ref) {\
+ sctp_auth_key_release((_stcb), (_chk)->auth_keyid); \
+ (_chk)->holds_key_ref = 0; \
+ } \
if(_stcb) { \
SCTP_TCB_LOCK_ASSERT((_stcb)); \
if ((_chk)->whoTo) { \
@@ -126,21 +134,22 @@ extern struct pr_usrreqs sctp_usrreqs;
if ((_chk)) { \
SCTP_INCR_CHK_COUNT(); \
(_chk)->whoTo = NULL; \
+ (_chk)->holds_key_ref = 0; \
} \
} else { \
(_chk) = TAILQ_FIRST(&(_stcb)->asoc.free_chunks); \
TAILQ_REMOVE(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \
atomic_subtract_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \
+ (_chk)->holds_key_ref = 0; \
SCTP_STAT_INCR(sctps_cached_chk); \
(_stcb)->asoc.free_chunk_cnt--; \
} \
}
-
#define sctp_free_remote_addr(__net) { \
if ((__net)) { \
- if (atomic_fetchadd_int(&(__net)->ref_count, -1) == 1) { \
+ if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \
(void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \
(void)SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \
(void)SCTP_OS_TIMER_STOP(&(__net)->fr_timer.timer); \
@@ -160,64 +169,18 @@ extern struct pr_usrreqs sctp_usrreqs;
} \
}
-#ifdef INVARIANTS
-
-
#define sctp_sbfree(ctl, stcb, sb, m) { \
- uint32_t val; \
- val = atomic_fetchadd_int(&(sb)->sb_cc,-(SCTP_BUF_LEN((m)))); \
- if (val < SCTP_BUF_LEN((m))) { \
- panic("sb_cc goes negative"); \
- } \
- val = atomic_fetchadd_int(&(sb)->sb_mbcnt,-(MSIZE)); \
- if (val < MSIZE) { \
- panic("sb_mbcnt goes negative"); \
- } \
+ SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \
+ SCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \
if (((ctl)->do_not_ref_stcb == 0) && stcb) {\
- val = atomic_fetchadd_int(&(stcb)->asoc.sb_cc,-(SCTP_BUF_LEN((m)))); \
- if (val < SCTP_BUF_LEN((m))) {\
- panic("stcb->sb_cc goes negative"); \
- } \
- val = atomic_fetchadd_int(&(stcb)->asoc.my_rwnd_control_len,-(MSIZE)); \
- if (val < MSIZE) { \
- panic("asoc->mbcnt goes negative"); \
- } \
+ SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \
+ SCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \
} \
if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \
SCTP_BUF_TYPE(m) != MT_OOBDATA) \
atomic_subtract_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \
}
-
-#else
-
-#define sctp_sbfree(ctl, stcb, sb, m) { \
- uint32_t val; \
- val = atomic_fetchadd_int(&(sb)->sb_cc,-(SCTP_BUF_LEN((m)))); \
- if (val < SCTP_BUF_LEN((m))) { \
- (sb)->sb_cc = 0;\
- } \
- val = atomic_fetchadd_int(&(sb)->sb_mbcnt,-(MSIZE)); \
- if (val < MSIZE) { \
- (sb)->sb_mbcnt = 0; \
- } \
- if (((ctl)->do_not_ref_stcb == 0) && stcb) {\
- val = atomic_fetchadd_int(&(stcb)->asoc.sb_cc,-(SCTP_BUF_LEN((m)))); \
- if (val < SCTP_BUF_LEN((m))) {\
- (stcb)->asoc.sb_cc = 0; \
- } \
- val = atomic_fetchadd_int(&(stcb)->asoc.my_rwnd_control_len,-(MSIZE)); \
- if (val < MSIZE) { \
- (stcb)->asoc.my_rwnd_control_len = 0; \
- } \
- } \
- if (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \
- SCTP_BUF_TYPE(m) != MT_OOBDATA) \
- atomic_subtract_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \
-}
-
-#endif
-
#define sctp_sballoc(stcb, sb, m) { \
atomic_add_int(&(sb)->sb_cc,SCTP_BUF_LEN((m))); \
atomic_add_int(&(sb)->sb_mbcnt, MSIZE); \
OpenPOWER on IntegriCloud