The problem:
ssh config with ControlPath set to ~/.ssh/master-%r@%h:%p
A third party tool which invokes ssh with a ProxyCommand ssh <proxyhost> --pty=false nc -q0 %h %p
The problem is that the third party tool might invoke ssh with proxy command with ultimate target host 10.0.0.12 and then AGAIN with the same target host ip, but with a different proxy intermediate.
e.g.
ssh -o ProxyCommand 'ssh proxy1 nc -q0 %h %p' 10.0.0.12
ssh -o ProxyCommand 'ssh proxy2 nc -q0 %h %p' 10.0.0.12
If the first command is using Control Master, the second command incorrectly uses ControlPath because 10.0.0.12:22 is there.
Is there a work around or %proxy
I can use in ControlPath value?
Update: one workaround which I have yet to try is to export HOME=somewhere_else the next time I run the tool. I should be able to have an alternate .ssh in that alt HOME
Reviewing the ssh_config documentation it doesn't look like there's an easy solution.
I believe you could modify your ControlPath to use %n instead of %h to get the hostname as specified on the command line. You could then create real DNS or /etc/hosts entry aliases for your two 10.0.0.12 machines. Then when you use different names to refer to them you will have different ControlPaths for each host.
The downside to this approach is that if you commonly use different names that point to the same IP each of these connections will not be able to benefit from connection sharing as they would previously have if they used the same IP, regardless of the hostname used to access it.