Skip to content

detect dead tunnel #285

@brianjmurrell

Description

@brianjmurrell

Hi.

I've been having problems with tunnels going dead. To be clear, the problem is not sshuttle outright dying -- it keeps running but nothing moves over the tunnel.

I suspect that this is not in fact sshuttle but the underlying transport stack (ssh, network, etc.) that is hanging up or timing out.

In looking at the debug output for sshuttle I see PING/PONG messages as such:

Oct 30 12:28:25 host.example.com sshuttle[12487]: c :  > channel=0 cmd=PING len=6 (fullness=36022)
Oct 30 12:28:26 host.example.com sshuttle[12487]:  s: <  channel=0 cmd=PING len=6
Oct 30 12:28:26 host.example.com sshuttle[12487]:  s:  > channel=0 cmd=PONG len=6 (fullness=224)
Oct 30 12:28:26 host.example.com sshuttle[12487]: c : <  channel=0 cmd=PONG len=6
Oct 30 12:28:26 host.example.com sshuttle[12487]: c : received PING response
Oct 30 12:28:27 host.example.com sshuttle[12487]:  s:  > channel=0 cmd=PING len=6 (fullness=34080)
Oct 30 12:28:27 host.example.com sshuttle[12487]: c : <  channel=0 cmd=PING len=6
Oct 30 12:28:27 host.example.com sshuttle[12487]: c :  > channel=0 cmd=PONG len=6 (fullness=29451)
Oct 30 12:28:27 host.example.com sshuttle[12487]:  s: <  channel=0 cmd=PONG len=6
Oct 30 12:28:27 host.example.com sshuttle[12487]:  s: received PING response
Oct 30 12:28:27 host.example.com sshuttle[12487]:  s:  > channel=0 cmd=PING len=6 (fullness=32952)
Oct 30 12:28:27 host.example.com sshuttle[12487]: c : <  channel=0 cmd=PING len=6
Oct 30 12:28:27 host.example.com sshuttle[12487]: c :  > channel=0 cmd=PONG len=6 (fullness=29457)
Oct 30 12:28:27 host.example.com sshuttle[12487]:  s: <  channel=0 cmd=PONG len=6
Oct 30 12:28:27 host.example.com sshuttle[12487]:  s: received PING response
Oct 30 12:29:29 host.example.com sshuttle[12487]: c :  > channel=0 cmd=PING len=6 (fullness=33464)
Oct 30 12:29:29 host.example.com sshuttle[12487]:  s: <  channel=0 cmd=PING len=6
Oct 30 12:29:29 host.example.com sshuttle[12487]:  s:  > channel=0 cmd=PONG len=6 (fullness=23910)
Oct 30 12:29:29 host.example.com sshuttle[12487]: c : <  channel=0 cmd=PONG len=6
Oct 30 12:29:29 host.example.com sshuttle[12487]: c : received PING response
Oct 30 12:29:36 host.example.com sshuttle[12487]:  s:  > channel=0 cmd=PING len=6 (fullness=33915)
Oct 30 12:29:36 host.example.com sshuttle[12487]: c : <  channel=0 cmd=PING len=6
Oct 30 12:29:36 host.example.com sshuttle[12487]: c :  > channel=0 cmd=PONG len=6 (fullness=24264)
Oct 30 12:29:36 host.example.com sshuttle[12487]: c :  > channel=0 cmd=PING len=6 (fullness=50477)
Oct 30 12:29:36 host.example.com sshuttle[12487]:  s: <  channel=0 cmd=PONG len=6
Oct 30 12:29:36 host.example.com sshuttle[12487]:  s: received PING response
Oct 30 12:29:36 host.example.com sshuttle[12487]:  s: <  channel=0 cmd=PING len=6
Oct 30 12:29:36 host.example.com sshuttle[12487]:  s:  > channel=0 cmd=PONG len=6 (fullness=13054)
Oct 30 12:29:36 host.example.com sshuttle[12487]: c : <  channel=0 cmd=PONG len=6
Oct 30 12:29:36 host.example.com sshuttle[12487]: c : received PING response

Those were the last PING/PONG messages from that tunnel, yet that tunnel stayed alive until the connection timeout finally kicked in:

Oct 30 13:53:54 host.example.com sshuttle[12487]: c : Remaining DNS requests: 2
Oct 30 13:53:54 host.example.com sshuttle[12487]: c : Remaining UDP channels: 0
Oct 30 13:53:54 host.example.com sshuttle[12487]: c : read: err was: [Errno 11] Resource temporarily unavailable
Oct 30 13:53:54 host.example.com sshuttle[12487]: c : Waiting: 6 r=[5, 7, 9, 23] w=[9] x=[] (fullness=20255/0)
Oct 30 13:53:54 host.example.com sshuttle[12487]: c :   Ready: 6 r=[] w=[9] x=[]
Oct 30 13:53:54 host.example.com sshuttle[12487]: c : mux wrote: 55/55
Oct 30 13:53:54 host.example.com sshuttle[12487]: c : read: err was: [Errno 11] Resource temporarily unavailable
Oct 30 13:53:54 host.example.com sshuttle[12487]: c : Waiting: 6 r=[5, 7, 9, 23] w=[] x=[] (fullness=20255/0)
Oct 30 13:54:20 host.example.com sshuttle[12487]: packet_write_wait: Connection to UNKNOWN port 65535: Broken pipe
Oct 30 13:54:20 host.example.com sshuttle[12487]: c :   Ready: 6 r=[9] w=[] x=[]
Oct 30 13:54:20 host.example.com sshuttle[12487]: c : read: err was: [Errno 11] Resource temporarily unavailable
Oct 30 13:54:20 host.example.com sshuttle[12487]: c : read: err was: [Errno 11] Resource temporarily unavailable
Oct 30 13:54:20 host.example.com sshuttle[12487]: firewall manager: undoing changes.
Oct 30 13:54:20 host.example.com sshuttle[12487]: firewall manager: undoing IPv4 changes.
Oct 30 13:54:21 host.example.com sshuttle[12487]: >> iptables -t nat -D OUTPUT -j sshuttle-12304
Oct 30 13:54:21 host.example.com sshuttle[12487]: >> iptables -t nat -D PREROUTING -j sshuttle-12304
Oct 30 13:54:21 host.example.com sshuttle[12487]: >> iptables -t nat -F sshuttle-12304
Oct 30 13:54:21 host.example.com sshuttle[12487]: >> iptables -t nat -X sshuttle-12304
Oct 30 13:54:21 host.example.com sshuttle[12487]: firewall manager: undoing /etc/hosts changes.
Oct 30 13:54:21 host.example.com sshuttle[12487]: c : fatal: server died with error code 255

As you can see above though, the last PING/PONG messages on my tunnel were almost a half hour before the tunnel finally died.

What are the PING/PONG messages for if not to at minimum detect dead tunnels (and hopefully restart them)?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions