From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Tue, 26 Sep 1995 18:09:57 -0400 From: forsyth@plan9.cs.york.ac.uk forsyth@plan9.cs.york.ac.uk Subject: seq_within Topicbox-Message-UUID: 279e64b4-eac8-11e9-9e20-41e7f4b1d025 Content-Type: text/plain; charset=UTF-8 Message-ID: <19950926220957.35haFcNhFuo0-Zf4MTME9GnIu-U2JneyKb_zLdvRL4k@z> does anyone else think the definition of seq_within in /sys/src/9/port/tcpinput.c is wrong? i think the test when low > high should be if(x >= low || x <= high) not if(low >= x && x >= high) i think as it stands it is checking the wrong interval. consider its application in seq_within(seg.ack, tcb->snd.una+1, tcb->snd.nxt) tcb->snd.una+1 > tcb->snd.nxt when the sequence numbers have wrapped round zero, increasing from tcb->snd.una+1 past ~0 to 0 then on to tcb->snd.nxt. in other words, the valid ack sequence numbers are those in [tcb->snd.una+1, ~0] ∪ [0, tcb->snd.nxt] not (as seq_within currently has it) those in [tcb->snd.nxt, tcb->snd.una+1]