Federal Law is the supreme law of the land. If states choose to define marriage along these lines then its perfectly fine. Should they differ, particularly to discriminate against the LGBTQ community, the law is 'ultra vires' therefore must not be legal at all.