Prioritize nw endpoint which can provide both v4 and v6 connectivity

- when selecting sandbox's default gw

Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
Alessandro Boch 2017-01-03 11:39:04 -08:00
parent ac7deb041b
commit cdd56ba07e

View file

@ -1174,6 +1174,17 @@ func (eh epHeap) Less(i, j int) bool {
return true
}
if epi.joinInfo != nil && epj.joinInfo != nil {
if (epi.joinInfo.gw != nil && epi.joinInfo.gw6 != nil) &&
(epj.joinInfo.gw == nil || epj.joinInfo.gw6 == nil) {
return true
}
if (epj.joinInfo.gw != nil && epj.joinInfo.gw6 != nil) &&
(epi.joinInfo.gw == nil || epi.joinInfo.gw6 == nil) {
return false
}
}
if ci != nil {
cip, ok = ci.epPriority[eh[i].ID()]
if !ok {