mirror of
https://github.com/containers/podman.git
synced 2025-11-12 17:19:57 +08:00
Bump github.com/rootless-containers/rootlesskit from 0.14.5 to 0.14.6
Bumps [github.com/rootless-containers/rootlesskit](https://github.com/rootless-containers/rootlesskit) from 0.14.5 to 0.14.6. - [Release notes](https://github.com/rootless-containers/rootlesskit/releases) - [Commits](rootless-containers/rootlesskit@v0.14.5...v0.14.6) --- updated-dependencies: - dependency-name: github.com/rootless-containers/rootlesskit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
13
vendor/github.com/rootless-containers/rootlesskit/pkg/msgutil/msgutil.go
generated
vendored
13
vendor/github.com/rootless-containers/rootlesskit/pkg/msgutil/msgutil.go
generated
vendored
@@ -5,9 +5,8 @@ import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -20,7 +19,7 @@ func MarshalToWriter(w io.Writer, x interface{}) (int, error) {
|
||||
return 0, err
|
||||
}
|
||||
if len(b) > maxLength {
|
||||
return 0, errors.Errorf("bad message length: %d (max: %d)", len(b), maxLength)
|
||||
return 0, fmt.Errorf("bad message length: %d (max: %d)", len(b), maxLength)
|
||||
}
|
||||
h := make([]byte, 4)
|
||||
binary.LittleEndian.PutUint32(h, uint32(len(b)))
|
||||
@@ -34,11 +33,11 @@ func UnmarshalFromReader(r io.Reader, x interface{}) (int, error) {
|
||||
return n, err
|
||||
}
|
||||
if n != 4 {
|
||||
return n, errors.Errorf("read %d bytes, expected 4 bytes", n)
|
||||
return n, fmt.Errorf("read %d bytes, expected 4 bytes", n)
|
||||
}
|
||||
bLen := binary.LittleEndian.Uint32(hdr)
|
||||
if bLen > maxLength || bLen < 1 {
|
||||
return n, errors.Errorf("bad message length: %d (max: %d)", bLen, maxLength)
|
||||
return n, fmt.Errorf("bad message length: %d (max: %d)", bLen, maxLength)
|
||||
}
|
||||
b := make([]byte, bLen)
|
||||
n, err = r.Read(b)
|
||||
@@ -46,7 +45,7 @@ func UnmarshalFromReader(r io.Reader, x interface{}) (int, error) {
|
||||
return 4 + n, err
|
||||
}
|
||||
if n != int(bLen) {
|
||||
return 4 + n, errors.Errorf("read %d bytes, expected %d bytes", n, bLen)
|
||||
return 4 + n, fmt.Errorf("read %d bytes, expected %d bytes", n, bLen)
|
||||
}
|
||||
return 4 + n, json.Unmarshal(b, x)
|
||||
}
|
||||
@@ -60,7 +59,7 @@ func Marshal(x interface{}) ([]byte, error) {
|
||||
func Unmarshal(b []byte, x interface{}) error {
|
||||
n, err := UnmarshalFromReader(bytes.NewReader(b), x)
|
||||
if n != len(b) {
|
||||
return errors.Errorf("read %d bytes, expected %d bytes", n, len(b))
|
||||
return fmt.Errorf("read %d bytes, expected %d bytes", n, len(b))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
12
vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/child/child.go
generated
vendored
12
vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/child/child.go
generated
vendored
@@ -1,13 +1,14 @@
|
||||
package child
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/rootless-containers/rootlesskit/pkg/msgutil"
|
||||
@@ -76,7 +77,6 @@ func (d *childDriver) RunChildDriver(opaque map[string]string, quit <-chan struc
|
||||
c.Close()
|
||||
}()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *childDriver) routine(c *net.UnixConn) error {
|
||||
@@ -90,7 +90,7 @@ func (d *childDriver) routine(c *net.UnixConn) error {
|
||||
case msg.RequestTypeConnect:
|
||||
return d.handleConnectRequest(c, &req)
|
||||
default:
|
||||
return errors.Errorf("unknown request type %q", req.Type)
|
||||
return fmt.Errorf("unknown request type %q", req.Type)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ func (d *childDriver) handleConnectRequest(c *net.UnixConn, req *msg.Request) er
|
||||
case "udp4":
|
||||
case "udp6":
|
||||
default:
|
||||
return errors.Errorf("unknown proto: %q", req.Proto)
|
||||
return fmt.Errorf("unknown proto: %q", req.Proto)
|
||||
}
|
||||
// dialProto does not need "4", "6" suffix
|
||||
dialProto := strings.TrimSuffix(strings.TrimSuffix(req.Proto, "6"), "4")
|
||||
@@ -119,7 +119,7 @@ func (d *childDriver) handleConnectRequest(c *net.UnixConn, req *msg.Request) er
|
||||
} else {
|
||||
p := net.ParseIP(ip)
|
||||
if p == nil {
|
||||
return errors.Errorf("invalid IP: %q", ip)
|
||||
return fmt.Errorf("invalid IP: %q", ip)
|
||||
}
|
||||
ip = p.String()
|
||||
}
|
||||
@@ -130,7 +130,7 @@ func (d *childDriver) handleConnectRequest(c *net.UnixConn, req *msg.Request) er
|
||||
defer targetConn.Close() // no effect on duplicated FD
|
||||
targetConnFiler, ok := targetConn.(filer)
|
||||
if !ok {
|
||||
return errors.Errorf("unknown target connection: %+v", targetConn)
|
||||
return fmt.Errorf("unknown target connection: %+v", targetConn)
|
||||
}
|
||||
targetConnFile, err := targetConnFiler.File()
|
||||
if err != nil {
|
||||
|
||||
9
vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/msg/msg.go
generated
vendored
9
vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/msg/msg.go
generated
vendored
@@ -1,10 +1,11 @@
|
||||
package msg
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/rootless-containers/rootlesskit/pkg/msgutil"
|
||||
@@ -78,7 +79,7 @@ func ConnectToChild(c *net.UnixConn, spec port.Spec) (int, error) {
|
||||
return 0, err
|
||||
}
|
||||
if oobN != oobSpace {
|
||||
return 0, errors.Errorf("expected OOB space %d, got %d", oobSpace, oobN)
|
||||
return 0, fmt.Errorf("expected OOB space %d, got %d", oobSpace, oobN)
|
||||
}
|
||||
oob = oob[:oobN]
|
||||
fd, err := parseFDFromOOB(oob)
|
||||
@@ -126,7 +127,7 @@ func parseFDFromOOB(oob []byte) (int, error) {
|
||||
return 0, err
|
||||
}
|
||||
if len(scms) != 1 {
|
||||
return 0, errors.Errorf("unexpected scms: %v", scms)
|
||||
return 0, fmt.Errorf("unexpected scms: %v", scms)
|
||||
}
|
||||
scm := scms[0]
|
||||
fds, err := unix.ParseUnixRights(&scm)
|
||||
@@ -134,7 +135,7 @@ func parseFDFromOOB(oob []byte) (int, error) {
|
||||
return 0, err
|
||||
}
|
||||
if len(fds) != 1 {
|
||||
return 0, errors.Errorf("unexpected fds: %v", fds)
|
||||
return 0, fmt.Errorf("unexpected fds: %v", fds)
|
||||
}
|
||||
return fds[0], nil
|
||||
}
|
||||
|
||||
18
vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/parent.go
generated
vendored
18
vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/parent.go
generated
vendored
@@ -2,9 +2,9 @@ package parent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -14,8 +14,6 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/rootless-containers/rootlesskit/pkg/api"
|
||||
"github.com/rootless-containers/rootlesskit/pkg/port"
|
||||
"github.com/rootless-containers/rootlesskit/pkg/port/builtin/msg"
|
||||
@@ -32,10 +30,10 @@ func NewDriver(logWriter io.Writer, stateDir string) (port.ParentDriver, error)
|
||||
childReadyPipePath := filepath.Join(stateDir, ".bp-ready.pipe")
|
||||
// remove the path just in case the previous rootlesskit instance crashed
|
||||
if err := os.RemoveAll(childReadyPipePath); err != nil {
|
||||
return nil, errors.Wrapf(err, "cannot remove %s", childReadyPipePath)
|
||||
return nil, fmt.Errorf("cannot remove %s: %w", childReadyPipePath, err)
|
||||
}
|
||||
if err := syscall.Mkfifo(childReadyPipePath, 0600); err != nil {
|
||||
return nil, errors.Wrapf(err, "cannot mkfifo %s", childReadyPipePath)
|
||||
return nil, fmt.Errorf("cannot mkfifo %s: %w", childReadyPipePath, err)
|
||||
}
|
||||
d := driver{
|
||||
logWriter: logWriter,
|
||||
@@ -79,7 +77,7 @@ func (d *driver) RunParentDriver(initComplete chan struct{}, quit <-chan struct{
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err = ioutil.ReadAll(childReadyPipeR); err != nil {
|
||||
if _, err = io.ReadAll(childReadyPipeR); err != nil {
|
||||
return err
|
||||
}
|
||||
childReadyPipeR.Close()
|
||||
@@ -110,7 +108,7 @@ func annotateEPERM(origErr error, spec port.Spec) error {
|
||||
// Read "net.ipv4.ip_unprivileged_port_start" value (typically 1024)
|
||||
// TODO: what for IPv6?
|
||||
// NOTE: sync.Once should not be used here
|
||||
b, e := ioutil.ReadFile("/proc/sys/net/ipv4/ip_unprivileged_port_start")
|
||||
b, e := os.ReadFile("/proc/sys/net/ipv4/ip_unprivileged_port_start")
|
||||
if e != nil {
|
||||
return origErr
|
||||
}
|
||||
@@ -129,7 +127,7 @@ func annotateEPERM(origErr error, spec port.Spec) error {
|
||||
text += ", or set CAP_NET_BIND_SERVICE on rootlesskit binary"
|
||||
}
|
||||
text += fmt.Sprintf(", or choose a larger port number (>= %d)", start)
|
||||
return errors.Wrap(origErr, text)
|
||||
return fmt.Errorf(text+": %w", origErr)
|
||||
}
|
||||
|
||||
func (d *driver) AddPort(ctx context.Context, spec port.Spec) (*port.Status, error) {
|
||||
@@ -152,7 +150,7 @@ func (d *driver) AddPort(ctx context.Context, spec port.Spec) (*port.Status, err
|
||||
}
|
||||
return errors.New("routineStoppedCh was closed without sending data?")
|
||||
case <-ctx.Done():
|
||||
return errors.Wrap(err, "timed out while waiting for routineStoppedCh after closing routineStopCh")
|
||||
return fmt.Errorf("timed out while waiting for routineStoppedCh after closing routineStopCh: %w", err)
|
||||
}
|
||||
}
|
||||
switch spec.Proto {
|
||||
@@ -198,7 +196,7 @@ func (d *driver) RemovePort(ctx context.Context, id int) error {
|
||||
defer d.mu.Unlock()
|
||||
stop, ok := d.stoppers[id]
|
||||
if !ok {
|
||||
return errors.Errorf("unknown id: %d", id)
|
||||
return fmt.Errorf("unknown id: %d", id)
|
||||
}
|
||||
if _, ok := ctx.Deadline(); !ok {
|
||||
var cancel context.CancelFunc
|
||||
|
||||
5
vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/udp/udp.go
generated
vendored
5
vendor/github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/udp/udp.go
generated
vendored
@@ -1,13 +1,12 @@
|
||||
package udp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/rootless-containers/rootlesskit/pkg/port"
|
||||
"github.com/rootless-containers/rootlesskit/pkg/port/builtin/msg"
|
||||
"github.com/rootless-containers/rootlesskit/pkg/port/builtin/parent/udp/udpproxy"
|
||||
@@ -39,7 +38,7 @@ func Run(socketPath string, spec port.Spec, stopCh <-chan struct{}, stoppedCh ch
|
||||
}
|
||||
uc, ok := fc.(*net.UDPConn)
|
||||
if !ok {
|
||||
return nil, errors.Errorf("file conn doesn't implement *net.UDPConn: %+v", fc)
|
||||
return nil, fmt.Errorf("file conn doesn't implement *net.UDPConn: %+v", fc)
|
||||
}
|
||||
return uc, nil
|
||||
},
|
||||
|
||||
31
vendor/github.com/rootless-containers/rootlesskit/pkg/port/portutil/portutil.go
generated
vendored
31
vendor/github.com/rootless-containers/rootlesskit/pkg/port/portutil/portutil.go
generated
vendored
@@ -1,13 +1,12 @@
|
||||
package portutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/scanner"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/rootless-containers/rootlesskit/pkg/port"
|
||||
)
|
||||
|
||||
@@ -49,18 +48,18 @@ func ParsePortSpec(portSpec string) (*port.Spec, error) {
|
||||
// Get the proto
|
||||
protoPos := strings.LastIndex(portSpec, "/")
|
||||
if protoPos < 0 {
|
||||
return nil, errors.Errorf("missing proto in PortSpec string: %q", portSpec)
|
||||
return nil, fmt.Errorf("missing proto in PortSpec string: %q", portSpec)
|
||||
}
|
||||
parts[proto] = portSpec[protoPos+1:]
|
||||
err = validateProto(parts[proto])
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "invalid PortSpec string: %q", portSpec)
|
||||
return nil, fmt.Errorf("invalid PortSpec string: %q: %w", portSpec, err)
|
||||
}
|
||||
|
||||
// Get the parent port
|
||||
portPos := strings.LastIndex(portSpec, ":")
|
||||
if portPos < 0 {
|
||||
return nil, errors.Errorf("unexpected PortSpec string: %q", portSpec)
|
||||
return nil, fmt.Errorf("unexpected PortSpec string: %q", portSpec)
|
||||
}
|
||||
parts[childPort] = portSpec[portPos+1 : protoPos]
|
||||
|
||||
@@ -69,7 +68,7 @@ func ParsePortSpec(portSpec string) (*port.Spec, error) {
|
||||
|
||||
for tok := s.Scan(); tok != scanner.EOF; tok = s.Scan() {
|
||||
if index > childPort {
|
||||
return nil, errors.Errorf("unexpected PortSpec string: %q", portSpec)
|
||||
return nil, fmt.Errorf("unexpected PortSpec string: %q", portSpec)
|
||||
}
|
||||
|
||||
switch tok {
|
||||
@@ -92,10 +91,10 @@ func ParsePortSpec(portSpec string) (*port.Spec, error) {
|
||||
}
|
||||
|
||||
if parts[parentIP] != "" && net.ParseIP(parts[parentIP]) == nil {
|
||||
return nil, errors.Errorf("unexpected ParentIP in PortSpec string: %q", portSpec)
|
||||
return nil, fmt.Errorf("unexpected ParentIP in PortSpec string: %q", portSpec)
|
||||
}
|
||||
if parts[childIP] != "" && net.ParseIP(parts[childIP]) == nil {
|
||||
return nil, errors.Errorf("unexpected ParentIP in PortSpec string: %q", portSpec)
|
||||
return nil, fmt.Errorf("unexpected ParentIP in PortSpec string: %q", portSpec)
|
||||
}
|
||||
|
||||
ps := &port.Spec{
|
||||
@@ -106,12 +105,12 @@ func ParsePortSpec(portSpec string) (*port.Spec, error) {
|
||||
|
||||
ps.ParentPort, err = strconv.Atoi(parts[parentPort])
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "unexpected ChildPort in PortSpec string: %q", portSpec)
|
||||
return nil, fmt.Errorf("unexpected ChildPort in PortSpec string: %q: %w", portSpec, err)
|
||||
}
|
||||
|
||||
ps.ChildPort, err = strconv.Atoi(parts[childPort])
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "unexpected ParentPort in PortSpec string: %q", portSpec)
|
||||
return nil, fmt.Errorf("unexpected ParentPort in PortSpec string: %q: %w", portSpec, err)
|
||||
}
|
||||
|
||||
return ps, nil
|
||||
@@ -125,26 +124,26 @@ func ValidatePortSpec(spec port.Spec, existingPorts map[int]*port.Status) error
|
||||
}
|
||||
if spec.ParentIP != "" {
|
||||
if net.ParseIP(spec.ParentIP) == nil {
|
||||
return errors.Errorf("invalid ParentIP: %q", spec.ParentIP)
|
||||
return fmt.Errorf("invalid ParentIP: %q", spec.ParentIP)
|
||||
}
|
||||
}
|
||||
if spec.ChildIP != "" {
|
||||
if net.ParseIP(spec.ChildIP) == nil {
|
||||
return errors.Errorf("invalid ChildIP: %q", spec.ChildIP)
|
||||
return fmt.Errorf("invalid ChildIP: %q", spec.ChildIP)
|
||||
}
|
||||
}
|
||||
if spec.ParentPort <= 0 || spec.ParentPort > 65535 {
|
||||
return errors.Errorf("invalid ParentPort: %q", spec.ParentPort)
|
||||
return fmt.Errorf("invalid ParentPort: %q", spec.ParentPort)
|
||||
}
|
||||
if spec.ChildPort <= 0 || spec.ChildPort > 65535 {
|
||||
return errors.Errorf("invalid ChildPort: %q", spec.ChildPort)
|
||||
return fmt.Errorf("invalid ChildPort: %q", spec.ChildPort)
|
||||
}
|
||||
for id, p := range existingPorts {
|
||||
sp := p.Spec
|
||||
sameProto := sp.Proto == spec.Proto
|
||||
sameParent := sp.ParentIP == spec.ParentIP && sp.ParentPort == spec.ParentPort
|
||||
if sameProto && sameParent {
|
||||
return errors.Errorf("conflict with ID %d", id)
|
||||
return fmt.Errorf("conflict with ID %d", id)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -158,6 +157,6 @@ func validateProto(proto string) error {
|
||||
"sctp", "sctp4", "sctp6":
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("unknown proto: %q", proto)
|
||||
return fmt.Errorf("unknown proto: %q", proto)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user