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

Commit 8f846a2

Browse files
committed
cni: Fix bug while updating endpoints after scanning net namespace
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>
1 parent 8674624 commit 8f846a2

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

cni.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,15 @@ func (n *cni) updateEndpointsFromScan(networkNS *NetworkNamespace) error {
123123
return err
124124
}
125125

126-
for idx, endpoint := range endpoints {
126+
for _, endpoint := range endpoints {
127127
for _, ep := range networkNS.Endpoints {
128128
if ep.Name() == endpoint.Name() {
129129
// Update endpoint properties with info from
130130
// the scan. Do not update DNS since the scan
131131
// cannot provide it.
132132
prop := endpoint.Properties()
133133
prop.DNS = ep.Properties().DNS
134-
ep.SetProperties(prop)
135-
endpoints[idx] = ep
134+
endpoint.SetProperties(prop)
136135
break
137136
}
138137
}

0 commit comments

Comments
 (0)