From: "'Marcelo Ricardo Leitner'" <marcelo.leitner@gmail.com>
To: linux-sctp@vger.kernel.org
Subject: Re: [PATCH net] sctp: fix SSN comparision
Date: Mon, 19 Sep 2016 16:02:55 +0000 [thread overview]
Message-ID: <20160919160255.GA9323@localhost.localdomain> (raw)
In-Reply-To: <9f22e4725d836feda1b2c2483303adb30838216f.1473962178.git.marcelo.leitner@gmail.com>
On Mon, Sep 19, 2016 at 10:41:34AM +0000, David Laight wrote:
> From: 'Marcelo Ricardo Leitner'
> > Sent: 16 September 2016 18:22
> ...
> > frags = sack->variable;
> > - gap = tsn - ctsn;
> > - for (i = 0; i < ntohs(sack->num_gap_ack_blocks); ++i) {
> > - if (TSN_lte(ntohs(frags[i].gab.start), gap) &&
> > - TSN_lte(gap, ntohs(frags[i].gab.end)))
> > + blocks = ntohs(sack->num_gap_ack_blocks);
> > + for (i = 0; i < blocks; ++i) {
> > + if (TSN_lte(ctsn + ntohs(frags[i].gab.start), tsn) &&
> > + TSN_lte(tsn, ctsn + ntohs(frags[i].gab.end)))
> > goto pass;
>
> I think I now understand what all the values are!
> The correct test is just:
> if (gap > ntohs(frags[i].gab.start) &&
> gap <= ntohs(frags[i].gab.end))
> (I think the ends are right).
> gab.start/end are 16bit unsigned offsets from ctsn.
> All the module arithmetic is sorted out when 'tsn' is converted to an
> offset from ctsn. 'gap' is a very bad name for the tsn_offset.
Yep! I like this approach, thanks.
And in case tsn is actually smaller than ctsn in this code, than that's
another bug actually, so I think your suggestion covers all the cases.
Though the ends are both inclusive.
Handy https://tools.ietf.org/html/rfc4960#section-3.3.4 if you want.
>
> Looks like gap.start/end should be saved in host order though.
I lost you here. gab.start/end you mean? Saved?
Marcelo
next prev parent reply other threads:[~2016-09-19 16:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-15 18:02 [PATCH net] sctp: fix SSN comparision Marcelo Ricardo Leitner
2016-09-15 18:02 ` Marcelo Ricardo Leitner
2016-09-16 13:13 ` Neil Horman
2016-09-16 13:13 ` Neil Horman
2016-09-16 13:33 ` David Laight
2016-09-16 13:40 ` Marcelo Ricardo Leitner
2016-09-16 13:45 ` Marcelo Ricardo Leitner
2016-09-16 14:17 ` David Laight
2016-09-16 14:46 ` 'Marcelo Ricardo Leitner'
2016-09-16 14:53 ` 'Marcelo Ricardo Leitner'
2016-09-16 15:13 ` David Laight
2016-09-16 17:21 ` 'Marcelo Ricardo Leitner'
2016-09-17 14:00 ` David Miller
2016-09-17 14:00 ` David Miller
2016-09-19 10:41 ` David Laight
2016-09-19 16:02 ` 'Marcelo Ricardo Leitner' [this message]
2016-09-19 21:21 ` 'Marcelo Ricardo Leitner'
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160919160255.GA9323@localhost.localdomain \
--to=marcelo.leitner@gmail.com \
--cc=linux-sctp@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.