diff options
author | wenxu <wenxu@ucloud.cn> | 2018-04-18 11:03:47 +0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-04-18 16:31:15 -0700 |
commit | 8e4e45887ec3eb5f5833fd7b415b63ff47fc9642 (patch) | |
tree | 399e1d3396d15c9a4bebcce73c4c47549f0224fb /ofproto | |
parent | 49b9cad34e8a122e4b2997f0a1a1707f5997737e (diff) | |
download | openvswitch-8e4e45887ec3eb5f5833fd7b415b63ff47fc9642.tar.gz |
ofproto-dpif-xlate: makes OVS native tunneling honor tunnel-specified source addresses
It makes OVS native tunneling honor tunnel-specified source addresses,
in the same way that Linux kernel tunneling honors them.
This patch made valid tun_src specified by flow-action can be used for
tunnel_src of packet. add a "local" property for a route entry and enhance
the priority of local route higher than user route.
Like the kernel space when lookup the route, if there are tun_src specified
by flow-action or port options. Check the tun_src wheather is a local
address, then lookup the route.
Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: frank.zeng <frank.zeng@ucloud.cn>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/ofproto-dpif-sflow.c | 2 | ||||
-rw-r--r-- | ofproto/ofproto-dpif-xlate.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c index fe79a9dbb..bbec30e02 100644 --- a/ofproto/ofproto-dpif-sflow.c +++ b/ofproto/ofproto-dpif-sflow.c @@ -474,7 +474,7 @@ sflow_choose_agent_address(const char *agent_device, */ ip = ss_get_address(&ss); - struct in6_addr src, gw; + struct in6_addr gw, src = in6addr_any; char name[IFNAMSIZ]; if (ovs_router_lookup(0, &ip, name, &src, &gw)) { goto success; diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index c8baba1b7..4f8ffbba0 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -3320,6 +3320,10 @@ native_tunnel_output(struct xlate_ctx *ctx, const struct xport *xport, /* Backup flow & base_flow data. */ memcpy(&old_base_flow, &ctx->base_flow, sizeof old_base_flow); memcpy(&old_flow, &ctx->xin->flow, sizeof old_flow); + + if (flow->tunnel.ip_src) { + in6_addr_set_mapped_ipv4(&s_ip6, flow->tunnel.ip_src); + } err = tnl_route_lookup_flow(ctx, flow, &d_ip6, &s_ip6, &out_dev); if (err) { |