#621 [PATCH] : Fix external fd handling


Attached is a fix to a file descriptor handling bug.
Without this fix an external handler may end up
processing a file decriptor which is not truly ready
for the handler. This could result in, for example, a
blocking read on a file descriptor which has no data

I don't particularily like the way this fix is
implemented, but have not come up with a better way of
doing it.

The basic idea is that we need to expire the fd_sets
returned from select() if we have reason to believe
that the bits may no longer be correct. If an external
handler calls unregister_{read|write|except}fd() while
we are processing pending fd's we need to stop
processing immediately. The unregistered file
descriptor may have been allocated for a different
purpose. In any case the read/write/except status
returned by select is now stale. We must call select again.

We are using net-snmp 5.2.pre2. Below is my attempt to
apply the fix we needed on 5.2.pre2 to current cvs. I
haven't actually tested the merge into cvs head, but
the changes between 5.2.pre2 and current cvs in this
area are not that large so I am counting on my 5.2.pre2


  • Wes Hardaker

    Wes Hardaker - 2006-04-10

    Logged In: YES

    Thanks for the patch! It has been applied to the 5.3.x
    code branches and the main development tree, and
    will appear in future releases of the net-snmp package.


Log in to post a comment.