@@ -9,12 +9,10 @@ import (
9
9
"fmt"
10
10
"net"
11
11
"os/exec"
12
- "path/filepath"
13
12
14
13
"github.com/containers/buildah/pkg/jail"
15
14
"github.com/containers/common/libnetwork/types"
16
15
"github.com/containers/podman/v5/libpod/define"
17
- "github.com/containers/storage/pkg/lockfile"
18
16
"github.com/sirupsen/logrus"
19
17
)
20
18
@@ -46,38 +44,6 @@ type NetstatAddress struct {
46
44
Collisions uint64 `json:"collisions"`
47
45
}
48
46
49
- type RootlessNetNS struct {
50
- dir string
51
- Lock * lockfile.LockFile
52
- }
53
-
54
- // getPath will join the given path to the rootless netns dir
55
- func (r * RootlessNetNS ) getPath (path string ) string {
56
- return filepath .Join (r .dir , path )
57
- }
58
-
59
- // Do - run the given function in the rootless netns.
60
- // It does not lock the rootlessCNI lock, the caller
61
- // should only lock when needed, e.g. for network operations.
62
- func (r * RootlessNetNS ) Do (toRun func () error ) error {
63
- return errors .New ("not supported on freebsd" )
64
- }
65
-
66
- // Cleanup the rootless network namespace if needed.
67
- // It checks if we have running containers with the bridge network mode.
68
- // Cleanup() expects that r.Lock is locked
69
- func (r * RootlessNetNS ) Cleanup (runtime * Runtime ) error {
70
- return errors .New ("not supported on freebsd" )
71
- }
72
-
73
- // GetRootlessNetNs returns the rootless netns object. If create is set to true
74
- // the rootless network namespace will be created if it does not already exist.
75
- // If called as root it returns always nil.
76
- // On success the returned RootlessCNI lock is locked and must be unlocked by the caller.
77
- func (r * Runtime ) GetRootlessNetNs (new bool ) (* RootlessNetNS , error ) {
78
- return nil , nil
79
- }
80
-
81
47
func getSlirp4netnsIP (subnet * net.IPNet ) (* net.IP , error ) {
82
48
return nil , errors .New ("not implemented GetSlirp4netnsIP" )
83
49
}
@@ -145,7 +111,7 @@ func (r *Runtime) createNetNS(ctr *Container) (n string, q map[string]types.Stat
145
111
jconf .Set ("securelevel" , - 1 )
146
112
j , err := jail .Create (jconf )
147
113
if err != nil {
148
- return "" , nil , fmt .Errorf ("Failed to create vnet jail %s for container %s: %w" , netns , ctr .ID (), err )
114
+ return "" , nil , fmt .Errorf ("failed to create vnet jail %s for container %s: %w" , netns , ctr .ID (), err )
149
115
}
150
116
151
117
logrus .Debugf ("Created vnet jail %s for container %s" , netns , ctr .ID ())
@@ -157,7 +123,7 @@ func (r *Runtime) createNetNS(ctr *Container) (n string, q map[string]types.Stat
157
123
jconf .Set ("persist" , false )
158
124
if err := j .Set (jconf ); err != nil {
159
125
// Log this error and return the error from configureNetNS
160
- logrus .Errorf ("failed to destroy vnet jail %s: %w " , netns , err )
126
+ logrus .Errorf ("failed to destroy vnet jail %s: %v " , netns , err )
161
127
}
162
128
}
163
129
return netns , networkStatus , err
@@ -258,13 +224,8 @@ func (c *Container) joinedNetworkNSPath() (string, bool) {
258
224
func (c * Container ) inspectJoinedNetworkNS (networkns string ) (q types.StatusBlock , retErr error ) {
259
225
// TODO: extract interface information from the vnet jail
260
226
return types.StatusBlock {}, nil
261
-
262
227
}
263
228
264
229
func (c * Container ) reloadRootlessRLKPortMapping () error {
265
230
return errors .New ("unsupported (*Container).reloadRootlessRLKPortMapping" )
266
231
}
267
-
268
- func (c * Container ) setupRootlessNetwork () error {
269
- return nil
270
- }
0 commit comments