TCP: backport out of order packet detection algorithm from master branch

Change-Id: I20ec27a1dc226b412eaa1caddb66b6b7caafbe4e
Reviewed-on: https://code.wireshark.org/review/2847
Reviewed-by: Anders Broman <a.broman58@gmail.com>