summaryrefslogtreecommitdiff
path: root/tests/tunnel.at
Commit message (Collapse)AuthorAgeFilesLines
* userspace: Add SRv6 tunnel support.Nobuhiro MIKI2023-03-291-0/+56
| | | | | | | | | | | | | | | | | SRv6 (Segment Routing IPv6) tunnel vport is responsible for encapsulation and decapsulation the inner packets with IPv6 header and an extended header called SRH (Segment Routing Header). See spec in: https://datatracker.ietf.org/doc/html/rfc8754 This patch implements SRv6 tunneling in userspace datapath. It uses `remote_ip` and `local_ip` options as with existing tunnel protocols. It also adds a dedicated `srv6_segs` option to define a sequence of routers called segment list. Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* odp-util: Make odp_flow_key_from_flow__ nlattr order the same as the kernel.Eelco Chaudron2023-02-091-1/+1
| | | | | | | | | | | | | | Make the order of the Netlink attributes for odp_flow_key_from_flow__() the same as the kernel will return them. This will make sure the attributes displayed in the dpctl/dump-flows output appear in the same order for all datapath. Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Roi Dayan <roid@nvidia.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Tested-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* xenserver: Remove xenserver.Greg Rose2022-08-151-0/+18
| | | | | | | | | | | | | Remove the current xenserver implementation - it is obsolete and since 3.0 we do not support kernel module builds [1]. 1. https://mail.openvswitch.org/pipermail/ovs-dev/2022-July/395789.html [i.maximets] Can be added back if people willing to maintain it will be found. Signed-off-by: Greg Rose <gvrose8192@gmail.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* odp-util: Fix output for tc to be equal to kernel.Eelco Chaudron2022-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | When the same flow is programmed in the kernel and tc, they look different due to the way they are translated. They take the userspace approach by always including the packet type attribute. To make the outputs the same, show the ethernet header when the packet type is wildcarded, and not printed. So without the fix the kernel would show (ovs-appctl dpctl/dump-flows): in_port(3),eth(),eth_type(0x0800),ipv4(frag=no), ..., actions:output Where as TC would show: in_port(3),eth_type(0x0800),ipv4(frag=no), ..., actions:output Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Roi Dayan <roid@nvidia.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* odp-util: Fix overflow of nested netlink attributes.Ilya Maximets2020-11-161-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Length of nested attributes must be checked before storing to the header. If current length exceeds the maximum value parsing should fail, otherwise the length value will be truncated leading to corrupted netlink message and out-of-bound memory accesses: ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6310002cc838 at pc 0x000000575470 bp 0x7ffc6c322d60 sp 0x7ffc6c322d58 READ of size 1 at 0x6310002cc838 thread T0 SCARINESS: 12 (1-byte-read-heap-buffer-overflow) #0 0x57546f in format_generic_odp_key lib/odp-util.c:2738:39 #1 0x559e70 in check_attr_len lib/odp-util.c:3572:13 #2 0x56581a in format_odp_key_attr lib/odp-util.c:4392:9 #3 0x5563b9 in format_odp_action lib/odp-util.c:1192:9 #4 0x555d75 in format_odp_actions lib/odp-util.c:1279:13 ... Fix that by checking the length of nested netlink attributes before updating 'nla_len' inside the header. Additionally introduced assertion inside nl_msg_end_nested() to catch this kind of issues before actual overflow happened. Credit to OSS-Fuzz. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20003 Fixes: 65da723b40a5 ("odp-util: Format tunnel attributes directly from netlink.") Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* netdev-offload-tc: Revert tunnel src/dst port masks handlingRoi Dayan2020-06-191-2/+2
| | | | | | | | | | | | | | | | The cited commit intended to add tc support for masking tunnel src/dst ips and ports. It's not possible to do tunnel ports masking with openflow rules and the default mask for tunnel ports set to 0 in tnl_wc_init(), unlike tunnel ports default mask which is full mask. So instead of never passing tunnel ports to tc, revert the changes to tunnel ports to always pass the tunnel port. In sw classification is done by the kernel, but for hw we must match the tunnel dst port. Fixes: 5f568d049130 ("netdev-offload-tc: Allow to match the IP and port mask of tunnel") Signed-off-by: Roi Dayan <roid@mellanox.com> Reviewed-by: Eli Britstein <elibr@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* netdev-offload-tc: Allow to match the IP and port mask of tunnelTonghao Zhang2020-06-031-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows users to offload the TC flower rules with tunnel mask. This patch allows masked match of the following, where previously supported an exact match was supported: * Remote (dst) tunnel endpoint address * Local (src) tunnel endpoint address * Remote (dst) tunnel endpoint UDP port And also allows masked match of the following, where previously no match was supported: * Local (src) tunnel endpoint UDP port In some case, mask is useful as wildcards. For example, DDOS, in that case, we don’t want to allow specified hosts IPs or only source Ports to access the targeted host. For example: $ ovs-appctl dpctl/add-flow "tunnel(dst=2.2.2.100,src=2.2.2.0/255.255.255.0,tp_dst=4789),\ recirc_id(0),in_port(3),eth(),eth_type(0x0800),ipv4()" "" $ tc filter show dev vxlan_sys_4789 ingress ... eth_type ipv4 enc_dst_ip 2.2.2.100 enc_src_ip 2.2.2.0/24 enc_dst_port 4789 enc_ttl 64 in_hw in_hw_count 2 action order 1: gact action drop ... Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com> Acked-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* ofp-actions: Add delete field actionYi-Hung Wei2020-04-291-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new OpenFlow action, delete field, to delete a field in packets. Currently, only the tun_metadata fields are supported. One use case to add this action is to support multiple versions of geneve tunnel metadatas to be exchanged among different versions of networks. For example, we may introduce tun_metadata2 to replace old tun_metadata1, but still want to provide backward compatibility to the older release. In this case, in the new OpenFlow pipeline, we would like to support the case to receive a packet with tun_metadata1, do some processing. And if the packet is going to a switch in the newer release, we would like to delete the value in tun_metadata1 and set a value into tun_metadata2. Currently, ovs does not provide an action to remove a value in tun_metadata if the value is present. This patch fulfills the gap by adding the delete_field action. For example, the OpenFlow syntax to delete tun_metadata1 is: actions=delete_field:tun_metadata1 Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: William Tu <u9012063@gmail.com> Acked-by: William Tu <u9012063@gmail.com>
* userspace: Add GTP-U support.William Tu2020-03-251-0/+76
| | | | | | | | | | | | | | | | | | | | | | | GTP, GPRS Tunneling Protocol, is a group of IP-based communications protocols used to carry general packet radio service (GPRS) within GSM, UMTS and LTE networks. GTP protocol has two parts: Signalling (GTP-Control, GTP-C) and User data (GTP-User, GTP-U). GTP-C is used for setting up GTP-U protocol, which is an IP-in-UDP tunneling protocol. Usually GTP is used in connecting between base station for radio, Serving Gateway (S-GW), and PDN Gateway (P-GW). This patch implements GTP-U protocol for userspace datapath, supporting only required header fields and G-PDU message type. See spec in: https://tools.ietf.org/html/draft-hmm-dmm-5g-uplane-analysis-00 Tested-at: https://travis-ci.org/github/williamtu/ovs-travis/builds/666518784 Signed-off-by: Feng Yang <yangfengee04@gmail.com> Co-authored-by: Feng Yang <yangfengee04@gmail.com> Signed-off-by: Yi Yang <yangyi01@inspur.com> Co-authored-by: Yi Yang <yangyi01@inspur.com> Signed-off-by: William Tu <u9012063@gmail.com> Acked-by: Ben Pfaff <blp@ovn.org>
* userspace: Improved packet drop statistics.Anju Thomas2020-01-071-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently OVS maintains explicit packet drop/error counters only on port level. Packets that are dropped as part of normal OpenFlow processing are counted in flow stats of “drop” flows or as table misses in table stats. These can only be interpreted by controllers that know the semantics of the configured OpenFlow pipeline. Without that knowledge, it is impossible for an OVS user to obtain e.g. the total number of packets dropped due to OpenFlow rules. Furthermore, there are numerous other reasons for which packets can be dropped by OVS slow path that are not related to the OpenFlow pipeline. The generated datapath flow entries include a drop action to avoid further expensive upcalls to the slow path, but subsequent packets dropped by the datapath are not accounted anywhere. Finally, the datapath itself drops packets in certain error situations. Also, these drops are today not accounted for.This makes it difficult for OVS users to monitor packet drop in an OVS instance and to alert a management system in case of a unexpected increase of such drops. Also OVS trouble-shooters face difficulties in analysing packet drops. With this patch we implement following changes to address the issues mentioned above. 1. Identify and account all the silent packet drop scenarios 2. Display these drops in ovs-appctl coverage/show Co-authored-by: Rohith Basavaraja <rohith.basavaraja@gmail.com> Co-authored-by: Keshav Gupta <keshugupta1@gmail.com> Signed-off-by: Anju Thomas <anju.thomas@ericsson.com> Signed-off-by: Rohith Basavaraja <rohith.basavaraja@gmail.com> Signed-off-by: Keshav Gupta <keshugupta1@gmail.com> Acked-by: Eelco Chaudron <echaudro@redhat.com Acked-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* tnl-neigh: Use outgoing ofproto version.Flavio Leitner2019-08-281-0/+62
| | | | | | | | | | | | | | | | | | | | | | | When a packet needs to be encapsulated in userspace, the endpoint address needs to be resolved to fill in the headers. If it is not, then currently OvS sends either a Neighbor Solicitation (IPv6) or an ARP Query (IPv4) to resolve it. The problem is that the NS/ARP packet will go through the flow rules in the new bridge, but inheriting the ofproto table version from the original packet to be encapsulated. When those versions don't match, the result is unexpected because no flow rules might be visible, which would cause the default table rule to be used to drop the packet. Or only part of the flow rules would be visible and so on. Since the NS/ARP packet is created by OvS and will be injected in the outgoing bridge, use the corresponding ofproto version instead. Reviewed-by: David Marchand <david.marchand@redhat.com> Acked-By: Vasu Dasari <vdasari@gmail.com> Signed-off-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tnl-neigh-cache: Purge learnt neighbors when port/bridge is deletedVasu Dasari2019-07-221-0/+47
| | | | | | | | | | | | | | | | | Say an ARP entry is learnt on a OVS port and when such a port is deleted, learnt entry should be removed from the port. It would have be aged out after ARP ageout time. This code will clean up immediately. Added test case(tunnel - neighbor entry add and deletion) in tunnel.at, to verify neighbors are added and removed on deletion of a ports and bridges. Discussion for this addition is at: https://mail.openvswitch.org/pipermail/ovs-discuss/2019-June/048754.html Signed-off-by: Vasu Dasari <vdasari@gmail.com> Reviewed-by: Flavio Fernandes <flavio@flaviof.com> Reviewed-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* odp-util: Improve log messages and error reporting for Netlink parsing.Ben Pfaff2019-02-251-2/+2
| | | | | | | | As a side effect, this also reduces a lot of log messages' severities from ERR to WARN. They just didn't seem like messages that in general reported anything that would prevent functioning. Signed-off-by: Ben Pfaff <blp@ovn.org>
* netdev-vport: reject concomitant incompatible tunnelsEelco Chaudron2018-09-071-0/+29
| | | | | | | | | | | | | | This patch will make sure VXLAN tunnels with and without the group based policy (GBP) option enabled can not coexist on the same destination UDP port. In theory, VXLAN tunnel with and without GBP enables can be multiplexed on the same UDP port as long as different VNI's are used. However currently OVS does not support this, hence this patch to check for this condition. Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tunnel, tests: Sort flow output in ERSPAN v1/v2 metadataAlin Gabriel Serdean2018-08-221-2/+1
| | | | | | | | | | | | | Sort the flows by input port in the test: tunnel.at:512: testing tunnel - ERSPAN v1/v2 metadata ... This tests fails on Windows due to the hash function sensitivity described in: https://mail.openvswitch.org/pipermail/ovs-dev/2018-August/350685.html Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org> Acked-by: William Tu <u9012063@gmail.com>
* tests: Fix hash function dependencies in "tunnel - ERSPAN v1/v2 metadata".Ben Pfaff2018-08-211-22/+31
| | | | | | | | | | | | | | | | | | | This test only worked if each OpenFlow port was assigned a particular datapath port number: p1 to port 3, p2 to port 2, p3 and p4 to port 1. This happened consistently on little-endian architectures because of the use of a particular hash function, but on big-endian architectures it failed because the hash function was different. This commit fixes the problem by adding the non-dummy ports separately. (Dummy ports try to take the datapath port number corresponding to their name, when it is available.) This does result in swapping a couple of datapaths port numbers, so that p1 has port 1, p2 has port 2, and the erspan ports have port 3, hence the size of the patch. Reported-by: James Page <james.page@canonical.com> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-August/351382.html Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: William Tu <u9012063@gmail.com>
* treewide: Convert leading tabs to spaces.Ben Pfaff2018-06-111-13/+13
| | | | | | | | | It's always been OVS coding style to use spaces rather than tabs for indentation, but some tabs have snuck in over time. This commit converts them to spaces. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ofproto-dpif: Remove tabs from output.Ben Pfaff2018-06-111-54/+54
| | | | | | | | | | | OVS uses spaces for indentation in source code and it makes sense for it to also use spaces for indentation in output. Spaces also consume less horizontal space in output, which often makes it easier to read. This commit transitions one part of output from tabs to spaces and updates appropriate parts of the tests to match. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* erspan: Add flow-based erspan optionsGreg Rose2018-05-211-9/+59
| | | | | | | | | | The patch add supports for flow-based erspan options. The erspan_ver, erspan_idx, erspan_dir, and erspan_hwid can be set as "flow" so that its value is set by the openflow rule, instead of statically configured at port creation time. Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* erspan: add kernel datapath supportWilliam Tu2018-05-211-0/+93
| | | | | | | pass check, check-kernel (4.16-rc4), check-system-userspace Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* userspace: add erspan tunnel support.William Tu2018-05-211-0/+12
| | | | | | | | | | | | ERSPAN is a tunneling protocol based on GRE tunnel. The patch add erspan tunnel support for ovs-vswitchd with userspace datapath. Configuring erspan tunnel is similar to gre tunnel, but with additional erspan's parameters. Matching a flow on erspan's metadata is also supported, see ovs-fields for more details. Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Greg Rose <gvrose8192@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tunnel: make tun_key_to_attr aware of tunnel type.William Tu2018-05-141-0/+18
| | | | | | | | | | | | | | | | | | | | | | | 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 tunnel flags set/clear.William Tu2018-01-101-3/+34
| | | | | | | | | | | | | | | | Existing code only set these tunnel flags (df, csum, and key) when the flag is set in the output tunnel port, but did not clear when the flag is unset. The patch fixes it by setting and clearing it accordingly. Two existing testcases need to fix: 'tunnel - Geneve option present' has no key set up, so we should match 'flags(df)' instead of 'flags(df|key)'. The second case 'tunnel - concomitant IPv6 and IPv4 tunnels' follows the same pattern. One additional test case 'tunnel - Mix Geneve/GRE options' is added. Signed-off-by: William Tu <u9012063@gmail.com> VMWare-BZ: #2019012 Signed-off-by: Ben Pfaff <blp@ovn.org>
* Adding nsh.at for NSH unit testsJan Scheurich2017-08-071-9/+9
| | | | | | | | | | First basic NSH test case implemented and working. Unconditionally show matched packet_type in megaflows, even when matching on eth. Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* userspace: Add OXM field MFF_PACKET_TYPEJan Scheurich2017-06-271-9/+9
| | | | | | | | | | | | | | | | | | | | | | | Allow packet type namespace OFPHTN_ETHERTYPE as alternative pre-requisite for matching L3 protocols (MPLS, IP, IPv6, ARP etc). Change the meta-flow definition of packet_type field to use the new custom format MFS_PACKET_TYPE representing "(NS,NS_TYPE)". Parsing routine for MFS_PACKET_TYPE added to meta-flow.c. Formatting routine for field packet_type extracted from match_format() and moved to flow.c to be used from meta-flow.c for formatting MFS_PACKET_TYPE. Updated the ovs-fields man page source meta-flow.xml with documentation for packet-type-aware bridges and added documentation for field packet_type. Added packet_type to the matching properties in tests/ofproto.at. If dl_type is unwildcarded due to later packet modification, make sure it is cleared again if the original packet_type was not PT_ETH. Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* userspace: Switching of L3 packets in L2 pipelineJan Scheurich2017-06-021-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ports have a new layer3 attribute if they send/receive L3 packets. The packet_type included in structs dp_packet and flow is considered in ofproto-dpif. The classical L2 match fields (dl_src, dl_dst, dl_type, and vlan_tci, vlan_vid, vlan_pcp) now have Ethernet as pre-requisite. A dummy ethernet header is pushed to L3 packets received from L3 ports before the the pipeline processing starts. The ethernet header is popped before sending a packet to a L3 port. For datapath ports that can receive L2 or L3 packets, the packet_type becomes part of the flow key for datapath flows and is handled appropriately in dpif-netdev. In the 'else' branch in flow_put_on_pmd() function, the additional check flow_equal(&match.flow, &netdev_flow->flow) was removed, as a) the dpcls lookup is sufficient to uniquely identify a flow and b) it caused false negatives because the flow in netdev->flow may not properly masked. In dpif_netdev_flow_put() we now use the same method for constructing the netdev_flow_key as the one used when adding the flow to the dplcs to make sure these always match. The function netdev_flow_key_from_flow() used so far was not only inefficient but sometimes caused mismatches and subsequent flow update failures. The kernel datapath does not support the packet_type match field. Instead it encodes the packet type implictly by the presence or absence of the Ethernet attribute in the flow key and mask. This patch filters the PACKET_TYPE attribute out of netlink flow key and mask to be sent to the kernel datapath. Signed-off-by: Lorand Jakab <lojakab@cisco.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: Yi Yang <yi.y.yang@intel.com> Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Co-authored-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto: Add ref counting for variable length mf_fields.Yi-Hung Wei2017-03-151-1/+75
| | | | | | | | | | | | | | | | | | | | | | | | Currently, a controller may potentially trigger a segmentation fault if it accidentally removes a TLV mapping that is still used by an active flow. To resolve this issue, in this patch, we maintain reference counting for each dynamically allocated variable length mf_fields, so that vswitchd can use this information to properly remove a TLV mapping, and to return an error if the controller tries to remove a TLV mapping that is still used by any active flow. To keep track of the usage of tun_metadata for each flow, two 'uint64_t' bitmaps are introduce for the flow match and flow action respectively. We use 'uint64_t' as a bitmap since the 64 geneve TLV tunnel metadata are the only available variable length mf_fields for now. We shall adopt general bitmap when more variable length mf_fields are introduced. The bitmaps are configured during the flow decoding process, and vswitchd use these bitmaps to increase or decrease the ref counting when the flow is created or deleted. VMWare-BZ: #1768370 Fixes: 04f48a68c428 ("ofp-actions: Fix variable length meta-flow OXMs.") Suggested-by: Jarno Rajahalme <jarno@ovn.org> Suggested-by: Joe Stringer <joe@ovn.org> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Joe Stringer <joe@ovn.org>
* tunnel: set udp dst-port in tunnel metadataPravin B Shelar2016-12-051-4/+4
| | | | | | | | | | | VxLan device expect valid tp-dst in tunnel metadata. Following patch sets consistent tp-dst with respect to the egress tunnel port. Reported-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com> Tested-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com> Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* openvswitch: Allow external IPsec tunnel management.Pravin B Shelar2016-09-271-78/+9
| | | | | | | | | | | | | | | | | | OVS GRE IPsec tunnel support has multiple issues, Therefore it was deprecated in OVS 2.6. Following patch removes support for GRE IPsec and allows external IPsec tunnel management for any type of tunnel not just GRE. e.g. user can encrypt Geneve or VxLan traffic. It can be done by using openflow pipeline to set skb-mark and using IPsec keying daemons to implement IPsec tunnels. This packet can be matched for the skb-mark to encrypt selective tunnel traffic. VMware-BZ: 1710701 Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Ansis Atteka <aatteka@ovn.org>
* tunnel tests: Skip ipsec_gre tests on WindowsPaul Boca2016-08-261-0/+3
| | | | | | | The ipsec feature is not implemented on windows. Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* netdev-dummy: Add dummy-internal class.Daniele Di Proietto2016-08-151-14/+14
| | | | | | | | | | | | | | | | | | "internal" netdevs are treated specially in OVS (e.g. for MTU), but the dummy datapath remaps both "system" and "internal" devices to the same "dummy" netdev class, so there's no way to discern those in tests. This commit adds a new "dummy-internal" netdev type, which will be used by the dummy datapath for internal ports, so that other parts of the code can understand which ports are internal just by looking at the netdev object. The alternative solution, using the original interface type ("internal") instead of the translated netdev type ("dummy"), is harder to implement, because in so many places only the netdev object is available. Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Acked-by: Ben Pfaff <blp@ovn.org>
* tunneling: get skb marking to work properly with tunnelsAnsis Atteka2016-07-211-0/+120
| | | | | | | | | | | | | | | There are two issues that this patch fixes: 1. it was impossible to set skb mark at all through NXM_NX_PKT_MARK register for tunnel packets; AND 2. ipsec_xxx tunnels would not be marked with the default IPsec mark (broken by d23df9a87 "lib/odp: Use masked set actions."). This patch also adds anti-regression tests to prevent such breakages in the future. Signed-off-by: Ansis Atteka <aatteka@ovn.org> VMware-BZ: #1653178 Acked-by: Jarno Rajahalme <jarno@ovn.org>
* tests: Remove redundant ofport_request.William Tu2016-05-171-1/+1
| | | | | Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tunneling: Fix for concomitant IPv4 and IPv6 tunnelsThadeu Lima de Souza Cascardo2016-04-211-0/+27
| | | | | | | | | | | When using an IPv6 tunnel on the same bridge as an IPv4 tunnel, the flow received from the IPv6 tunnel would have an IPv4 address added to it, causing problems when trying to put or execute the action on Linux datapath. Clearing the IPv6 address when we have a valid IPv4 address fixes this problem. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* tests: Change ADD_OF_PORTS from macro to shell function.Ben Pfaff2016-01-281-1/+1
| | | | | | | | | This reduces the size of the generated testsuite and makes it possible to pass arguments that vary at runtime instead of at the time of translation from .at to shell script. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofproto: Wildcard TTL on IP tunnelsHaggai Eran2016-01-191-9/+9
| | | | | | | | | | | | | There is no need to set the mask on the outer header IP TTL [1]. The only requirement is that the TTL will be non-zero. Clear the mask in tnl_wc_init(). [1] OVS VXLAN decap rule has full match on TTL for the outer headers? http://www.spinics.net/lists/netdev/msg351961.html Cc: Jesse Gross <jesse@kernel.org> Cc: Joe Stringer <joe@ovn.org> Signed-off-by: Haggai Eran <haggaie@mellanox.com> Signed-off-by: Jesse Gross <jesse@kernel.org>
* geneve-map-rename: rename geneve-map to tlv-map.Mengke Liu2015-12-151-11/+11
| | | | | | | | | | | | | | | | | | This patch renames the command name related with geneve-map to a more generic name as following: add-geneve-map -> add-tlv-map del-geneve-map -> del-tlv-map dump-geneve-map -> dump-tlv-map It also renames the Geneve_table to tlv_table. By doing this renaming, the NSH variable context header (the same TLV format as Geneve) or other protocol can reuse the field tun_metadata<N> in the future. Signed-off-by: Mengke Liu <mengke.liu@intel.com> Signed-off-by: Ricky Li <ricky.li@intel.com> Signed-off-by: Jesse Gross <jesse@kernel.org>
* tun-metadata: Provide error messages during auto-allocation.Jesse Gross2015-09-091-0/+8
| | | | | | | | | | | | In cases where we don't have a map of tunnel metadata options (such as with ovs-ofctl) we dynamically allocate them as part of the match. However, dynamic allocation brings the possibility of errors such as duplicate entries or running out of space. Up until now, anything that would cause an error was silently ignored. Since that is not very user friendly, this adds a mechanism for reporting these types of errors. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* tunnel: Support matching on the presence of Geneve options.Jesse Gross2015-08-281-1/+41
| | | | | | | | | | | | | | | | | | | | | Sometimes it is useful to match only on whether a Geneve option is present even if the specific value is unimportant. A special case of this is zero length options where there is no value at all and the only information conveyed is whether the option was included in the packet. This operation was partially supported before but it was not consistent - in particular, options were never serialized through NXM/OXM unless they had a non-zero mask. Furthermore, zero length options were rejected altogether when they were installed through the Geneve map OpenFlow command. This adds support for these types of matches by making any NXM/OXM for tunnel metadata force a match on that field. In the case of a zero length option, both the value and mask of the NXM are ignored. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* tunneling: Remove gre64 tunnel support.Pravin B Shelar2015-08-201-2/+2
| | | | | | | | | | GRE64 was introduced to extend gre key from 32-bit to 64-bit using gre-key and sequence number field. But GRE64 is not standard protocol. There are not many users of this protocol. Therefore we have decided to remove it. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* tunneling: Allow matching and setting tunnel 'OAM' flag.Jesse Gross2015-07-151-7/+7
| | | | | | | | | | | | | | | | | Several encapsulation formats have the concept of an 'OAM' bit which typically is used with networking tracing tools to distinguish test packets from real traffic. OVS already internally has support for this, however, it doesn't do anything with it and it also isn't exposed for controllers to use. This enables support through OpenFlow. There are several other tunnel flags which are consumed internally by OVS. It's not clear that it makes sense to use them externally so this does not expose those flags - although it should be easy to do so if necessary in the future. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* flow: Factor out flag parsing and formatting routines.Jesse Gross2015-07-151-24/+24
| | | | | | | | | There are several implementations of functions that parse/format flags and their binary representation. This factors them out into common routines. In addition to reducing code, it also makes things more consistent across different parts of OVS. Signed-off-by: Jesse Gross <jesse@nicira.com>
* tunnel: Geneve TLV handling support for OpenFlow.Jesse Gross2015-06-251-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current support for Geneve in OVS is exactly equivalent to VXLAN: it is possible to set and match on the VNI but not on any options contained in the header. This patch enables the use of options. The goal for Geneve support is not to add support for any particular option but to allow end users or controllers to specify what they would like to match. That is, the full range of Geneve's capabilities should be exposed without modifying the code (the one exception being options that require per-packet computation in the fast path). The main issue with supporting Geneve options is how to integrate the fields into the existing OpenFlow pipeline. All existing operations are referred to by their NXM/OXM field name - matches, action generation, arithmetic operations (i.e. tranfer to a register). However, the Geneve option space is exactly the same as the OXM space, so a direct mapping is not feasible. Instead, we create a pool of 64 NXMs that are then dynamically mapped on Geneve option TLVs using OpenFlow. Once mapped, these fields become first-class citizens in the OpenFlow pipeline. An example of how to use Geneve options: ovs-ofctl add-geneve-map br0 {class=0xffff,type=0,len=4}->tun_metadata0 ovs-ofctl add-flow br0 in_port=LOCAL,actions=set_field:0xffffffff->tun_metadata0,1 This will add a 4 bytes option (filled will all 1's) to all packets coming from the LOCAL port and then send then out to port 1. A limitation of this patch is that although the option table is specified for a particular switch over OpenFlow, it is currently global to all switches. This will be addressed in a future patch. Based on work originally done by Madhu Challa. Ben Pfaff also significantly improved the comments. Signed-off-by: Madhu Challa <challa@noironetworks.com> Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* odp-util: Format tunnel attributes directly from netlink.Jesse Gross2015-05-281-41/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | When we format most netlink attributes we do so from the netlink itself, iterating through each one and printing the contents out. However, for tunnels we don't do this - we first convert to the OVS userspace representation and then format that. While convienient, this isn't really ideal as the primary use of printing netlink attributes is debugging and this conversion is lossy, particularly when the attributes aren't as expected. The result is that unexpected keys are silently ignored and the level of detail on errors is minimal. This situation becomes worse when we introduce support for Geneve. The conversion to userspace format requires additional information which we might not have (ovs-dpctl) and is more complicated than other attributes so it is likely to be confusing in the event of a bug. The information from the kernel is self-describing so it's much more reliable to display it directly from the netlink. This converts tunnel attribute formatting to be more similar to other types of attributes. As a nice bonus the output becomes more compact because it doesn't print zeroed out attributes in cases where they aren't relevant and therefore not present. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* ofproto: Add NXM_NX_TUN_GBP_ID and NXM_NX_TUN_GBP_FLAGSMadhu Challa2015-02-141-41/+41
| | | | | | | | | | | | | | | | | | | Introduces two new NXMs to represent VXLAN-GBP [0] fields. actions=load:0x10->NXM_NX_TUN_GBP_ID[],NORMAL tun_gbp_id=0x10,actions=drop This enables existing VXLAN tunnels to carry security label information such as a SELinux context to other network peers. The values are carried to/from the datapath using the attribute OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS. [0] https://tools.ietf.org/html/draft-smith-vxlan-group-policy-00 Signed-off-by: Madhu Challa <challa@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
* openvswitch: Userspace tunneling.Pravin B Shelar2014-11-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ofproto-dpif-xlate: Wildcard skb_priority if QoS is disabledDaniele Di Proietto2014-09-171-4/+4
| | | | | | | | This optimization should give a small performance benefit to the userspace datapath. Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* lib/odp: Use masked set actions.Jarno Rajahalme2014-09-091-4/+4
| | | | Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib/odp-util: Skip ignored fields when parsing and formatting.Jarno Rajahalme2014-09-091-34/+34
| | | | | | | | | | | | | When a whole field of a key value is ignored, skip it when formatting the key, and allow it to be left out when parsing the key from a string. However, when the 'verbose' formatting is requested those are still formatted, as it may help in debugging. Now the named key fields can also be given in arbitrary order. Duplicate field values are not checked for, so the last one will remain in effect. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib/odp-util: Add tunnel tp_src, tp_dst parsing and formatting.Jarno Rajahalme2014-09-081-41/+41
| | | | | | | tp_src and tp_dst fields were recently added to struct flow_tnl, but parsing and printing was missing. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>