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

Ipv6 overlay #1176

Closed
wants to merge 23 commits into from
Closed

Ipv6 overlay #1176

wants to merge 23 commits into from

Conversation

nbrownus
Copy link
Collaborator

@nbrownus nbrownus commented Jul 10, 2024

This is a very early proof of concept. It is 100% not backward compatible with released nebula versions in its current form

Moving over to https://github.com/nbrownus/nebula/tree/ipv6-overlay-final for the time being

Closes #6

Comment on lines +22 to +23
RawNetwork Ip = 2;
repeated RawNetwork Subnets = 3;
Copy link
Member

@wadey wadey Jul 10, 2024

Choose a reason for hiding this comment

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

For a compatible version, I think we can just deprecate the old versions of these fields and make the new ones be optional. Then we could have the code prefer the new fields but fall back to the old ones if missing.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like this approach as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Current goals are to get the innards of ipv6 working, figure backwards/forwards compatibility will take the most time so I am ignoring it for now.

}

vpnIp = vpnIp.Unmap()
vpnIp := remoteCert.Details.Ip.Addr()
Copy link
Contributor

Choose a reason for hiding this comment

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

If Ip is somehow blank/invalid, do we need a check for that here to mirror the old way?

}

//TODO: whats a reasonable number of extension headers to attempt to parse?
//https://www.ietf.org/archive/id/draft-ietf-6man-eh-limits-00.html
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm reading this correctly, the last bullet of 3.2.2 says we can set a limit of 104 bytes for the "maximum length of the IPv6 header chain". Perhaps that's the way to go, until we observe problems?

Copy link
Contributor

Choose a reason for hiding this comment

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

Cisco has a nice paper here that explains what they do with extension headers: https://www.cisco.com/en/US/technologies/tk648/tk872/technologies_white_paper0900aecd8054d37d.html

Copy link
Contributor

Choose a reason for hiding this comment

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

https://datatracker.ietf.org/doc/html/rfc7872#page-3 This RFC measured the drop rate of IPv6 packets with any extension headers circa 2016, with dismal results. It seems that attempting to deal with them at all is considered noble.

return nil

case layers.IPProtocolIPv6Fragment:
//TODO: can we determine the protocol?
Copy link
Contributor

Choose a reason for hiding this comment

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

Kind of? Subsequent fragment packets don't contain their TCP/UDP headers. We can keep a list of all the fragment Identification Numbers with their protocols and port numbers, but that could get out of hand quickly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Because ipv6 only allows the host to fragment, support for fragments at all could be less critical.

Another ipv6-specific problem is because of extension headers, I think it's possible for port numbers to be missing from the first packet of a fragmented message :(

for i := 0; i < 24; i++ {
switch proto {
case layers.IPProtocolICMPv6:
//TODO: we need a new protocol in config language "icmpv6"
Copy link
Contributor

Choose a reason for hiding this comment

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

We may also want to think about dropping NDP and perhaps also RS/RA traffic, but allowing things like ping and error messages. NDP in particular should never occur on a nebula network (I think?)

@@ -35,6 +35,12 @@ message RawNebulaCertificateDetails {
Curve curve = 100;
}

message RawNetwork {
Copy link
Contributor

Choose a reason for hiding this comment

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

Because submessages are LEN types, it could make sense to use a string here, which would let us use netip.Addr.MarshalBinary.

I'm gonna ignore bits for now because it needs to be encoded somehow anyway

A submessage:

[LEN+id] [length] [ [hi id][hi varint] [lo id][lo varint] ] = 
min 1 + 1 + 2(1+1)  = 6, max 1 + 1 + 2(1+10) = 24

A bytes for address:

[LEN+id] [length] [16-byte address]  = 
1 + 1 + 16 = 18

A submessage can make sense if we think hi/lo of the v6 address are likely to be "small numbers", but if they're not, we could end up wasting bytes compared to a string-ier representation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I dont anticipate this to be the final types, fixed64 Hi and uint64 Lo is probably correct though. I agree avoiding the submessage is ideal as well. Avoiding protobuf would also be pretty cool :D

uint32 counter = 3;
}

message Ip {
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as above, "what if we used bytes?"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I dislike the unbounded nature of bytes.

As mentioned in the other comment, I had noodled on something along these lines

message NebulaMetaDetails {
  fixed64 VpnIpHi = 1;
  uint64 VpnIpLo = 2;
  ...
}

Stuff to noodle on at least

Base automatically changed from netip-final to master July 31, 2024 15:18
@nbrownus nbrownus closed this Aug 28, 2024
@nbrownus nbrownus deleted the ipv6-overlay-final branch August 28, 2024 02:12
@maggie44
Copy link

maggie44 commented Sep 9, 2024

Does this mean ipv6 support is not being added anymore?

@IanVS
Copy link
Collaborator

IanVS commented Sep 9, 2024

Don't worry, It is still being actively developed. This was simply an early proof-of-concept PR that was used to get some feedback from other team members.

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

Successfully merging this pull request may close these issues.

IPv6 for overlay network?
5 participants