Re: potential bug in David Brownell's zcip code

Michael Schmidt <[email protected]> Thu, 23 Dec 2004 20:49:55 +0100
Newsgroups gmane.network.zeroconf.workers
Organization University of Siegen
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi David,

|>b)
|>This code may erroneously assume that the timeout has elapsed, if an
|>unexpected ARP packet arrives within the regular, finite timeout
(still in
|>the protocol negotiation phase), and the OS preempts the zcip code
between
|>the return of 'poll()' and the timeout recalculation above. When the
code is
|>reactivated by the scheduler, the timeout may indeed have elapsed, and
|>'timercmp(&tv1, &tv2, <)' will hold true. In this case, the code will
|>erroneously assume that the protocol negotiation phase is finished,
and will
|>set the subsequent timeout to -1 (infinite). zcip will seem to hang.
|
|
| Eventually that should be fixed by implementing the relevant
| SO_ATTACH_FILTER logic, so that only relevant ARP packets can
| ever get past the poll() logic.  I'd be interested in a fix
| for that; its certainly not something I'll have time to do,
| but it'll be very important on networks that have more than
| a handful of machines.

This surely would be the best solution...


|>I have fixed the problem by replacing 'poll()' with 'select()' and by
|>simplifying the timeout recalculation (which is an obvious consequence of
|>using 'select()'. 'select()# returns with the timeout parameter
containing
|>the remaining timeout value when it is woken up by a packet before the
|>timeout has elapsed. This value can directly be used for re-invoking
|>'select()'. Please note that this behavior is only implemented in
Linux, but
|>not in other Unices, so that my patch is not compatible with other Unices.
|
|
| Which is why I don't much like that solution!

Alternatively, timeout recalculation could be based on protocol state
variables (due to the zcip state machine), so that the code couldn't
erroneously run into an infinite wait state.


I'm happy with my current code, wich is project-specific, and contains
several modifications to your code anyway (this is to say I'm not going
to work on the zcip code any further...).

Besides that, thanks a lot for assisting me with my problems (and for
providing this code at all...).


Happy holidays!

Michael

- --
============================================
Michael Schmidt
- --------------------------------------------
Institute for Digital Communications Systems
University of Siegen, Germany
- --------------------------------------------
http:   www.dcs.uni-siegen.de
e-mail: [email protected]
============================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFByyFiQxcxBvLsRaoRApo6AJ9DnhxwCmJKUaU6vD6NCkAepwFapACePQ66
nfyg2vSD7oP4PG55ie6J9LU=
=TiT1
-----END PGP SIGNATURE-----


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/