2015-06-05 08:13:28 -07:00
|
|
|
/* Copyright (c) 2013, 2015 Nicira, Inc.
|
2012-09-19 18:37:07 -07:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at:
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TUNNEL_H
|
|
|
|
#define TUNNEL_H 1
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "flow.h"
|
|
|
|
|
|
|
|
/* Tunnel port emulation layer.
|
|
|
|
*
|
|
|
|
* These functions emulate tunnel virtual ports based on the outer
|
|
|
|
* header information from the kernel. */
|
|
|
|
|
2014-11-11 11:53:47 -08:00
|
|
|
struct ovs_action_push_tnl;
|
2013-06-18 14:40:30 -07:00
|
|
|
struct ofport_dpif;
|
|
|
|
struct netdev;
|
2016-05-23 20:27:14 -07:00
|
|
|
struct netdev_tnl_build_header_params;
|
2012-09-19 18:37:07 -07:00
|
|
|
|
2014-11-10 12:45:57 -08:00
|
|
|
void ofproto_tunnel_init(void);
|
2013-06-18 14:40:30 -07:00
|
|
|
bool tnl_port_reconfigure(const struct ofport_dpif *, const struct netdev *,
|
2017-11-01 15:20:47 +00:00
|
|
|
odp_port_t new_odp_port, odp_port_t old_odp_port,
|
|
|
|
bool native_tnl, const char name[]);
|
2012-09-19 18:37:07 -07:00
|
|
|
|
2015-06-05 08:13:28 -07:00
|
|
|
int tnl_port_add(const struct ofport_dpif *, const struct netdev *,
|
2017-11-01 15:20:47 +00:00
|
|
|
odp_port_t, bool native_tnl, const char name[]);
|
|
|
|
void tnl_port_del(const struct ofport_dpif *, odp_port_t);
|
2012-09-19 18:37:07 -07:00
|
|
|
|
2013-06-18 14:40:30 -07:00
|
|
|
const struct ofport_dpif *tnl_port_receive(const struct flow *);
|
2015-07-29 14:12:26 -07:00
|
|
|
void tnl_wc_init(struct flow *, struct flow_wildcards *);
|
|
|
|
bool tnl_process_ecn(struct flow *);
|
2013-06-18 15:24:33 -07:00
|
|
|
odp_port_t tnl_port_send(const struct ofport_dpif *, struct flow *,
|
2013-06-19 16:58:44 -07:00
|
|
|
struct flow_wildcards *wc);
|
tunnel: make tun_key_to_attr aware of tunnel type.
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>
2018-05-14 11:46:47 -07:00
|
|
|
const char *tnl_port_get_type(const struct ofport_dpif *tnl_port);
|
2012-09-19 18:37:07 -07:00
|
|
|
|
|
|
|
/* Returns true if 'flow' should be submitted to tnl_port_receive(). */
|
|
|
|
static inline bool
|
|
|
|
tnl_port_should_receive(const struct flow *flow)
|
|
|
|
{
|
2015-11-25 11:31:11 -02:00
|
|
|
return flow_tnl_dst_is_set(&flow->tunnel);
|
2012-09-19 18:37:07 -07:00
|
|
|
}
|
|
|
|
|
2016-05-23 20:27:14 -07:00
|
|
|
int
|
|
|
|
tnl_port_build_header(const struct ofport_dpif *ofport,
|
|
|
|
struct ovs_action_push_tnl *data,
|
|
|
|
const struct netdev_tnl_build_header_params *params);
|
2014-11-11 11:53:47 -08:00
|
|
|
|
2012-09-19 18:37:07 -07:00
|
|
|
#endif /* tunnel.h */
|