From 26c6249516fe80781e21fe710749214bf1f477fd Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Thu, 7 Jul 2016 16:01:29 +0000 Subject: [PATCH] Review comments --- probe/docker/reporter.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/probe/docker/reporter.go b/probe/docker/reporter.go index b6ed77fbe4..8dbb61a392 100644 --- a/probe/docker/reporter.go +++ b/probe/docker/reporter.go @@ -193,7 +193,7 @@ func (r *Reporter) containerTopology(localAddrs []net.IP) report.Topology { } var networkInfo func(prefix string) (report.Sets, bool) - networkInfo = func(prefix string) (ips report.Sets, isHostMapped bool) { + networkInfo = func(prefix string) (ips report.Sets, isInHostNamespace bool) { container, ok := r.registry.GetContainerByPrefix(prefix) if !ok { return report.EmptySets, false @@ -214,9 +214,13 @@ func (r *Reporter) containerTopology(localAddrs []net.IP) report.Topology { if !ok { continue } - networkInfo, isHostMapped := networkInfo(id) + networkInfo, isInHostNamespace := networkInfo(id) node = node.WithSets(networkInfo) - if isHostMapped { + // Indicate whether the container is in the host network + // The container's NetworkMode is not enough due to + // delegation (e.g. NetworkMode="container:foo" where + // foo is a container in the host networking namespace) + if isInHostNamespace { node = node.WithLatests(map[string]string{IsInHostNetwork: "true"}) } result.AddNode(node)