Re: Stunnel 5.44 server side 'exec = pppd' runs second child 'pppd' process after reconnection. Bug?

Florian Lohoff <[email protected]> Tue, 14 May 2019 09:57:07 +0200
Newsgroups gmane.network.stunnel.user
Organization rfc822 - pure communication
Message-ID <[email protected]>
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
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEdb9o7oebX2papQ/KkN1BIMsJ8i8FAlzadNIACgkQkN1BIMsJ
8i9mUw//R13jefBa/gxTVIvsMjWJhqsjeDu5pjdBtnxV0ohJiK+CkcpLIK4h9CkX
fbOZ/IVSc2nvMI9t/eTkdx3fAYgtTQ2ug/IylVbUEG350dmx/cKDQ6pqi+9DZFLT
P5xhyhZ3JYiWgY2n1OjBa6HEWovlsC16o6Pg9cv/QYy3NwNdvxEXeotO47KIlpbM
iAmW36lQzuGw2ykXreIjPxACsc/2MOYRCngwQ9h4YUOiIr3t39TtlJoqe288OGXw
xFg1jOL7++0/wFEnq+4iXDZfQSM3pVOWdA/yjH+tVTSTjv5lf1+uCc+oAzk0Cd/q
gLjsC0sIq7zEXZ4gWiR+KcsCTvwRMtL5IzvnehjzPQbK9AWZeN3TuzLt0oF4LVJX
YUx9QEBDSJwpLEZAzizPXktpvV0QuzS39VZPkG8AdaXU2HO+27LUUEr4LhL4+/vn
sa1xnaJGj8RrQCaLt2OUrd4k7EInno6byZOuhLO7CmEs2nBbMu0zT1LAMkeWZ5Rc
va0o27j6mjvFtunAZftu6PVmfgdFKr27T7/SP0+FYUNIHJ2GudrbeVaO/5M04euh
pWWiq9O+OAOWUTA08zEoE4ZjwW9keT5W/Hg2Y3Z3N9wxQxZ4TP/S6me27IzrjJ+R
eSRBVu8EzIlNnvEIqNrqw2Kv8k/MPIdIgKdgy3ckuubDhS/v6QM=
=gSVw
-----END PGP SIGNATURE-----