Instead of using netcat when tunneling SSH through another machine like this:
ProxyCommand ssh -T host1 'nc %h %p'
one should use this instead: ProxyCommand ssh -W %h:%p host1