RE: [PATCH net] sctp: fix SSN comparision

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Looks like gap.start/end should be saved in host order though.

	David

--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Networking Development]     [Linux OMAP]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux