mirror of
https://github.com/containers/podman.git
synced 2025-10-12 08:45:37 +08:00
fix(deps): update module github.com/rootless-containers/rootlesskit/v2 to v2.3.2
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
5
vendor/github.com/rootless-containers/rootlesskit/v2/pkg/port/builtin/child/child.go
generated
vendored
5
vendor/github.com/rootless-containers/rootlesskit/v2/pkg/port/builtin/child/child.go
generated
vendored
@ -123,6 +123,11 @@ func (d *childDriver) handleConnectRequest(c *net.UnixConn, req *msg.Request) er
|
||||
ip := req.IP
|
||||
if ip == "" {
|
||||
ip = "127.0.0.1"
|
||||
if req.ParentIP != "" {
|
||||
if req.ParentIP != req.HostGatewayIP && req.ParentIP != "0.0.0.0" {
|
||||
ip = req.ParentIP
|
||||
}
|
||||
}
|
||||
} else {
|
||||
p := net.ParseIP(ip)
|
||||
if p == nil {
|
||||
|
37
vendor/github.com/rootless-containers/rootlesskit/v2/pkg/port/builtin/msg/msg.go
generated
vendored
37
vendor/github.com/rootless-containers/rootlesskit/v2/pkg/port/builtin/msg/msg.go
generated
vendored
@ -19,10 +19,12 @@ const (
|
||||
|
||||
// Request and Response are encoded as JSON with uint32le length header.
|
||||
type Request struct {
|
||||
Type string // "init" or "connect"
|
||||
Proto string // "tcp", "tcp4", "tcp6", "udp", "udp4", "udp6"
|
||||
IP string
|
||||
Port int
|
||||
Type string // "init" or "connect"
|
||||
Proto string // "tcp", "tcp4", "tcp6", "udp", "udp4", "udp6"
|
||||
IP string
|
||||
Port int
|
||||
ParentIP string
|
||||
HostGatewayIP string
|
||||
}
|
||||
|
||||
// Reply may contain FD as OOB
|
||||
@ -48,14 +50,33 @@ func Initiate(c *net.UnixConn) error {
|
||||
return c.CloseRead()
|
||||
}
|
||||
|
||||
func hostGatewayIP() string {
|
||||
addrs, err := net.InterfaceAddrs()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
for _, addr := range addrs {
|
||||
if ipnet, ok := addr.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
|
||||
if ipnet.IP.To4() != nil {
|
||||
return ipnet.IP.String()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// ConnectToChild connects to the child UNIX socket, and obtains TCP or UDP socket FD
|
||||
// that corresponds to the port spec.
|
||||
func ConnectToChild(c *net.UnixConn, spec port.Spec) (int, error) {
|
||||
req := Request{
|
||||
Type: RequestTypeConnect,
|
||||
Proto: spec.Proto,
|
||||
Port: spec.ChildPort,
|
||||
IP: spec.ChildIP,
|
||||
Type: RequestTypeConnect,
|
||||
Proto: spec.Proto,
|
||||
Port: spec.ChildPort,
|
||||
IP: spec.ChildIP,
|
||||
ParentIP: spec.ParentIP,
|
||||
HostGatewayIP: hostGatewayIP(),
|
||||
}
|
||||
if _, err := lowlevelmsgutil.MarshalToWriter(c, &req); err != nil {
|
||||
return 0, err
|
||||
|
@ -159,8 +159,7 @@ func (d *driver) AddPort(ctx context.Context, spec port.Spec) (*port.Status, err
|
||||
case "udp", "udp4", "udp6":
|
||||
err = udp.Run(d.socketPath, spec, routineStopCh, routineStoppedCh, d.logWriter)
|
||||
default:
|
||||
// NOTREACHED
|
||||
return nil, errors.New("spec was not validated?")
|
||||
return nil, fmt.Errorf("unsupported port protocol %s", spec.Proto)
|
||||
}
|
||||
if err != nil {
|
||||
if isEPERM(err) {
|
||||
|
Reference in New Issue
Block a user