aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2020-10-04 15:22:14 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2020-10-04 15:22:14 +0000
commitd0ed75b3b1119db8160110df29183817f7017423 (patch)
tree1972e4ae0665c537370c8a8f296a049828a1f2fc
parent1b95005e950b8f683aca88056a15a7252ca919d5 (diff)
downloadsrc-d0ed75b3b1119db8160110df29183817f7017423.tar.gz
src-d0ed75b3b1119db8160110df29183817f7017423.zip
Cleanup, no functional change intended.
MFC after: 3 days
Notes
Notes: svn path=/head/; revision=366425
-rw-r--r--sys/netinet/sctp_indata.c52
1 files changed, 22 insertions, 30 deletions
diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c
index 8100d7fb2d7a..bbdd1c4fd96d 100644
--- a/sys/netinet/sctp_indata.c
+++ b/sys/netinet/sctp_indata.c
@@ -285,17 +285,15 @@ sctp_build_ctl_nchunk(struct sctp_inpcb *inp, struct sctp_sndrcvinfo *sinfo)
static void
sctp_mark_non_revokable(struct sctp_association *asoc, uint32_t tsn)
{
- uint32_t gap, i, cumackp1;
- int fnd = 0;
- int in_r = 0, in_nr = 0;
+ uint32_t gap, i;
+ int in_r, in_nr;
if (SCTP_BASE_SYSCTL(sctp_do_drain) == 0) {
return;
}
- cumackp1 = asoc->cumulative_tsn + 1;
- if (SCTP_TSN_GT(cumackp1, tsn)) {
+ if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) {
/*
- * this tsn is behind the cum ack and thus we don't need to
+ * This tsn is behind the cum ack and thus we don't need to
* worry about it being moved from one to the other.
*/
return;
@@ -303,33 +301,27 @@ sctp_mark_non_revokable(struct sctp_association *asoc, uint32_t tsn)
SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn);
in_r = SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap);
in_nr = SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, gap);
- if ((in_r == 0) && (in_nr == 0)) {
-#ifdef INVARIANTS
- panic("Things are really messed up now");
-#else
- SCTP_PRINTF("gap:%x tsn:%x\n", gap, tsn);
- sctp_print_mapping_array(asoc);
-#endif
- }
- if (in_nr == 0)
+ KASSERT(in_r || in_nr, ("%s: Things are really messed up now", __FUNCTION__));
+ if (!in_nr) {
SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
- if (in_r)
+ if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
+ asoc->highest_tsn_inside_nr_map = tsn;
+ }
+ }
+ if (in_r) {
SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap);
- if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
- asoc->highest_tsn_inside_nr_map = tsn;
- }
- if (tsn == asoc->highest_tsn_inside_map) {
- /* We must back down to see what the new highest is */
- for (i = tsn - 1; SCTP_TSN_GE(i, asoc->mapping_array_base_tsn); i--) {
- SCTP_CALC_TSN_TO_GAP(gap, i, asoc->mapping_array_base_tsn);
- if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) {
- asoc->highest_tsn_inside_map = i;
- fnd = 1;
- break;
+ if (tsn == asoc->highest_tsn_inside_map) {
+ /* We must back down to see what the new highest is. */
+ for (i = tsn - 1; SCTP_TSN_GE(i, asoc->mapping_array_base_tsn); i--) {
+ SCTP_CALC_TSN_TO_GAP(gap, i, asoc->mapping_array_base_tsn);
+ if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) {
+ asoc->highest_tsn_inside_map = i;
+ break;
+ }
+ }
+ if (!SCTP_TSN_GE(i, asoc->mapping_array_base_tsn)) {
+ asoc->highest_tsn_inside_map = asoc->mapping_array_base_tsn - 1;
}
- }
- if (!fnd) {
- asoc->highest_tsn_inside_map = asoc->mapping_array_base_tsn - 1;
}
}
}