Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
cni: Fix bug while updating endpoints after scanning net namespace
Browse files Browse the repository at this point in the history
After scanning the network namespace, we need to update the scanned
endpoints with the DNS information, and use the scanned endpoints
thereafter discarding the endpoints structures we had created prior
to calling into the CNI plugin.

There was a bug in the update, which was causing the entire endpoint
structure being assigned back to the scanned endpoints causing us to
lose information from the scan including if a virtual or physical
endpoint was found in the scan.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
  • Loading branch information
amshinde committed Nov 18, 2017
1 parent 8674624 commit 8f846a2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,15 @@ func (n *cni) updateEndpointsFromScan(networkNS *NetworkNamespace) error {
return err
}

for idx, endpoint := range endpoints {
for _, endpoint := range endpoints {
for _, ep := range networkNS.Endpoints {
if ep.Name() == endpoint.Name() {
// Update endpoint properties with info from
// the scan. Do not update DNS since the scan
// cannot provide it.
prop := endpoint.Properties()
prop.DNS = ep.Properties().DNS
ep.SetProperties(prop)
endpoints[idx] = ep
endpoint.SetProperties(prop)
break
}
}
Expand Down

0 comments on commit 8f846a2

Please sign in to comment.