control-center/serviced — pull request #1122 by daniel-garcia (2014-09-27 21:27:50+00:00)
Title: bypass mux when containers without dynamic endpoints are on the same host

Containers that are on the same host do not need to go through the MUX. The exception to this are containers that have dynamic endpoint imports. These containers rely on the receiving endpoint address to be the host ip (mux).

below is a readout of the container connections for mysql and hmaster after the change.

connection on the mysql container:
```bash
dgarcia@dgarcia-laptop:~/src/europa/src/golang/src/github.com/control-center/serviced$ ./serviced service attach mysql
bash-4.2# netstat -pant | grep 3306 | grep ESTA
tcp 0 0 172.17.0.212:3306 172.17.42.1:50678 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:34152 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:41352 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:60632 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:47473 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:41338 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:41768 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:57452 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:41311 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:41897 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:41324 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:55961 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:47381 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:49125 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:47476 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:49053 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:50681 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:50358 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:60660 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:41758 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:41349 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:49122 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:51442 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:50839 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:47396 ESTABLISHED 322/mysqld
tcp 0 0 172.17.0.212:3306 172.17.42.1:49038 ESTABLISHED 322/mysqld
```
connection on hmaster:
```bash
dgarcia@dgarcia-laptop:~/src/europa/src/golang/src/github.com/control-center/serviced$ ./serviced service attach hmaster
root@localhost:/# netstat -pant | grep ESTA
tcp 0 0 172.17.0.202:49227 192.168.0.108:2181 ESTABLISHED 1/serviced
tcp 0 0 172.17.0.202:54621 192.168.0.108:22250 ESTABLISHED 1/serviced
tcp 0 0 127.0.0.1:49162 127.0.0.1:8444 ESTABLISHED 1/serviced
tcp 0 0 172.17.0.202:54136 192.168.0.108:22250 ESTABLISHED 1/serviced
tcp 0 0 172.17.0.202:42410 172.17.42.1:4979 ESTABLISHED 1/serviced
tcp 0 0 127.0.0.1:2181 10.3.0.2:50408 ESTABLISHED 1/serviced
tcp 0 0 127.0.0.1:2181 10.3.0.2:50359 ESTABLISHED 1/serviced
tcp 0 0 172.17.0.202:54126 192.168.0.108:22250 ESTABLISHED 1/serviced
tcp 0 0 172.17.0.202:54408 192.168.0.108:22250 ESTABLISHED 1/serviced
tcp 0 0 172.17.0.202:54575 192.168.0.108:22250 ESTABLISHED 1/serviced
tcp 0 0 127.0.0.1:53125 127.0.0.1:5043 ESTABLISHED 28/logstash-forward
tcp 0 0 172.17.0.202:49231 192.168.0.108:2181 ESTABLISHED 1/serviced
tcp 0 0 127.0.0.1:5043 127.0.0.1:53125 ESTABLISHED 1/serviced
tcp 0 0 127.0.0.1:2183 10.3.0.4:45526 ESTABLISHED 1/serviced
tcp 0 0 172.17.0.202:42402 172.17.42.1:4979 ESTABLISHED 1/serviced
tcp 0 0 127.0.0.1:2183 10.3.0.4:45537 ESTABLISHED 1/serviced
tcp 0 0 127.0.0.1:5042 127.0.0.1:43688 ESTABLISHED 1/serviced
tcp 0 0 172.17.0.202:42409 172.17.42.1:4979 ESTABLISHED 1/serviced
tcp 0 0 172.17.0.202:54610 192.168.0.108:22250 ESTABLISHED 1/serviced
tcp 0 0 172.17.0.202:54624 192.168.0.108:22250 ESTABLISHED 1/serviced
tcp 0 0 127.0.0.1:43688 127.0.0.1:5042 ESTABLISHED 1/serviced
tcp 0 0 127.0.0.1:8444 127.0.0.1:49162 ESTABLISHED 1/serviced
tcp6 0 0 10.3.0.4:45526 10.3.0.4:2181 ESTABLISHED 206/java
tcp6 0 0 127.0.0.1:56156 127.0.0.1:60000 ESTABLISHED 205/java
tcp6 0 0 172.17.0.202:60000 172.17.42.1:48802 ESTABLISHED 206/java
tcp6 0 0 127.0.0.1:60000 127.0.0.1:56156 ESTABLISHED 206/java
tcp6 0 0 172.17.0.202:60000 172.17.42.1:48800 ESTABLISHED 206/java
tcp6 0 0 172.17.0.202:60000 172.17.42.1:48794 ESTABLISHED 206/java
tcp6 0 0 10.3.0.2:50408 10.3.0.2:2181 ESTABLISHED 205/java
tcp6 0 0 10.3.0.2:50359 10.3.0.2:2181 ESTABLISHED 206/java
tcp6 0 0 10.3.0.4:45537 10.3.0.4:2181 ESTABLISHED 206/java
```