mirror of
https://github.com/containers/podman.git
synced 2025-12-01 02:27:13 +08:00
vendor: update c/common to latest
To include new pasta package Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
12
vendor/github.com/containers/common/libimage/filters.go
generated
vendored
12
vendor/github.com/containers/common/libimage/filters.go
generated
vendored
@@ -178,7 +178,7 @@ func (r *Runtime) compileImageFilters(ctx context.Context, options *ListImagesOp
|
||||
filter = filterManifest(ctx, manifest)
|
||||
|
||||
case "reference":
|
||||
filter = filterReferences(value)
|
||||
filter = filterReferences(r, value)
|
||||
|
||||
case "until":
|
||||
until, err := r.until(value)
|
||||
@@ -268,8 +268,15 @@ func filterManifest(ctx context.Context, value bool) filterFunc {
|
||||
}
|
||||
|
||||
// filterReferences creates a reference filter for matching the specified value.
|
||||
func filterReferences(value string) filterFunc {
|
||||
func filterReferences(r *Runtime, value string) filterFunc {
|
||||
lookedUp, _, _ := r.LookupImage(value, nil)
|
||||
return func(img *Image) (bool, error) {
|
||||
if lookedUp != nil {
|
||||
if lookedUp.ID() == img.ID() {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
refs, err := img.NamesReferences()
|
||||
if err != nil {
|
||||
return false, err
|
||||
@@ -306,6 +313,7 @@ func filterReferences(value string) filterFunc {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
26
vendor/github.com/containers/common/libnetwork/etchosts/ip.go
generated
vendored
26
vendor/github.com/containers/common/libnetwork/etchosts/ip.go
generated
vendored
@@ -1,8 +1,6 @@
|
||||
package etchosts
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/containers/common/libnetwork/types"
|
||||
"github.com/containers/common/libnetwork/util"
|
||||
"github.com/containers/common/pkg/config"
|
||||
@@ -29,7 +27,7 @@ func GetHostContainersInternalIP(conf *config.Config, netStatus map[string]types
|
||||
// Only use the bridge ip when root, as rootless the interfaces are created
|
||||
// inside the special netns and not the host so we cannot use them.
|
||||
if unshare.IsRootless() {
|
||||
return getLocalIP()
|
||||
return util.GetLocalIP()
|
||||
}
|
||||
for net, status := range netStatus {
|
||||
network, err := networkInterface.NetworkInspect(net)
|
||||
@@ -53,27 +51,7 @@ func GetHostContainersInternalIP(conf *config.Config, netStatus map[string]types
|
||||
if ip != "" {
|
||||
return ip
|
||||
}
|
||||
return getLocalIP()
|
||||
}
|
||||
|
||||
// getLocalIP returns the non loopback local IP of the host
|
||||
func getLocalIP() string {
|
||||
addrs, err := net.InterfaceAddrs()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
ip := ""
|
||||
for _, address := range addrs {
|
||||
// check the address type and if it is not a loopback the display it
|
||||
if ipnet, ok := address.(*net.IPNet); ok && ipnet.IP.IsGlobalUnicast() {
|
||||
if util.IsIPv4(ipnet.IP) {
|
||||
return ipnet.IP.String()
|
||||
}
|
||||
// if ipv6 we keep looking for an ipv4 address
|
||||
ip = ipnet.IP.String()
|
||||
}
|
||||
}
|
||||
return ip
|
||||
return util.GetLocalIP()
|
||||
}
|
||||
|
||||
// GetNetworkHostEntries returns HostEntries for all ips in the network status
|
||||
|
||||
22
vendor/github.com/containers/common/libnetwork/util/ip.go
generated
vendored
22
vendor/github.com/containers/common/libnetwork/util/ip.go
generated
vendored
@@ -54,3 +54,25 @@ func NormalizeIP(ip *net.IP) {
|
||||
*ip = ipv4
|
||||
}
|
||||
}
|
||||
|
||||
// GetLocalIP returns the first non loopback local IPv4 of the host.
|
||||
// If no ipv4 address is found it may return an ipv6 address.
|
||||
// When no ip is found and empty string is returned.
|
||||
func GetLocalIP() string {
|
||||
addrs, err := net.InterfaceAddrs()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
ip := ""
|
||||
for _, address := range addrs {
|
||||
// check the address type and if it is not a loopback the display it
|
||||
if ipnet, ok := address.(*net.IPNet); ok && ipnet.IP.IsGlobalUnicast() {
|
||||
if IsIPv4(ipnet.IP) {
|
||||
return ipnet.IP.String()
|
||||
}
|
||||
// if ipv6 we keep looking for an ipv4 address
|
||||
ip = ipnet.IP.String()
|
||||
}
|
||||
}
|
||||
return ip
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user