
ricky at rzhou
Jun 8, 2009, 11:57 PM
Post #1 of 1
(681 views)
Permalink
|
|
[SPAM] vpnc error handling and cleanup
|
|
Hi, currently, a lot of error handling is done by error() calls in vpnc.c, which leads to several cases where vpnc exits without cleaning up after itself (for example, calling vpnc-script to restore /etc/resolv.conf). One common way that this is triggered for me is having my computer shut down without vpnc being shutdown explicitly. By the time the shutdown scripts try to kill -TERM vpnc, the network is already down, which causes vpnc to exit with "can't send packet" in the sendrecv function before vpnc-script is run. I have a first (hideous and scary) attempt at a patch against SVN trunk at http://ricky.fedorapeople.org/vpnc/vpnc.patch. I don't really expect this atexit hack to be accepted as it is now - it probably causes failures in a bunch of situations that I didn't test. I do hope that this will bring some attention to this issue though, and maybe some more experienced/knowledgeable people might have some suggestions on how to do this properly. One option I looked was making all of the functions that call error() return a status code instead, and adding error checking to all calls of these functions, but this was a pretty huge refactoring that I eventually gave up on - error() is called almost 40 times in just vpnc.c :-/ Maybe this is what eventually needs to be done though. Thanks, and I hope this is useful, Ricky
|