You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature support for type safe tunnel protocol modeling. This pattern can be applied to tunnels such as various IP in IP, GRE, and VXLAN etc.
The general design is tunnels can be codified into structs by implementing the Tunnel trait. Tunnel is defined by the delivery (outer) protocol and payload (inner) protocol. For example GRE header can be used in many tunneling methods. The specific use of GRE in tunneling any layer-3 packets inside a IPv4 packet is implemented by the Ip4Gre tunnel. Two tunnels can have the same delivery and payload protocols but modify the protocol stack differently, for example both Ip4Gre and IpIp can tunnel IPv4 packets in IPv4.
On entry to a tunnel, the payload packet should be constructed first then encapsulated,
let packet = Mbuf::new()?;
let ethernet = packet.push::<Ethernet>()?;
let ip6 = ethernet.push::<Ipv6>()?;
let mut payload = ip6.push::<EchoReply>()?.deparse();
// construct the payload in its entirety
payload.set_src(src);
payload.set_dst(dst);
payload.reconcile();
// encap the payload in the tunnel
let delivery = payload.encap::<Ip4Gre<Ipv6>>()?;
delivery.set_src(tunnel_entry);
delivery.set_dst(tunnel_exit);
// after encap, the original payload can't be parsed or modified
let gre = delivery.parse::<Gre<Ipv4>>()?; // can look at the GRE header
let original = gre.parse::<Ipv6>()?; // won't compile
on tunnel exit, decap to access and modify the payload again
let ethernet = packet.parse::<Ethernet>()?;
let delivery = ethernet.parse::<Ipv4>()?;
let payload = delivery.decap::<Ip4Gre<Ipv6>>()?;
let echo = payload.parse::<EchoReply>()?;
❗ Current head a9001f4 differs from pull request most recent head 6ab3d83. Consider uploading reports for the commit 6ab3d83 to get more accurate results
Nice. One of the things we're looking to do is to provide an application that has as input ipv4 multicast and as one or more outputs in ipv6 multicast in a DOCSIS Downstream External-PHY Interface (DEPI) tunnel, which uses a layer 2 tunneling protocol to add a session id and sequence number to the multicast ipv6 packet. Sets next header to 115 (L2TP) and sets up the ethernet packet appropriately. We're looking to use DPDK due to performance requirements of this app.
As a user here, I'd like to throw in that it feels like this might interact with Geneve encapsulation (or maybe not!) and that it'd be neat to have capsule support Geneve formats natively.
@skeggse yep, the goal of this approach is to allow for an implementation of Geneve possible, it should be pretty similar to GRE.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Feature support for type safe tunnel protocol modeling. This pattern can be applied to tunnels such as various IP in IP, GRE, and VXLAN etc.
The general design is tunnels can be codified into structs by implementing the
Tunneltrait. Tunnel is defined by the delivery (outer) protocol and payload (inner) protocol. For exampleGREheader can be used in many tunneling methods. The specific use of GRE in tunneling any layer-3 packets inside aIPv4packet is implemented by theIp4Gretunnel. Two tunnels can have the same delivery and payload protocols but modify the protocol stack differently, for example bothIp4GreandIpIpcan tunnelIPv4packets inIPv4.On entry to a tunnel, the payload packet should be constructed first then encapsulated,
on tunnel exit, decap to access and modify the payload again
Type of change
Checklist