summaryrefslogtreecommitdiff
path: root/ofproto/tunnel.h
Commit message (Collapse)AuthorAgeFilesLines
* tunnel: make tun_key_to_attr aware of tunnel type.William Tu2018-05-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | When there is a flow rule which forwards a packet from geneve port to another tunnel port, ex: gre, the tun_metadata carried from the geneve port might affect the outgoing port. For example, the datapath action from geneve port output to gre port (1) shows: set(tunnel(tun_id=0x7b,dst=2.2.2.2,ttl=64, geneve({class=0xffff,type=0,len=4,0x123}),flags(df|key))),1 Where the geneve(...) should not exist. When using kernel's tunnel port, this triggers an error saying: "Multiple metadata blocks provided", when there is a rule forwarding the geneve packet to vxlan/erspan tunnel port. A userspace test case using geneve and gre also demonstrates the issue. The patch makes the tun_key_to_attr aware of the tunnel type. So only the relevant output tunnel's options are set. Reported-by: Xiaoyan Jin <xiaoyanj@vmware.com> Signed-off-by: William Tu <u9012063@gmail.com> Cc: Greg Rose <gvrose8192@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tunnel: Fix deletion of datapath tunnel ports in case of reconfigurationBalazs Nemeth2017-11-281-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is an issue in OVS with tunnel deletion during the reconfiguration of OF tunnels. If the dst_port value is changed, the old tunnel map entry will not be deleted, because the tp_port argument of tnl_port_map_delete() has the new dst_port setting, hence the tunnel cannot be found in the list of tnl_port structures. The patch corrects this mechanism by adding a new argument, 'old_odp_port' to tnl_port_reconfigure(). This value is used to identify the datapath tunnel port which is being reconfigured. In connection with this fix, to unify the tunnel port map handling, odp_port value is used to search the proper port to insert and delete tunnel map entries as well. This variable can be used instead of tp_port, as it is unique for all datapath tunnel ports, and there is no need to reach dst_port from netdev_tunnel_config structure. This patch also adds a printout to check the reference counter of a tnl_port structure in tnl-port.c. Extending OVS unit test cases to have ref_cnt values in the expected dump. Adding new test cases to check if packet receiving is still working in the case of OF tunnel port deletion. Adding new test cases to check the reference counter in case of OF tunnel deletion or reconfiguration. Signed-off-by: Balazs Nemeth <balazs.nemeth@ericsson.com> Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Co-authored-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* netdev-native-tnl: Introduce ip_build_header()Pravin B Shelar2016-05-231-6/+5
| | | | | | | | | | The native tunneling build tunnel header code is spread across two different modules, it makes pretty hard to follow the code. Following patch refactors the code to move all code to netdev-ative-tnl module. Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
* netdev-vport: Add IPv6 support for build/push/pop tunnel headerThadeu Lima de Souza Cascardo2015-12-041-1/+2
| | | | | | | This includes VXLAN, GRE and Geneve. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tunneling: extend flow_tnl with ipv6 addressesJiri Benc2015-11-301-1/+1
| | | | | | | | | | | | | | | | Note that because there's been no prerequisite on the outer protocol, we cannot add it now. Instead, treat the ipv4 and ipv6 dst fields in the way that either both are null, or at most one of them is non-null. [cascardo: abstract testing either dst with flow_tnl_dst_is_set] cascardo: using IPv4-mapped address is an exercise for the future, since this would require special handling of MFF_TUN_SRC and MFF_TUN_DST and OpenFlow messages. Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Co-authored-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* userspace: Define and use struct eth_addr.Jarno Rajahalme2015-08-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Define struct eth_addr and use it instead of a uint8_t array for all ethernet addresses in OVS userspace. The struct is always the right size, and it can be assigned without an explicit memcpy, which makes code more readable. "struct eth_addr" is a good type name for this as many utility functions are already named accordingly. struct eth_addr can be accessed as bytes as well as ovs_be16's, which makes the struct 16-bit aligned. All use seems to be 16-bit aligned, so some algorithms on the ethernet addresses can be made a bit more efficient making use of this fact. As the struct fits into a register (in 64-bit systems) we pass it by value when possible. This patch also changes the few uses of Linux specific ETH_ALEN to OVS's own ETH_ADDR_LEN, and removes the OFP_ETH_ALEN, as it is no longer needed. This work stemmed from a desire to make all struct flow members assignable for unrelated exploration purposes. However, I think this might be a nice code readability improvement by itself. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
* tunnel: Break tnl_xlate_init() into two separate functions.Ben Pfaff2015-07-311-1/+2
| | | | | | | | | | It seems to me that tnl_xlate_init() has two almost-separate tasks. First, it marks most of the 'wc' bits for tunnels. Second, it checks and updates ECN bits. This commit breaks tnl_xlate_init() into two separate functions, one for each of those tasks. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* tunnel: Drop 'base_flow' parameter from tnl_xlate_init().Ben Pfaff2015-07-241-2/+1
| | | | | | | | | At the point when tnl_xlate_init() is called, all of the members that tnl_xlate_init() examines in 'base_flow' have the same values in 'flow', so there's no point in passing both. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* ofproto-dpif: Avoid creating OpenFlow ports for duplicate tunnels.Ben Pfaff2015-06-051-3/+3
| | | | | | | | | | | | Until now, when two tunnels had an identical configuration, both of them were assigned OpenFlow ports, but only one of those OpenFlow ports was functional. With this commit, only one of the two (or more) identically configured tunnels will be assigned an OpenFlow port number. Reported-by: Keith Holleman <hollemanietf@gmail.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Co-authored-by: Andy Zhou <azhou@nicira.com> Signed-off-by: Andy Zhou <azhou@nicira.com>
* openvswitch: Userspace tunneling.Pravin B Shelar2014-11-121-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Following patch adds support for userspace tunneling. Tunneling needs three more component first is routing table which is configured by caching kernel routes and second is ARP cache which build automatically by snooping arp. And third is tunnel protocol table which list all listening protocols which is populated by vswitchd as tunnel ports are added. GRE and VXLAN protocol support is added in this patch. Tunneling works as follows: On packet receive vswitchd check if this packet is targeted to tunnel port. If it is then vswitchd inserts tunnel pop action which pops header and sends packet to tunnel port. On packet xmit rather than generating Set tunnel action it generate tunnel push action which has tunnel header data. datapath can use tunnel-push action data to generate header for each packet and forward this packet to output port. Since tunnel-push action contains most of packet header vswitchd needs to lookup routing table and arp table to build this action. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* tunnel: Convert rwlock to fat-rwlock.Pravin B Shelar2014-11-121-0/+1
| | | | | | | | | | Tunnel lookup is done in slow path but DPDK tunneling slow path is called in PMD context. Therefore it is better to convert rwlock to fat rwlock. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* tunnel: Clear IPSEC_MARK on input rather than output.Jesse Gross2013-08-131-3/+0
| | | | | | | | | | | | | | | Currently we remove the IPSEC_MARK flag from all packets that are egressing on non-tunnel ports. However, this behavior is confusing if we allow OpenFlow controllers to match and set the pkt_mark field because the tunnel behavior applies even on non-tunnel ports. This instead clears the mark on tunnel input which should have the same effect for tunnel ports. However, on non-tunnel traffic (or even for traffic entering on a tunnel port but leaving on a non- tunnel port) it allows the mark to pass through without change. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* tunnel: Consolidate action code for tunnel port receive.Jesse Gross2013-08-131-0/+2
| | | | | | | | | | There are a couple of operations that are related to receiving a packet on a tunnel port but that affect the actions and therefore need to be performed on the output path. This adds a new hook to do this and consolidates the existing code there. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* tunnel: Hide 'struct tnl_port' internally.Ethan Jackson2013-06-281-6/+5
| | | | | | | | | This simplifies the tunnel module's interface and prevents us from having to sync 'struct tnl_port' once ofproto-dpif and ofproto-dpif-xlate are disentangled. Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* tunnel: Use ofport_dpif instead of ofport.Ethan Jackson2013-06-281-5/+7
| | | | | | | Necessary in a future patch. Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Create specific types for ofp and odp portAlex Wang2013-06-201-4/+4
| | | | | | | | | | | | Until now, datapath ports and openflow ports were both represented by unsigned integers of various sizes. With implicit conversions, etc., it is easy to mix them up and use one where the other is expected. This commit creates two typedefs, ofp_port_t and odp_port_t. Both of these two types are marked by "__attribute__((bitwise))" so that sparse can be used to detect any misuse. Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* tunnel: Don't wildcard TTL and TOS in some circumstances.Justin Pettit2013-06-131-1/+2
| | | | | | | | | | | | | For tunnels, we need to handle the facet's wildcards specially in a couple of cases: - Don't wildcard TTL for facets if "ttl" option is "inherit". - Never wildcard the ECN bits, since they are always inherited. - Wildcard the rest of the TOS field if the "tos" option is "inherit". Issue #17911 Signed-off-by: Justin Pettit <jpettit@nicira.com>
* tunnel: Make tnl_port_receive() parameter 'const'.Ben Pfaff2013-05-091-1/+1
| | | | | | | | This function no longer has much need to modify its argument, because the caller can now easily do the modification itself, so this commit makes that change. Signed-off-by: Ben Pfaff <blp@nicira.com>
* ipsec: unset IPSEC_MARK flag from skb_mark after tunnel packet is decapsulatedAnsis Atteka2013-03-181-0/+3
| | | | | | | | | | | | | After tunnel packet is unencapsulated we should unset IPsec flag from skb_mark. Otherwise, IPsec policies would be applied one more time on internal interfaces, if there is one. This is especially necessary after we will introduce global, low-priority IPsec drop policy that will make sure that we never let through marked but unencrypted packets. Signed-off-by: Ansis Atteka <aatteka@nicira.com> Issue: 15074
* tunnel: Userspace implementation of tunnel manipulation.Jesse Gross2013-01-281-0/+47
The kernel tunneling code currently needs to handle a large number of operations when tunnel packets are encapsulated and decapsulated. Some examples of this are: finding the correct tunnel port on receive, TTL and ToS inheritance, ECN handling, etc. All of these can be done on a per-flow basis in userspace now that we have both the inner and outer header information, which allows us to both simplify the kernel and take advantage of userspace's information. Once tunnel packets are redirected into this code, the redundant pieces can be removed from other places. Signed-off-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com>