You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.9 KiB

  1. From 28f52edd7f6978fcd97442312122543bae32597d Mon Sep 17 00:00:00 2001
  2. From: Greg Rose <gvrose8192@gmail.com>
  3. Date: Thu, 21 May 2020 14:54:03 -0700
  4. Subject: [PATCH] compat: Backport ipv6_stub change
  5. A patch backported to the Linux stable 4.14 tree and present in the
  6. latest stable 4.14.181 kernel breaks ipv6_stub usage.
  7. The commit is
  8. 8ab8786f78c3 ("net ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup").
  9. Create the compat layer define to check for it and fixup usage in vxlan
  10. and geneve modules.
  11. Passes Travis here:
  12. https://travis-ci.org/github/gvrose8192/ovs-experimental/builds/689798733
  13. Signed-off-by: Greg Rose <gvrose8192@gmail.com>
  14. Signed-off-by: William Tu <u9012063@gmail.com>
  15. ---
  16. acinclude.m4 | 2 ++
  17. datapath/linux/compat/geneve.c | 11 ++++++++++-
  18. datapath/linux/compat/vxlan.c | 18 +++++++++++++++++-
  19. 3 files changed, 29 insertions(+), 2 deletions(-)
  20. diff --git a/acinclude.m4 b/acinclude.m4
  21. index ebe8b43b5..c47a77ed6 100644
  22. --- a/acinclude.m4
  23. +++ b/acinclude.m4
  24. @@ -567,6 +567,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
  25. OVS_GREP_IFELSE([$KSRC/include/net/ip6_fib.h], [rt6_get_cookie],
  26. [OVS_DEFINE([HAVE_RT6_GET_COOKIE])])
  27. + OVS_FIND_FIELD_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_stub],
  28. + [dst_entry])
  29. OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup.*net],
  30. [OVS_DEFINE([HAVE_IPV6_DST_LOOKUP_NET])])
  31. OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup_flow.*net],
  32. diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c
  33. index 4bdab6836..bf995aa83 100644
  34. --- a/datapath/linux/compat/geneve.c
  35. +++ b/datapath/linux/compat/geneve.c
  36. @@ -962,7 +962,16 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
  37. return dst;
  38. }
  39. -#if defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET)
  40. +#if defined(HAVE_IPV6_STUB_WITH_DST_ENTRY) && defined(HAVE_IPV6_DST_LOOKUP_FLOW)
  41. +#ifdef HAVE_IPV6_DST_LOOKUP_FLOW_NET
  42. + dst = ipv6_stub->ipv6_dst_lookup_flow(geneve->net, gs6->sock->sk, fl6,
  43. + NULL);
  44. +#else
  45. + dst = ipv6_stub->ipv6_dst_lookup_flow(gs6->sock->sk, fl6,
  46. + NULL);
  47. +#endif
  48. + if (IS_ERR(dst)) {
  49. +#elif defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET)
  50. if (ipv6_stub->ipv6_dst_lookup_flow(geneve->net, gs6->sock->sk, &dst,
  51. fl6)) {
  52. #elif defined(HAVE_IPV6_DST_LOOKUP_FLOW)
  53. diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
  54. index ff10ae6f4..05ccfb928 100644
  55. --- a/datapath/linux/compat/vxlan.c
  56. +++ b/datapath/linux/compat/vxlan.c
  57. @@ -967,7 +967,10 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
  58. bool use_cache = (dst_cache && ip_tunnel_dst_cache_usable(skb, info));
  59. struct dst_entry *ndst;
  60. struct flowi6 fl6;
  61. +#if !defined(HAVE_IPV6_STUB_WITH_DST_ENTRY) || \
  62. + !defined(HAVE_IPV6_DST_LOOKUP_FLOW)
  63. int err;
  64. +#endif
  65. if (!sock6)
  66. return ERR_PTR(-EIO);
  67. @@ -990,7 +993,15 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
  68. fl6.fl6_dport = dport;
  69. fl6.fl6_sport = sport;
  70. -#if defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET)
  71. +#if defined(HAVE_IPV6_STUB_WITH_DST_ENTRY) && defined(HAVE_IPV6_DST_LOOKUP_FLOW)
  72. +#ifdef HAVE_IPV6_DST_LOOKUP_FLOW_NET
  73. + ndst = ipv6_stub->ipv6_dst_lookup_flow(vxlan->net, sock6->sock->sk,
  74. + &fl6, NULL);
  75. +#else
  76. + ndst = ipv6_stub->ipv6_dst_lookup_flow(sock6->sock->sk, &fl6, NULL);
  77. +#endif
  78. + if (unlikely(IS_ERR(ndst))) {
  79. +#elif defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET)
  80. err = ipv6_stub->ipv6_dst_lookup_flow(vxlan->net, sock6->sock->sk,
  81. &ndst, &fl6);
  82. #elif defined(HAVE_IPV6_DST_LOOKUP_FLOW)
  83. @@ -1004,8 +1015,13 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
  84. #else
  85. err = ip6_dst_lookup(vxlan->vn6_sock->sock->sk, &ndst, &fl6);
  86. #endif
  87. +#if defined(HAVE_IPV6_STUB_WITH_DST_ENTRY) && defined(HAVE_IPV6_DST_LOOKUP_FLOW)
  88. + return ERR_PTR(-ENETUNREACH);
  89. + }
  90. +#else
  91. if (err < 0)
  92. return ERR_PTR(err);
  93. +#endif
  94. *saddr = fl6.saddr;
  95. if (use_cache)