That is not a bad idea.  I'd wrap it in a C program so I could check if the 
pppd is alive and not a zombie.  BUT -- it begs the question, why only ONE?  
Every time this happens the process ID would change.  Is it serialization or?  
I am thinking there is something we don't know ... I have offered Martin some 
help ...

E

-----Original Message-----
From: stunnel-users [mailto:[email protected]] On Behalf Of 
Florian Lohoff
Sent: Tuesday, May 14, 2019 12:57 AM
To: Martin Got <[email protected]>
Cc: [email protected]
Subject: Re: [stunnel-users] Stunnel 5.44 server side 'exec = pppd' runs second 
child 'pppd' process after reconnection. Bug?


Hola,

On Mon, May 13, 2019 at 04:07:57PM +0000, Martin Got wrote:
> So second 'pppd' process started and runs simultaneously with the 
> first 'pppd' and link down. Restarting Stunnel server can clear child 
> 'pppd' processes. So newly reestablished 'pppd' link between 10.0.1.1 
> <--> 10.0.1.2 endpoints works till next interconnection.

You might have multiple options - You could use the parameters like peer passed 
to ip-up.d scripts use to kill the other instance on ip-up.

Run pppd through a wrapper to kill the old instance. Use linkname to write a 
specific pid file.

        #!/bin/sh
        linkname=test
        [ ! -f /var/run/ppp-${linkname}.pid ] || kill $(cat 
/var/run/ppp-${linkname}.pid)
        exec pppd linkname ${linkname} $*

Or you could use the routing table to find the interface and kill the pppd 
based on that.

        #!/bin/sh
        iface=$(ip -o r get ${REMOTE_IP_ADDRESS}  | sed -e 's/.*dev //' -e 's/ 
.*$//')
        [ -z ${iface} ] || kill $(cat /var/run/ppp-${iface}.pid) ]
        exec pppd $*

Both completely untested.

I would at least configure lcp-echo-failure and lcp-echo-interval so the old 
pppd instance will soon die because of the missing connection.
IIRC the default is 3/10 so after 30 seconds the old instance will die anyway.

> pppd[39187] pppd 2.3.5 started by user, uid 0 pppd[43231] Using 
> interface ppp1 pppd[43231] Connect: ppp0 <--> /dev/ttyp2 pppd[43231] 
> Local IP address 10.0.1.1 pppd[43231] Remote IP address 10.0.1.2 
> pppd[39187] pppd 2.3.5 started by user, uid 0 pppd[39187] Using 
> interface ppp0 pppd[39187] Connect: ppp0 <--> /dev/ttyp5 pppd[39187] 
> Couldn't set interface address: Address 10.0.1.1 or destination 
> 10.0.1.2 already exists

Flo
-- 
Florian Lohoff                                                 [email protected]
        UTF-8 Test: The 🐈 ran after a 🐁, but the 🐁 ran away


_______________________________________________
stunnel-users mailing list
[email protected]
https://www.stunnel.org/cgi-bin/mailman/listinfo/stunnel-users

Reply via email to