virtcontainers: Unify Network endpoints management interface

And only have AddEndpoints/RemoveEndpoints for all cases (single
endpoint vs all of them, hotplug or not).

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
This commit is contained in:
Samuel Ortiz
2021-11-09 04:19:10 +00:00
committed by Samuel Ortiz
parent c67109a251
commit 7fca5792f7
4 changed files with 71 additions and 38 deletions

View File

@@ -228,3 +228,13 @@ func loadTuntapIf(tuntapif *persistapi.TuntapInterface) *TuntapInterface {
},
}
}
func findEndpoint(e Endpoint, endpoints []Endpoint) (Endpoint, int) {
for idx, ep := range endpoints {
if ep.HardwareAddr() == e.HardwareAddr() {
return ep, idx
}
}
return nil, 0
}