Mailing List Archive

vpnc disconnect on Ubuntu doesn't call vpnc-script
Hi,

I am using vpnc-0.5.3r512-2ubuntu1 on 64 bit ubuntu.

I amended the vpnc-script as follows:

root@Work:~# head /etc/vpnc/vpnc-script
#!/bin/sh
echo "Calling /etc/vpnc/vpnc-script with reason $reason" | ts >>
/root/reconnect.log
# List of parameters passed through environment
#* reason -- why this script was called, one of:
pre-init connect disconnect
...

e.g. I added the echo line.

This is the current content of /root/reconnect.log

root@Work:~# cat reconnect.log
Jul 31 06:48:36 Calling /etc/vpnc/vpnc-script with reason pre-init
Jul 31 06:48:37 Calling /etc/vpnc/vpnc-script with reason connect
Aug 01 06:47:28 Calling /etc/vpnc/vpnc-script with reason pre-init
Aug 01 06:47:28 Calling /etc/vpnc/vpnc-script with reason connect

e.g. for some reason I did not get a callback on disconnect.

What could be the reason? How do I go about finding the problem?

Thanks,
Florian

--
Florian Burkart
florian.burkart@gmail.com
Re: vpnc disconnect on Ubuntu doesn't call vpnc-script [ In reply to ]
Hi Florian

On Thu, Aug 2, 2012 at 12:51 AM, Florian Burkart
<florian.burkart@gmail.com> wrote:
> Hi,
>
> I am using vpnc-0.5.3r512-2ubuntu1 on 64 bit ubuntu.
>
> I amended the vpnc-script as follows:
>
> root@Work:~# head /etc/vpnc/vpnc-script
> #!/bin/sh
> echo "Calling /etc/vpnc/vpnc-script with reason $reason" | ts >>
> /root/reconnect.log
> # List of parameters passed through environment
> #* reason -- why this script was called, one of:
> pre-init connect disconnect
> ...
>
> e.g. I added the echo line.
>
> This is the current content of /root/reconnect.log
>
> root@Work:~# cat reconnect.log
> Jul 31 06:48:36 Calling /etc/vpnc/vpnc-script with reason pre-init
> Jul 31 06:48:37 Calling /etc/vpnc/vpnc-script with reason connect
> Aug 01 06:47:28 Calling /etc/vpnc/vpnc-script with reason pre-init
> Aug 01 06:47:28 Calling /etc/vpnc/vpnc-script with reason connect
>
> e.g. for some reason I did not get a callback on disconnect.
>
> What could be the reason? How do I go about finding the problem?

In vpnc there are 50+ calls to error(), that cause vpnc to exit
without calling disconnect script.
Alon proposed a patch based on atexit() to intercept these cases.
http://www.gossamer-threads.com/lists/vpnc/devel/3778
I prefer a replacement of exit() calls but, due to limited time by my
side and lack of alternatives, I'm going to commit Alon's patch as is.

Best Regards,
Antonio Borneo
_______________________________________________
vpnc-devel mailing list
vpnc-devel@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/
Re: vpnc disconnect on Ubuntu doesn't call vpnc-script [ In reply to ]
On Thu, Aug 2, 2012 at 3:26 AM, Antonio Borneo <borneo.antonio@gmail.com> wrote:
> Hi Florian
>
> On Thu, Aug 2, 2012 at 12:51 AM, Florian Burkart
> <florian.burkart@gmail.com> wrote:
>> Hi,
>>
>> I am using vpnc-0.5.3r512-2ubuntu1 on 64 bit ubuntu.
>>
>> I amended the vpnc-script as follows:
>>
>> root@Work:~# head /etc/vpnc/vpnc-script
>> #!/bin/sh
>> echo "Calling /etc/vpnc/vpnc-script with reason $reason" | ts >>
>> /root/reconnect.log
>> # List of parameters passed through environment
>> #* reason -- why this script was called, one of:
>> pre-init connect disconnect
>> ...
>>
>> e.g. I added the echo line.
>>
>> This is the current content of /root/reconnect.log
>>
>> root@Work:~# cat reconnect.log
>> Jul 31 06:48:36 Calling /etc/vpnc/vpnc-script with reason pre-init
>> Jul 31 06:48:37 Calling /etc/vpnc/vpnc-script with reason connect
>> Aug 01 06:47:28 Calling /etc/vpnc/vpnc-script with reason pre-init
>> Aug 01 06:47:28 Calling /etc/vpnc/vpnc-script with reason connect
>>
>> e.g. for some reason I did not get a callback on disconnect.
>>
>> What could be the reason? How do I go about finding the problem?
>
> In vpnc there are 50+ calls to error(), that cause vpnc to exit
> without calling disconnect script.
> Alon proposed a patch based on atexit() to intercept these cases.
> http://www.gossamer-threads.com/lists/vpnc/devel/3778
> I prefer a replacement of exit() calls but, due to limited time by my
> side and lack of alternatives, I'm going to commit Alon's patch as is.

Hello Antonio,

I will be happy to provide a different solution.

But, creating a simple wrapper of exit() will reach the same
implementation of atexit(), unless you thought of some other
implementation which I don't understand.

I mean, if I do 's/exit/vpnc_exit/g', then write:
---
void vpnc_exit(int status) {
vpnc_cleanup();
exit(status);
}
---

As far as I know It is better to use atexit() for this task, as it is
the standard approach to reach the same.

Regards,
Alon.
_______________________________________________
vpnc-devel mailing list
vpnc-devel@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/