libnetwork: un-export SetExternalKey

It's only called as part of the "libnetwork-setkey" re-exec, so un-exporting
it to make clear it's not for external use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-08-12 11:13:23 +02:00
parent 91a3a95385
commit 8376595621
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 5 additions and 5 deletions

View file

@ -477,7 +477,7 @@ func externalKeyTest(t *testing.T, reexec bool) {
if reexec {
err := reexecSetKey("this-must-fail", containerID, controller.ID())
if err == nil {
t.Fatalf("SetExternalKey must fail if the corresponding namespace is not created")
t.Fatalf("libnetwork-setkey must fail if the corresponding namespace is not created")
}
} else {
// Setting an non-existing key (namespace) must fail
@ -500,7 +500,7 @@ func externalKeyTest(t *testing.T, reexec bool) {
if reexec {
err := reexecSetKey("ValidKey", containerID, controller.ID())
if err != nil {
t.Fatalf("SetExternalKey failed with %v", err)
t.Fatalf("libnetwork-setkey failed with %v", err)
}
} else {
if err := sbox.SetKey("ValidKey"); err != nil {

View file

@ -65,11 +65,11 @@ func setKey() error {
return err
}
return SetExternalKey(shortCtlrID, containerID, fmt.Sprintf("/proc/%d/ns/net", state.Pid), *execRoot)
return setExternalKey(shortCtlrID, containerID, fmt.Sprintf("/proc/%d/ns/net", state.Pid), *execRoot)
}
// SetExternalKey provides a convenient way to set an External key to a sandbox
func SetExternalKey(shortCtlrID string, containerID string, key string, execRoot string) error {
// setExternalKey provides a convenient way to set an External key to a sandbox
func setExternalKey(shortCtlrID string, containerID string, key string, execRoot string) error {
uds := filepath.Join(execRoot, execSubdir, shortCtlrID+".sock")
c, err := net.Dial("unix", uds)
if err != nil {