@@ -2262,7 +2262,7 @@ func (c *Container) addResolvConf() error {
22622262 // add the nameservers from the networks status
22632263 nameservers = networkNameServers
22642264 } else {
2265- // pasta and slirp4netns have a built in DNS forwarder.
2265+ // pasta has a built in DNS forwarder.
22662266 nameservers = c .addSpecialDNS (nameservers )
22672267 }
22682268 }
@@ -2318,11 +2318,7 @@ func (c *Container) checkForIPv6(netStatus map[string]types.StatusBlock) bool {
23182318 }
23192319 }
23202320
2321- if c .pastaResult != nil {
2322- return c .pastaResult .IPv6
2323- }
2324-
2325- return c .isSlirp4netnsIPv6 ()
2321+ return c .pastaResult .IPv6
23262322}
23272323
23282324// Add a new nameserver to the container's resolv.conf, ensuring that it is the
@@ -2373,7 +2369,7 @@ func getLocalhostHostEntry(c *Container) etchosts.HostEntries {
23732369}
23742370
23752371// getHostsEntries returns the container ip host entries for the correct netmode
2376- func (c * Container ) getHostsEntries () ( etchosts.HostEntries , error ) {
2372+ func (c * Container ) getHostsEntries () etchosts.HostEntries {
23772373 var entries etchosts.HostEntries
23782374 names := []string {c .Hostname (), c .config .Name }
23792375 switch {
@@ -2384,18 +2380,12 @@ func (c *Container) getHostsEntries() (etchosts.HostEntries, error) {
23842380 if len (c .pastaResult .IPAddresses ) > 0 {
23852381 entries = etchosts.HostEntries {{IP : c .pastaResult .IPAddresses [0 ].String (), Names : names }}
23862382 }
2387- case c .config .NetMode .IsSlirp4netns ():
2388- ip , err := getSlirp4netnsIP (c .slirp4netnsSubnet )
2389- if err != nil {
2390- return nil , err
2391- }
2392- entries = etchosts.HostEntries {{IP : ip .String (), Names : names }}
23932383 default :
23942384 if c .hasNetNone () {
23952385 entries = etchosts.HostEntries {{IP : "127.0.0.1" , Names : names }}
23962386 }
23972387 }
2398- return entries , nil
2388+ return entries
23992389}
24002390
24012391func (c * Container ) createHostsFile () error {
@@ -2414,10 +2404,7 @@ func (c *Container) addHosts() error {
24142404 // no host file nothing to do
24152405 return nil
24162406 }
2417- containerIPsEntries , err := c .getHostsEntries ()
2418- if err != nil {
2419- return fmt .Errorf ("failed to get container ip host entries: %w" , err )
2420- }
2407+ containerIPsEntries := c .getHostsEntries ()
24212408
24222409 // Consider container level BaseHostsFile configuration first.
24232410 // If it is empty, fallback to containers.conf level configuration.
0 commit comments