mirror of
https://github.com/containers/podman.git
synced 2025-05-21 00:56:36 +08:00
Merge pull request #24594 from openshift-cherrypick-robot/cherry-pick-24578-to-v5.3
[v5.3] libpod: addHosts() prevent nil deref
This commit is contained in:
@ -2323,7 +2323,7 @@ func (c *Container) addHosts() error {
|
|||||||
// not be routed to the host.
|
// not be routed to the host.
|
||||||
// https://github.com/containers/podman/issues/22653
|
// https://github.com/containers/podman/issues/22653
|
||||||
info, err := c.runtime.network.RootlessNetnsInfo()
|
info, err := c.runtime.network.RootlessNetnsInfo()
|
||||||
if err == nil {
|
if err == nil && info != nil {
|
||||||
exclude = info.IPAddresses
|
exclude = info.IPAddresses
|
||||||
if len(info.MapGuestIps) > 0 {
|
if len(info.MapGuestIps) > 0 {
|
||||||
// we used --map-guest-addr to setup pasta so prefer this address
|
// we used --map-guest-addr to setup pasta so prefer this address
|
||||||
|
@ -624,7 +624,7 @@ func (c *Container) addSpecialDNS(nameservers []string) []string {
|
|||||||
switch {
|
switch {
|
||||||
case c.config.NetMode.IsBridge():
|
case c.config.NetMode.IsBridge():
|
||||||
info, err := c.runtime.network.RootlessNetnsInfo()
|
info, err := c.runtime.network.RootlessNetnsInfo()
|
||||||
if err == nil {
|
if err == nil && info != nil {
|
||||||
nameservers = append(nameservers, info.DnsForwardIps...)
|
nameservers = append(nameservers, info.DnsForwardIps...)
|
||||||
}
|
}
|
||||||
case c.pastaResult != nil:
|
case c.pastaResult != nil:
|
||||||
|
Reference in New Issue
Block a user