allocate c.Sysctl if necessary

This commit is contained in:
Joel Elkins 2023-12-08 15:20:51 -06:00
parent 797a354b30
commit fa09942631
No known key found for this signature in database
GPG Key ID: 133589DC38921AE2

View File

@ -178,7 +178,10 @@ func (c *Container) CreateCommands() cmd.Set {
nets := map[string]types.PerNetworkOptions{} nets := map[string]types.PerNetworkOptions{}
dns := []net.IP{} dns := []net.IP{}
for i := range c.Networks { for i := range c.Networks {
if !c.Networks[i].IPv6.Bool { if c.Networks[i].IPv6.Valid && !c.Networks[i].IPv6.Bool {
if c.Sysctl == nil {
c.Sysctl = make(map[string]string, 1)
}
c.Sysctl["net.ipv6.conf."+c.Networks[i].Name+".accept_ra"] = "0" c.Sysctl["net.ipv6.conf."+c.Networks[i].Name+".accept_ra"] = "0"
} }
ips := []net.IP{} ips := []net.IP{}