Skip to content

Commit

Permalink
Merge pull request #12311 from MusicDin/fix/ovn-static-ips
Browse files Browse the repository at this point in the history
lxd/device/nic_ovn: Prevent setting static IPv6 if static IPv4 is not set
  • Loading branch information
tomponline authored Sep 25, 2023
2 parents a700a2f + d212986 commit b8564e4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lxd/device/nic_ovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ func (d *nicOVN) validateConfig(instConf instance.ConfigReader) error {
return fmt.Errorf("Cannot specify %q when DHCP or %q are disabled on network %q", "ipv6.address", "ipv6.dhcp.stateful", d.config["network"])
}

// Static IPv6 is allowed only if static IPv4 is set as well.
if d.config["ipv4.address"] == "" {
return fmt.Errorf("Cannot specify %q when %q is not set", "ipv6.address", "ipv4.address")
}

ip, subnet, err := net.ParseCIDR(netConfig["ipv6.address"])
if err != nil {
return fmt.Errorf("Invalid network ipv6.address: %w", err)
Expand Down

0 comments on commit b8564e4

Please sign in to comment.