update c/common to latest main

Contains the resolv.conf setup changes.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-05-28 14:11:42 +02:00
parent 746cbf12c9
commit 869fceb0fd
4 changed files with 23 additions and 11 deletions

2
go.mod
View File

@ -13,7 +13,7 @@ require (
github.com/checkpoint-restore/go-criu/v7 v7.2.0 github.com/checkpoint-restore/go-criu/v7 v7.2.0
github.com/containernetworking/plugins v1.7.1 github.com/containernetworking/plugins v1.7.1
github.com/containers/buildah v1.40.1-0.20250523151639-b535d02d0ee1 github.com/containers/buildah v1.40.1-0.20250523151639-b535d02d0ee1
github.com/containers/common v0.63.1-0.20250528122446-1a3b5ecec62f github.com/containers/common v0.63.1-0.20250602154905-5a4ca2d5d355
github.com/containers/conmon v2.0.20+incompatible github.com/containers/conmon v2.0.20+incompatible
github.com/containers/gvisor-tap-vsock v0.8.6 github.com/containers/gvisor-tap-vsock v0.8.6
github.com/containers/image/v5 v5.35.1-0.20250526152843-c64593da00e4 github.com/containers/image/v5 v5.35.1-0.20250526152843-c64593da00e4

4
go.sum
View File

@ -68,8 +68,8 @@ github.com/containernetworking/plugins v1.7.1 h1:CNAR0jviDj6FS5Vg85NTgKWLDzZPfi/
github.com/containernetworking/plugins v1.7.1/go.mod h1:xuMdjuio+a1oVQsHKjr/mgzuZ24leAsqUYRnzGoXHy0= github.com/containernetworking/plugins v1.7.1/go.mod h1:xuMdjuio+a1oVQsHKjr/mgzuZ24leAsqUYRnzGoXHy0=
github.com/containers/buildah v1.40.1-0.20250523151639-b535d02d0ee1 h1:3bNWDmqh9tx0iAXPzBJugj/oC0nTD9yTXCyIu/Mj/LE= github.com/containers/buildah v1.40.1-0.20250523151639-b535d02d0ee1 h1:3bNWDmqh9tx0iAXPzBJugj/oC0nTD9yTXCyIu/Mj/LE=
github.com/containers/buildah v1.40.1-0.20250523151639-b535d02d0ee1/go.mod h1:8BVLrM6nRl/dRMYxZ+TrmoWPXzkCY99rZOYvJoXpIyE= github.com/containers/buildah v1.40.1-0.20250523151639-b535d02d0ee1/go.mod h1:8BVLrM6nRl/dRMYxZ+TrmoWPXzkCY99rZOYvJoXpIyE=
github.com/containers/common v0.63.1-0.20250528122446-1a3b5ecec62f h1:308Ex0+3+gBSpDPJrFCQIhALdD8YC7jzaXuxSFZgFiA= github.com/containers/common v0.63.1-0.20250602154905-5a4ca2d5d355 h1:vK7TVpONcQzWHR4dAEnLkLeCrKNB61UhLDpwAXFIIto=
github.com/containers/common v0.63.1-0.20250528122446-1a3b5ecec62f/go.mod h1:efNRNweihnq5nXALnAPDXTpC7uJtnFV4pNuETTfvI8s= github.com/containers/common v0.63.1-0.20250602154905-5a4ca2d5d355/go.mod h1:efNRNweihnq5nXALnAPDXTpC7uJtnFV4pNuETTfvI8s=
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg= github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I= github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
github.com/containers/gvisor-tap-vsock v0.8.6 h1:9SeAXK+K2o36CtrgYk6zRXbU3zrayjvkrI8b7/O6u5A= github.com/containers/gvisor-tap-vsock v0.8.6 h1:9SeAXK+K2o36CtrgYk6zRXbU3zrayjvkrI8b7/O6u5A=

View File

@ -30,17 +30,28 @@ type Params struct {
// IPv6Enabled will filter ipv6 nameservers when not set to true. // IPv6Enabled will filter ipv6 nameservers when not set to true.
IPv6Enabled bool IPv6Enabled bool
// KeepHostServers can be set when it is required to still keep the // KeepHostServers can be set when it is required to still keep the
// original resolv.conf content even when custom Nameserver/Searches/Options // original resolv.conf nameservers even when explicit Nameservers
// are set. In this case they will be appended to the given values. // are set. In this case they will be appended to the given values.
KeepHostServers bool KeepHostServers bool
// KeepHostSearches can be set when it is required to still keep the
// original resolv.conf search domains even when explicit search domains
// are set in Searches.
KeepHostSearches bool
// KeepHostOptions can be set when it is required to still keep the
// original resolv.conf options even when explicit options are set in
// Options.
KeepHostOptions bool
// Nameservers is a list of nameservers the container should use, // Nameservers is a list of nameservers the container should use,
// instead of the default ones from the host. // instead of the default ones from the host. Set KeepHostServers
// in order to also keep the hosts resolv.conf nameservers.
Nameservers []string Nameservers []string
// Searches is a list of dns search domains the container should use, // Searches is a list of dns search domains the container should use,
// instead of the default ones from the host. // instead of the default ones from the host. Set KeepHostSearches
// in order to also keep the hosts resolv.conf search domains.
Searches []string Searches []string
// Options is a list of dns options the container should use, // Options is a list of dns options the container should use,
// instead of the default ones from the host. // instead of the default ones from the host. Set KeepHostOptions
// in order to also keep the hosts resolv.conf options.
Options []string Options []string
// resolvConfPath is the path which should be used as base to get the dns // resolvConfPath is the path which should be used as base to get the dns
@ -121,7 +132,8 @@ func unsetSearchDomainsIfNeeded(searches []string) []string {
// New creates a new resolv.conf file with the given params. // New creates a new resolv.conf file with the given params.
func New(params *Params) error { func New(params *Params) error {
// short path, if everything is given there is no need to actually read the hosts /etc/resolv.conf // short path, if everything is given there is no need to actually read the hosts /etc/resolv.conf
if len(params.Nameservers) > 0 && len(params.Options) > 0 && len(params.Searches) > 0 && !params.KeepHostServers { if len(params.Nameservers) > 0 && len(params.Options) > 0 && len(params.Searches) > 0 &&
!params.KeepHostServers && !params.KeepHostOptions && !params.KeepHostSearches {
return build(params.Path, params.Nameservers, unsetSearchDomainsIfNeeded(params.Searches), params.Options) return build(params.Path, params.Nameservers, unsetSearchDomainsIfNeeded(params.Searches), params.Options)
} }
@ -140,12 +152,12 @@ func New(params *Params) error {
searches := unsetSearchDomainsIfNeeded(params.Searches) searches := unsetSearchDomainsIfNeeded(params.Searches)
// if no params.Searches then use host ones // if no params.Searches then use host ones
// otherwise make sure that they were no explicitly unset before adding host ones // otherwise make sure that they were no explicitly unset before adding host ones
if len(params.Searches) == 0 || (params.KeepHostServers && len(searches) > 0) { if len(params.Searches) == 0 || (params.KeepHostSearches && len(searches) > 0) {
searches = append(searches, getSearchDomains(content)...) searches = append(searches, getSearchDomains(content)...)
} }
options := params.Options options := params.Options
if len(options) == 0 || params.KeepHostServers { if len(options) == 0 || params.KeepHostOptions {
options = append(options, getOptions(content)...) options = append(options, getOptions(content)...)
} }

2
vendor/modules.txt vendored
View File

@ -142,7 +142,7 @@ github.com/containers/buildah/pkg/sshagent
github.com/containers/buildah/pkg/util github.com/containers/buildah/pkg/util
github.com/containers/buildah/pkg/volumes github.com/containers/buildah/pkg/volumes
github.com/containers/buildah/util github.com/containers/buildah/util
# github.com/containers/common v0.63.1-0.20250528122446-1a3b5ecec62f # github.com/containers/common v0.63.1-0.20250602154905-5a4ca2d5d355
## explicit; go 1.23.3 ## explicit; go 1.23.3
github.com/containers/common/internal github.com/containers/common/internal
github.com/containers/common/internal/attributedstring github.com/containers/common/internal/attributedstring