mirror of
https://github.com/containers/podman.git
synced 2025-12-02 02:58:03 +08:00
Update common, image, and storage deps
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
committed by
Paul Holzinger
parent
32d96f40c3
commit
444f19cb2a
38
vendor/github.com/containers/common/libnetwork/cni/network.go
generated
vendored
38
vendor/github.com/containers/common/libnetwork/cni/network.go
generated
vendored
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/containernetworking/cni/libcni"
|
||||
"github.com/containers/common/libnetwork/types"
|
||||
"github.com/containers/common/pkg/config"
|
||||
cutil "github.com/containers/common/pkg/util"
|
||||
"github.com/containers/storage/pkg/lockfile"
|
||||
"github.com/containers/storage/pkg/unshare"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -295,6 +296,43 @@ func (n *cniNetwork) DefaultInterfaceName() string {
|
||||
return cniDeviceName
|
||||
}
|
||||
|
||||
// NetworkInfo return the network information about binary path,
|
||||
// package version and program version.
|
||||
func (n *cniNetwork) NetworkInfo() types.NetworkInfo {
|
||||
path := ""
|
||||
packageVersion := ""
|
||||
for _, p := range n.cniPluginDirs {
|
||||
ver := cutil.PackageVersion(p)
|
||||
if ver != cutil.UnknownPackage {
|
||||
path = p
|
||||
packageVersion = ver
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
info := types.NetworkInfo{
|
||||
Backend: types.CNI,
|
||||
Package: packageVersion,
|
||||
Path: path,
|
||||
}
|
||||
|
||||
dnsPath := filepath.Join(path, "dnsname")
|
||||
dnsPackage := cutil.PackageVersion(dnsPath)
|
||||
dnsProgram, err := cutil.ProgramVersionDnsname(dnsPath)
|
||||
if err != nil {
|
||||
logrus.Infof("Failed to get the dnsname plugin version: %v", err)
|
||||
}
|
||||
if _, err := os.Stat(dnsPath); err == nil {
|
||||
info.DNS = types.DNSNetworkInfo{
|
||||
Path: dnsPath,
|
||||
Package: dnsPackage,
|
||||
Version: dnsProgram,
|
||||
}
|
||||
}
|
||||
|
||||
return info
|
||||
}
|
||||
|
||||
func (n *cniNetwork) Network(nameOrID string) (*types.Network, error) {
|
||||
network, err := n.getNetwork(nameOrID)
|
||||
if err != nil {
|
||||
|
||||
37
vendor/github.com/containers/common/libnetwork/internal/util/validate.go
generated
vendored
37
vendor/github.com/containers/common/libnetwork/internal/util/validate.go
generated
vendored
@@ -81,6 +81,43 @@ func ValidateSubnets(network *types.Network, addGateway bool, usedNetworks []*ne
|
||||
return nil
|
||||
}
|
||||
|
||||
func ValidateRoutes(routes []types.Route) error {
|
||||
for _, route := range routes {
|
||||
err := ValidateRoute(route)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ValidateRoute(route types.Route) error {
|
||||
if route.Destination.IP == nil {
|
||||
return fmt.Errorf("route destination ip nil")
|
||||
}
|
||||
|
||||
if route.Destination.Mask == nil {
|
||||
return fmt.Errorf("route destination mask nil")
|
||||
}
|
||||
|
||||
if route.Gateway == nil {
|
||||
return fmt.Errorf("route gateway nil")
|
||||
}
|
||||
|
||||
// Reparse to ensure destination is valid.
|
||||
ip, ipNet, err := net.ParseCIDR(route.Destination.String())
|
||||
if err != nil {
|
||||
return fmt.Errorf("route destination invalid: %w", err)
|
||||
}
|
||||
|
||||
// check that destination is a network and not an address
|
||||
if !ip.Equal(ipNet.IP) {
|
||||
return fmt.Errorf("route destination invalid")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func ValidateSetupOptions(n NetUtil, namespacePath string, options types.SetupOptions) error {
|
||||
if namespacePath == "" {
|
||||
return errors.New("namespacePath is empty")
|
||||
|
||||
31
vendor/github.com/containers/common/libnetwork/netavark/config.go
generated
vendored
31
vendor/github.com/containers/common/libnetwork/netavark/config.go
generated
vendored
@@ -198,6 +198,13 @@ func (n *netavarkNetwork) networkCreate(newNetwork *types.Network, defaultNet bo
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case types.NoDefaultRoute:
|
||||
val, err := strconv.ParseBool(value)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// rust only support "true" or "false" while go can parse 1 and 0 as well so we need to change it
|
||||
newNetwork.Options[types.NoDefaultRoute] = strconv.FormatBool(val)
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported bridge network option %s", key)
|
||||
@@ -237,6 +244,12 @@ func (n *netavarkNetwork) networkCreate(newNetwork *types.Network, defaultNet bo
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//validate routes
|
||||
err = internalutil.ValidateRoutes(newNetwork.Routes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
newNetwork.Created = time.Now()
|
||||
|
||||
if !defaultNet {
|
||||
@@ -317,6 +330,24 @@ func createIpvlanOrMacvlan(network *types.Network) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case types.NoDefaultRoute:
|
||||
val, err := strconv.ParseBool(value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// rust only support "true" or "false" while go can parse 1 and 0 as well so we need to change it
|
||||
network.Options[types.NoDefaultRoute] = strconv.FormatBool(val)
|
||||
case types.BclimOption:
|
||||
if isMacVlan {
|
||||
_, err := strconv.ParseInt(value, 10, 32)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse %q option: %w", key, err)
|
||||
}
|
||||
// do not fallthrough for macvlan
|
||||
break
|
||||
}
|
||||
// bclim is only valid for macvlan not ipvlan so fallthrough to error case
|
||||
fallthrough
|
||||
default:
|
||||
return fmt.Errorf("unsupported %s network option %s", driver, key)
|
||||
}
|
||||
|
||||
32
vendor/github.com/containers/common/libnetwork/netavark/network.go
generated
vendored
32
vendor/github.com/containers/common/libnetwork/netavark/network.go
generated
vendored
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/containers/common/libnetwork/internal/util"
|
||||
"github.com/containers/common/libnetwork/types"
|
||||
"github.com/containers/common/pkg/config"
|
||||
cutil "github.com/containers/common/pkg/util"
|
||||
"github.com/containers/storage/pkg/lockfile"
|
||||
"github.com/containers/storage/pkg/unshare"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -336,6 +337,37 @@ func (n *netavarkNetwork) DefaultInterfaceName() string {
|
||||
return defaultBridgeName
|
||||
}
|
||||
|
||||
// NetworkInfo return the network information about binary path,
|
||||
// package version and program version.
|
||||
func (n *netavarkNetwork) NetworkInfo() types.NetworkInfo {
|
||||
path := n.netavarkBinary
|
||||
packageVersion := cutil.PackageVersion(path)
|
||||
programVersion, err := cutil.ProgramVersion(path)
|
||||
if err != nil {
|
||||
logrus.Infof("Failed to get the netavark version: %v", err)
|
||||
}
|
||||
info := types.NetworkInfo{
|
||||
Backend: types.Netavark,
|
||||
Version: programVersion,
|
||||
Package: packageVersion,
|
||||
Path: path,
|
||||
}
|
||||
|
||||
dnsPath := n.aardvarkBinary
|
||||
dnsPackage := cutil.PackageVersion(dnsPath)
|
||||
dnsProgram, err := cutil.ProgramVersion(dnsPath)
|
||||
if err != nil {
|
||||
logrus.Infof("Failed to get the aardvark version: %v", err)
|
||||
}
|
||||
info.DNS = types.DNSNetworkInfo{
|
||||
Package: dnsPackage,
|
||||
Path: dnsPath,
|
||||
Version: dnsProgram,
|
||||
}
|
||||
|
||||
return info
|
||||
}
|
||||
|
||||
func (n *netavarkNetwork) Network(nameOrID string) (*types.Network, error) {
|
||||
network, err := n.getNetwork(nameOrID)
|
||||
if err != nil {
|
||||
|
||||
12
vendor/github.com/containers/common/libnetwork/types/const.go
generated
vendored
12
vendor/github.com/containers/common/libnetwork/types/const.go
generated
vendored
@@ -36,11 +36,13 @@ const (
|
||||
IPVLANModeL3s = "l3s"
|
||||
|
||||
// valid network options
|
||||
VLANOption = "vlan"
|
||||
MTUOption = "mtu"
|
||||
ModeOption = "mode"
|
||||
IsolateOption = "isolate"
|
||||
MetricOption = "metric"
|
||||
VLANOption = "vlan"
|
||||
MTUOption = "mtu"
|
||||
ModeOption = "mode"
|
||||
IsolateOption = "isolate"
|
||||
MetricOption = "metric"
|
||||
NoDefaultRoute = "no_default_route"
|
||||
BclimOption = "bclim"
|
||||
)
|
||||
|
||||
type NetworkBackend string
|
||||
|
||||
33
vendor/github.com/containers/common/libnetwork/types/network.go
generated
vendored
33
vendor/github.com/containers/common/libnetwork/types/network.go
generated
vendored
@@ -34,6 +34,10 @@ type ContainerNetwork interface {
|
||||
// DefaultNetworkName will return the default network name
|
||||
// for this interface.
|
||||
DefaultNetworkName() string
|
||||
|
||||
// NetworkInfo return the network information about backend type,
|
||||
// binary path, package version and so on.
|
||||
NetworkInfo() NetworkInfo
|
||||
}
|
||||
|
||||
// Network describes the Network attributes.
|
||||
@@ -50,6 +54,8 @@ type Network struct {
|
||||
Created time.Time `json:"created,omitempty"`
|
||||
// Subnets to use for this network.
|
||||
Subnets []Subnet `json:"subnets,omitempty"`
|
||||
// Routes to use for this network.
|
||||
Routes []Route `json:"routes,omitempty"`
|
||||
// IPv6Enabled if set to true an ipv6 subnet should be created for this net.
|
||||
IPv6Enabled bool `json:"ipv6_enabled"`
|
||||
// Internal is whether the Network should not have external routes
|
||||
@@ -80,6 +86,22 @@ type NetworkUpdateOptions struct {
|
||||
RemoveDNSServers []string `json:"remove_dns_servers,omitempty"`
|
||||
}
|
||||
|
||||
// NetworkInfo contains the network information.
|
||||
type NetworkInfo struct {
|
||||
Backend NetworkBackend `json:"backend"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Package string `json:"package,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
DNS DNSNetworkInfo `json:"dns,omitempty"`
|
||||
}
|
||||
|
||||
// NetworkInfo contains the DNS information.
|
||||
type DNSNetworkInfo struct {
|
||||
Version string `json:"version,omitempty"`
|
||||
Package string `json:"package,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
}
|
||||
|
||||
// IPNet is used as custom net.IPNet type to add Marshal/Unmarshal methods.
|
||||
type IPNet struct {
|
||||
net.IPNet
|
||||
@@ -169,6 +191,17 @@ type Subnet struct {
|
||||
LeaseRange *LeaseRange `json:"lease_range,omitempty"`
|
||||
}
|
||||
|
||||
type Route struct {
|
||||
// Destination for this route in CIDR form.
|
||||
// swagger:strfmt string
|
||||
Destination IPNet `json:"destination"`
|
||||
// Gateway IP for this route.
|
||||
// swagger:strfmt string
|
||||
Gateway net.IP `json:"gateway"`
|
||||
// Metric for this route. Optional.
|
||||
Metric *uint32 `json:"metric,omitempty"`
|
||||
}
|
||||
|
||||
// LeaseRange contains the range where IP are leased.
|
||||
type LeaseRange struct {
|
||||
// StartIP first IP in the subnet which should be used to assign ips.
|
||||
|
||||
Reference in New Issue
Block a user