Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1036816: vpnc-script doesn't run properly due to VPNPID

41 views
Skip to first unread message

Antoni Villalonga

unread,
May 26, 2023, 7:01:32 PM5/26/23
to
Package: vpnc-scripts
Version: 0.1~git20220510-1
Severity: normal

Dear Maintainer,

I'm testing to upgrade from Bullseye to Bookworm.

I think this bug is similar to #460822 bot not the same.

In my case vpnc-script runs fine on "connect" and the "resolv.conf" backup file
is saved.
On "disconnect" I've noticed it didn't restore de "resolv.conf" and thus a
major networking issue occurs.


I've noticed the "backup" file contains spaces and looks like this:
/var/run/vpnc/resolv.conf-backup. 12345

It smells very bad but may not lead to a problem...

After some debug near line 100 of vpnc-script, where VPNPID variable is set,
I've found that VPNPID value isn't the same on "connect" and "disconnect"
executions. This makes "resolv.conf" restoration process fail on "disconnect"
execution.

I've added the following line at the script:
| ps -ef > "/tmp/ps-$reason"

And after connect/disconnect I got this:
| % grep vpnc /tmp/ps-connect /tmp/ps-disconnect
| /tmp/ps-connect:root 60817 60814 0 22:15 pts/13 00:00:00 vpnc my.conf
| /tmp/ps-connect:root 60941 60817 0 22:16 pts/13 00:00:00 sh -c /usr/share/vpnc-scripts/vpnc-script
| /tmp/ps-connect:root 60942 60941 0 22:16 pts/13 00:00:00 /bin/sh /usr/share/vpnc-scripts/vpnc-script
| /tmp/ps-disconnect:root 61116 1 0 22:16 ? 00:00:00 vpnc my.conf
| /tmp/ps-disconnect:root 61153 61116 0 22:17 ? 00:00:00 sh -c /usr/share/vpnc-scripts/vpnc-script
| /tmp/ps-disconnect:root 61156 61153 0 22:17 ? 00:00:00 /bin/sh /usr/share/vpnc-scripts/vpnc-script


Let's loock at strace from "connect" process...
| % grep 61116 /tmp/strace-connect | head -n2
| 60817 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff2c14bfc10) = 61116
| 60817 write(1, "VPNC started in background (pid: 61116)...\n", 43 <unfinished ...>


So, my conclusion is that vpnc process (60817) forked into a new process
(61116) AFTER running vpnc-script. When "disconnect" process runs won't be able
to locate the "backup" file and the DNS resolution may fail.


My workaround (I only run one VPN at a time, like most people...):
| --- a 2022-05-12 19:15:11.000000000 +0000
| +++ b 2023-05-26 22:29:22.205185888 +0000
| @@ -99,7 +99,7 @@
| VPNPID=$PPID
| PCMD=`ps -c -o cmd= -p $PPID`
| case "$PCMD" in
| - *sh) VPNPID=`ps -o ppid= -p $PPID` ;;
| + *sh) VPNPID=FIXME ;;
| esac
| fi


Hope it can be fixed soon.

Kind regards,

--
Antoni Villalonga
https://friki.cat/

Antoni Villalonga

unread,
May 26, 2023, 7:41:49 PM5/26/23
to
Hi Again,

An alternative workaround is running vpnc with --no-detach.

Best regards,

On Fri, May 26, 2023 at 10:41:42PM +0000, Antoni Villalonga wrote:
> [...]
>
> My workaround (I only run one VPN at a time, like most people...):
> | --- a 2022-05-12 19:15:11.000000000 +0000
> | +++ b 2023-05-26 22:29:22.205185888 +0000
> | @@ -99,7 +99,7 @@
> | VPNPID=$PPID
> | PCMD=`ps -c -o cmd= -p $PPID`
> | case "$PCMD" in
> | - *sh) VPNPID=`ps -o ppid= -p $PPID` ;;
> | + *sh) VPNPID=FIXME ;;
> | esac
> | fi
>
> [...]
0 new messages