ppp icon indicating copy to clipboard operation
ppp copied to clipboard

First link in multilink bundle is not used after link termination until bundle termination

Open aleksandrgilfanov opened this issue 5 years ago • 5 comments

Problem can be reproduced in case of multilink with at least two links. Persist option must be enabled.

How to reproduce:

There are two hosts, each has two serial interfaces. ttyp1 of Host1 connected with ttyp1 of Host2 and ttyp2 of Host1 is connected with ttyp2 of Host2.

 ---------                --------
| Host1   |              |   Host2 |
|    ttyp1|--------------|ttyp1    |
|    ttyp2|--------------|ttyp2    |
 ---------                ---------

# /etc/ppp/options on each host
multilink
persist
lcp-echo-failure 1
lcp-echo-interval 1
holdoff 0
noauth
nodetach
debug
  1. Start first link pppd instances to create multilink bundle:
# Host1
pppd /dev/ttyp1 192.168.0.1:192.168.0.2
# Host2
pppd /dev/ttyp1

So, multilink bundle with first link is created, and these pppd instances become multilink masters:

# Host1
Using interface ppp0
New bundle ppp0 created
...
local  IP address 192.168.0.1
remote IP address 192.168.0.2
# Host2
Using interface ppp0
New bundle ppp0 create
...
local  IP address 192.168.0.2
remote IP address 192.168.0.1
  1. Add second link to bundle:
# Host1
pppd /dev/ttyp2
# Host2
pppd /dev/ttyp2

Second link is added to multilink bundle:

# Host1
Using interface ppp0
Link attached to ppp0
# Host2
Using interface ppp0
Link attached to ppp0
  1. Make first link broken somehow, e.g. cut or disconnect cable between ttyp1 serials. So, first link pppd instances are terminated:
# Host1:
No response to 1 echo-requests
Serial link appears to be disconnected.
sent [LCP TermReq id=0x2 "Peer not responding"]
sent [LCP TermReq id=0x3 "Peer not responding"]
Link terminated.
# Host2:
No response to 1 echo-requests
Serial link appears to be disconnected.
sent [LCP TermReq id=0x2 "Peer not responding"]
sent [LCP TermReq id=0x3 "Peer not responding"]
Link terminated.

Output shows that after link termination nothing happens. First pppd instances are just continuing to be multilink masters. All data in multilink bundle is going through second link now.

  1. And here is the problem. If we restore first link connection - then first pppd instances dont try to connect again, because it waits for bundle termination.

So, first link is not being used until multilink bundle termination. Multilink bundle termination happens only when all links are removed from bundle. Actually, if at least one link is alive at any moment, then it can never happens.

After bundle termination first pppd instances are trying to create or join bundle again, and finally, using first link.

NOTE:

For testing purposes, serial devices can be created using socat. For example, I used UDP4:

# Host1:
socat pty,link=/dev/ttyp1,raw,echo=0 UDP4-LISTEN:10001,bind=10.1.0.1,reuseaddr,fork &
socat pty,link=/dev/ttyp2,raw,echo=0 UDP4-LISTEN:10001,bind=10.2.0.1,reuseaddr,fork & 
# Host2:
socat pty,link=/dev/ttyp1,raw,echo=0 UDP4:10.1.0.1:10001 &
socat pty,link=/dev/ttyp2,raw,echo=0 UDP4:10.2.0.1:10001 &

Serial line disconnection can be emulated by downing bridge with network interfaces.

aleksandrgilfanov avatar Apr 04 '20 07:04 aleksandrgilfanov

It does seem reasonable that with the persist option the first pppd instance would continue to try to bring up its lower layer even when it is a multilink master.

paulusmack avatar Sep 04 '20 10:09 paulusmack

@aleksandrgilfanov: Have you seen the @paulusmack comment?

Neustradamus avatar Oct 25 '22 18:10 Neustradamus

@Neustradamus, yep - he agreed with this issue. If i recall correctly, I made some dirty workaround to fix this issue. I can try to find it if you need.

aleksandrgilfanov avatar Oct 25 '22 23:10 aleksandrgilfanov