From: "'Marcelo Ricardo Leitner'" <marcelo.leitner@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-sctp@vger.kernel.org" <linux-sctp@vger.kernel.org>,
Neil Horman <nhorman@tuxdriver.com>,
Vlad Yasevich <vyasevich@gmail.com>
Subject: Re: [PATCH next 1/2] sctp: fix the handling of SACK Gap Ack blocks
Date: Wed, 21 Sep 2016 11:01:30 +0000 [thread overview]
Message-ID: <20160921110130.GD9323@localhost.localdomain> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DB0105BBB@AcuExch.aculab.com>
On Wed, Sep 21, 2016 at 10:21:43AM +0000, David Laight wrote:
> From: Marcelo Ricardo Leitner
> > Sent: 20 September 2016 22:19
> > sctp_acked() is using 32bit arithmetics on 16bits vars, via TSN_lte()
> > macros, which is weird and confusing.
> >
> > Once the offset to ctsn is calculated, all wrapping is already handled
> > and thus to verify the Gap Ack blocks we can just use pure
> > less/big-or-equal than checks.
> >
> > Also, rename gap variable to tsn_offset, so it's more meaningful, as
> > it doesn't point to any gap at all.
> >
> > Even so, I don't think this discrepancy resulted in any practical bug.
>
> I think it might if gab.start/end are greater than 32767
Why? Mind sharing a case that it goes wrong?
Marcelo
>
> ...
> > - 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);
> > + tsn_offset = tsn - ctsn;
> > + for (i = 0; i < blocks; ++i) {
> > + if (tsn_offset >= ntohs(frags[i].gab.start) &&
> > + tsn_offset <= ntohs(frags[i].gab.end))
> ...
>
> David
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
WARNING: multiple messages have this Message-ID (diff)
From: "'Marcelo Ricardo Leitner'" <marcelo.leitner@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-sctp@vger.kernel.org" <linux-sctp@vger.kernel.org>,
Neil Horman <nhorman@tuxdriver.com>,
Vlad Yasevich <vyasevich@gmail.com>
Subject: Re: [PATCH next 1/2] sctp: fix the handling of SACK Gap Ack blocks
Date: Wed, 21 Sep 2016 08:01:30 -0300 [thread overview]
Message-ID: <20160921110130.GD9323@localhost.localdomain> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DB0105BBB@AcuExch.aculab.com>
On Wed, Sep 21, 2016 at 10:21:43AM +0000, David Laight wrote:
> From: Marcelo Ricardo Leitner
> > Sent: 20 September 2016 22:19
> > sctp_acked() is using 32bit arithmetics on 16bits vars, via TSN_lte()
> > macros, which is weird and confusing.
> >
> > Once the offset to ctsn is calculated, all wrapping is already handled
> > and thus to verify the Gap Ack blocks we can just use pure
> > less/big-or-equal than checks.
> >
> > Also, rename gap variable to tsn_offset, so it's more meaningful, as
> > it doesn't point to any gap at all.
> >
> > Even so, I don't think this discrepancy resulted in any practical bug.
>
> I think it might if gab.start/end are greater than 32767
Why? Mind sharing a case that it goes wrong?
Marcelo
>
> ...
> > - 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);
> > + tsn_offset = tsn - ctsn;
> > + for (i = 0; i < blocks; ++i) {
> > + if (tsn_offset >= ntohs(frags[i].gab.start) &&
> > + tsn_offset <= ntohs(frags[i].gab.end))
> ...
>
> David
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2016-09-21 11:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-20 21:19 [PATCH next 0/2] improvements to SSN and TSN handling Marcelo Ricardo Leitner
2016-09-20 21:19 ` Marcelo Ricardo Leitner
2016-09-20 21:19 ` [PATCH next 1/2] sctp: fix the handling of SACK Gap Ack blocks Marcelo Ricardo Leitner
2016-09-20 21:19 ` Marcelo Ricardo Leitner
2016-09-21 10:21 ` David Laight
2016-09-21 11:01 ` 'Marcelo Ricardo Leitner' [this message]
2016-09-21 11:01 ` 'Marcelo Ricardo Leitner'
2016-09-20 21:19 ` [PATCH next 2/2] sctp: improve how SSN, TSN and ASCONF serial are compared Marcelo Ricardo Leitner
2016-09-20 21:19 ` Marcelo Ricardo Leitner
2016-09-23 10:55 ` [PATCH next 0/2] improvements to SSN and TSN handling David Miller
2016-09-23 10:55 ` David Miller
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=20160921110130.GD9323@localhost.localdomain \
--to=marcelo.leitner@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=vyasevich@gmail.com \
/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.