9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* seq_within
@ 1995-09-27 15:51 Michael
  0 siblings, 0 replies; 2+ messages in thread
From: Michael @ 1995-09-27 15:51 UTC (permalink / raw)


here's how i interpret the logic of the proposed code:

if low is greater than high, then 'low' assumes the high value, and=20
'high' assumes the low value. (in effect, swap low and high)

> =09=09if(low >=3D x && x >=3D high)

the original executes if:

high is greater than x (x is less than the upper bound)
AND
x is greater than the lower bound=20

so the original executes if x is within the desired range.

(remember i am swapping low and high because of the assumption low>high)
the proposed change executes if:

> =09=09if(x >=3D low || x <=3D high)

x is greater than the upper bound=20
OR
x is less than the lower bound

so the proposed change executes if x is outside the range set by high and=
=20
low.  (remember the assumption that low > high)

i don't know enough to know what this code is for (or does!) but i hope=20
my interpretation does some good.

Mike

Mike Yockey=09=09=09myockey@ece.arizona.edu
UNIX System Administrator=09Electrical and Computer Engineering Department
The University of Arizona=09Tucson, Arizona
page me: page_mike@vanzandt.amd.com
"Madness takes its toll.  Please have exact change."
*** This message contains a minimum of 15% post-consumer electrons. ***

On Tue, 26 Sep 1995 forsyth@plan9.cs.york.ac.uk wrote:

> does anyone else think the definition of seq_within in /sys/src/9/port/tc=
pinput.c
> is wrong?  i think the test when low > high should be
> =09=09if(x >=3D low || x <=3D high)
> not
> =09=09if(low >=3D x && x >=3D high)
>=20
> i think as it stands it is checking the wrong interval.  consider its app=
lication in
>=20
> =09seq_within(seg.ack, tcb->snd.una+1, tcb->snd.nxt)
>=20
>=20
> tcb->snd.una+1 > tcb->snd.nxt when the sequence numbers have wrapped roun=
d 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
> =09[tcb->snd.una+1, ~0] =E2=88=AA [0, tcb->snd.nxt]
> not (as seq_within currently has it) those in
> =09[tcb->snd.nxt, tcb->snd.una+1]
>=20
>=20
>=20






^ permalink raw reply	[flat|nested] 2+ messages in thread

* seq_within
@ 1995-09-26 22:09 forsyth
  0 siblings, 0 replies; 2+ messages in thread
From: forsyth @ 1995-09-26 22:09 UTC (permalink / raw)


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]







^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-09-27 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-09-27 15:51 seq_within Michael
  -- strict thread matches above, loose matches on Subject: below --
1995-09-26 22:09 seq_within forsyth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).