
jmvpnc at loplof
Jan 21, 2008, 6:02 PM
Post #3 of 7
(438 views)
Permalink
|
On Mon, Jan 14, 2008 at 10:16:27AM +0100, Martin von Gagern wrote: > Martin von Gagern wrote: > >In the meantime, I'd be interested in a feature like the persist option > >of pppd. There should be a way to configure a permanent VPN connection, > >and to have vpnc try reestablish that whenever it gets lost. > > I hacked a bit of code, and what I have now seems to work well enough. > At least it keeps running here despite a forced DSL disconnect every > 24h, and according to lsof there seem to be no stale open file descriptors. Good. I'm just afraid that it will add additional memory leaks - yes, there are some :-/ but we do not need to add new ones. Can you please test that (e.g. run with valgrind). > The patch causes large parts of the main body to run in a loop. It > reestablishes connection when it receives a SIGUSR1. There is also a new > option, Persist aka. --persist, which causes connection reestablishment > for the -1 and -2 values of do_kill, where -2 is the dpd that kept > bugging me. Very nice. > The SIGUSR1 feature is yet undocumented. Please provide a patch. Also, please document the return codes. > The loop body in main is poorly > indented, as I didn't want to distract from the main parts of the > modification by changing that much whitespace. Should be indented when > it gets applied. I'm glad you didn't indent yet, it makes the patch much easier to read. Please don't indent later patches, I'll apply in two phases so that the core of the patch will remain easy to read. > Comments appreciated. Feel free to apply if you agree this is ready enough. Comments on code inline. > --- config.c (revision 278) > +++ config.c (working copy) > + CONFIG_PERSIST, 0, 1, > + "--persist", > + "Persist", > + NULL, > + "Reconnect when connection is lost", > + NULL > + }, { > + opt_persist = (config[CONFIG_PERSIST]) ? 1 : 0; IMO persist should be assigend a value like true/false or on/off. The default should be true/on. > Index: vpnc.c > =================================================================== > --- vpnc.c (revision 278) > +++ vpnc.c (working copy) > @@ -37,6 +37,7 @@ > #include <poll.h> > #include <sys/ioctl.h> > #include <sys/utsname.h> > +#include <signal.h> > > #include <gcrypt.h> > > @@ -199,6 +200,13 @@ > fcntl(sock, F_SETFD, FD_CLOEXEC); > #endif > > +#ifdef SO_REUSEADDR > + if (opt_persist) { Why not set this unconditionally, no matter whether opt_persist is set or not? Thanks! Joerg -- Joerg Mayer <jmayer[at]loplof.de> We are stuck with technology when what we really want is just stuff that works. Some say that should read Microsoft instead of technology. _______________________________________________ vpnc-devel mailing list vpnc-devel[at]unix-ag.uni-kl.de https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel http://www.unix-ag.uni-kl.de/~massar/vpnc/
|