path: root/net/ipv4/ip_tunnel_core.c
diff options
authorJiri Benc <jbenc@redhat.com>2015-08-18 18:42:09 +0200
committerDavid S. Miller <davem@davemloft.net>2015-08-18 19:11:20 -0700
commit2d79849903e00fb445038ddd8afb2acfbf89eb7f (patch)
treeeb953da9a29b775a36b8f8c036b4330b461b4317 /net/ipv4/ip_tunnel_core.c
parentdf383e6240ef222703648072dafd2a1ae21b0d2a (diff)
lwtunnel: ip tunnel: fix multiple routes with different encap
Currently, two routes going through the same tunnel interface are considered the same even when they are routed to a different host after encapsulation. This causes all routes added after the first one to have incorrect encapsulation parameters. This is nicely visible by doing: # ip r a dev vxlan0 tunnel dst # ip r a dev vxlan0 tunnel dst # ip r [...] tunnel id 0 src dst [...] tunnel id 0 src dst [...] Implement the missing comparison function. Fixes: 3093fbe7ff4bc ("route: Per route IP tunnel metadata via lightweight tunnel") Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_tunnel_core.c')
1 files changed, 7 insertions, 0 deletions
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index fd6319681c50..1c2389d582a6 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -286,10 +286,17 @@ static int ip_tun_encap_nlsize(struct lwtunnel_state *lwtstate)
+ nla_total_size(2); /* LWTUNNEL_IP_FLAGS */
+static int ip_tun_cmp_encap(struct lwtunnel_state *a, struct lwtunnel_state *b)
+ return memcmp(lwt_tun_info(a), lwt_tun_info(b),
+ sizeof(struct ip_tunnel_info));
static const struct lwtunnel_encap_ops ip_tun_lwt_ops = {
.build_state = ip_tun_build_state,
.fill_encap = ip_tun_fill_encap_info,
.get_encap_size = ip_tun_encap_nlsize,
+ .cmp_encap = ip_tun_cmp_encap,
void __init ip_tunnel_core_init(void)

Privacy Policy