diff --git a/internal/server/network/ovn/ovn_nb_actions.go b/internal/server/network/ovn/ovn_nb_actions.go index 011e299a571..5bc34fbf77b 100644 --- a/internal/server/network/ovn/ovn_nb_actions.go +++ b/internal/server/network/ovn/ovn_nb_actions.go @@ -1658,16 +1658,16 @@ func (o *NB) CreateLogicalSwitchPort(ctx context.Context, switchName OVNSwitch, address = append(address, opts.MAC.String()) } - if opts.IPV4 == "" || opts.IPV6 == "" { + if opts.IPV4 == "" && opts.IPV6 == "" { address = append(address, "dynamic") - } - - if opts.IPV4 != "" { - address = append(address, opts.IPV4) - } + } else { + if opts.IPV4 != "" { + address = append(address, opts.IPV4) + } - if opts.IPV6 != "" { - address = append(address, opts.IPV6) + if opts.IPV6 != "" { + address = append(address, opts.IPV6) + } } addresses = append(addresses, strings.Join(address, " "))