Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dualstack Network Support #549

Open
wants to merge 71 commits into
base: master
Choose a base branch
from
Open

Dualstack Network Support #549

wants to merge 71 commits into from

Conversation

majst01
Copy link
Contributor

@majst01 majst01 commented Jul 17, 2024

Closes #164

Actions Required

The ChildPrefixLength property was removed from the Partition Entity. Every TenantSupernetwork must now be configured with ChildPrefixLength accordingly.
This is done during startup in the database migration step and set to the same value as in the `Partition`.

It is required to add a defaultchildprefixlength property to the tenant super network in you configuration because otherwise the initial network creation will fail:
Sample:
  defaultchildprefixlength:
    IPv4: 22

Also ensure that all firewall-controllers are up-to-date in all firewalls before adding ipv6 prefixes to any of the exiting networks.

Depends on:

replaces #544

TODO:

  • add possibility to create machines in different networks like internet and tenant-network, but only from tenant-network IPs from both AF are acquired, but only ipv4 is possible from internet even if dualstack

@majst01 majst01 force-pushed the dualstack-support branch 4 times, most recently from 5919c8f to 0c53831 Compare July 23, 2024 07:47
@majst01 majst01 force-pushed the dualstack-support branch 7 times, most recently from d49d2c0 to b65c835 Compare July 25, 2024 09:50
@majst01 majst01 force-pushed the dualstack-support branch 3 times, most recently from 23a3d1e to 89096c0 Compare August 2, 2024 12:40
@majst01 majst01 force-pushed the dualstack-support branch 2 times, most recently from a3571a2 to d9667d3 Compare August 5, 2024 07:13
if n == nil || n.network == nil {
continue
}
if len(n.network.AddressFamilies) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this is possible but can this be dynamically evaluated where the network was retrieved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This simply guards if the network has not AF set

@@ -439,6 +456,79 @@ func validateAdditionalAnnouncableCIDRs(additionalCidrs []string, privateSuper b
return nil
}

func validatePrefixesAndAddressFamilies(prefixes, destinationPrefixes []string, defaultChildPrefixLength metal.ChildPrefixLength, privateSuper bool) (metal.Prefixes, metal.Prefixes, metal.AddressFamilies, error) {
Copy link
Contributor

@Gerrit91 Gerrit91 Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function signature does not imply the return values. Could be better to split validation functions from parsing functions to increase reusability.

if err != nil {
return nil, nil, nil, err
}
// all DestinationPrefixes must be valid and from the same addressfamily
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still correct? Because I see different address families in the destination prefixes in our test environment.


prefixes = append(prefixes, *prefix)
var childPrefixLength = metal.ChildPrefixLength{}
for af, length := range requestPayload.DefaultChildPrefixLength {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either this needs only to be done for private super or the validation must be extended to validate this field for non-private super networks, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return nil, nil, nil, fmt.Errorf("private super network must always contain a defaultchildprefixlength")
}

for af, length := range defaultChildPrefixLength {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be good to check if the address family is actually IPv4 or IPv6.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also done

return nil, err
}
if childPrefix == nil {
return nil, fmt.Errorf("could not allocate child prefix in parent network: %s for addressfamily: %s length:%d", parent.ID, af, childLength)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to mitigate this but this is a potential leakage in case one child prefix could already be allocated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

☂️-Issue IPv6 Support
4 participants