Bugzilla – Bug 828
PacketSocket::Close does not unregister protocol handler
Last modified: 2010-05-30 23:55:29 UTC
It seems that PacketSocket::Close doesn't work properly for me - I kept getting segfaults when packets are attempted to be forwarded through closed sockets that had already had the memory deallocated. During a typical lifetime of a PacketSocket, the protocal handler is registered in the function PacketSocket::DoBind, executed on transiting from STATE_OPEN to STATE_BOUND. When transiting from STATE_BOUND to STATE_CONNECTED, the protocol remains registered. In order to clean up properly, the PacketSocket should unregister the protocol handler on close for the transitions STATE_BOUND->STATE_CLOSED and STATE_CONNECTED->STATE_CLOSED. Platform and version: NS-3.7 on Linux 2.6.31-14 (amd64), gcc 4.4.1 Have not developed test code to reproduce the segfault.
Created attachment 774 [details] Proposed patch.
Possibly related #649, #650
Patch not yet applied to ns-3-dev or ns-3.8.
I'll apply this in a day or so after testing, but just cc'ing ns-bugs in the meantime in case anyone has a comment.
changeset: 7476f746ba5d