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.

98 lines
3.7 KiB

  1. From ab78cc673ebf8e13558fdde459d74538e8cf0760 Mon Sep 17 00:00:00 2001
  2. From: Yi-Hung Wei <yihung.wei@gmail.com>
  3. Date: Wed, 29 Apr 2020 14:25:50 -0700
  4. Subject: [PATCH] compat: Fix ipv6_dst_lookup build error
  5. The geneve/vxlan compat code base invokes ipv6_dst_lookup() which is
  6. recently replaced by ipv6_dst_lookup_flow() in the stable kernel tree.
  7. This causes travis build failure:
  8. * https://travis-ci.org/github/openvswitch/ovs/builds/681084038
  9. This patch updates the backport logic to invoke the right function.
  10. Related patch in
  11. git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
  12. b9f3e457098e ("net: ipv6_stub: use ip6_dst_lookup_flow instead of
  13. ip6_dst_lookup")
  14. Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
  15. Signed-off-by: William Tu <u9012063@gmail.com>
  16. ---
  17. acinclude.m4 | 3 +++
  18. datapath/linux/compat/geneve.c | 11 +++++++----
  19. datapath/linux/compat/vxlan.c | 14 ++++++++------
  20. 3 files changed, 18 insertions(+), 10 deletions(-)
  21. diff --git a/acinclude.m4 b/acinclude.m4
  22. index c1470ccc6..ebe8b43b5 100644
  23. --- a/acinclude.m4
  24. +++ b/acinclude.m4
  25. @@ -569,7 +569,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
  26. OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup.*net],
  27. [OVS_DEFINE([HAVE_IPV6_DST_LOOKUP_NET])])
  28. + OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup_flow.*net],
  29. + [OVS_DEFINE([HAVE_IPV6_DST_LOOKUP_FLOW_NET])])
  30. OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_stub])
  31. + OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup_flow])
  32. OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [ERR_CAST])
  33. OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [IS_ERR_OR_NULL])
  34. diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c
  35. index c044b1489..4bdab6836 100644
  36. --- a/datapath/linux/compat/geneve.c
  37. +++ b/datapath/linux/compat/geneve.c
  38. @@ -962,14 +962,17 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
  39. return dst;
  40. }
  41. -#ifdef HAVE_IPV6_DST_LOOKUP_NET
  42. +#if defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET)
  43. + if (ipv6_stub->ipv6_dst_lookup_flow(geneve->net, gs6->sock->sk, &dst,
  44. + fl6)) {
  45. +#elif defined(HAVE_IPV6_DST_LOOKUP_FLOW)
  46. + if (ipv6_stub->ipv6_dst_lookup_flow(gs6->sock->sk, &dst, fl6)) {
  47. +#elif defined(HAVE_IPV6_DST_LOOKUP_NET)
  48. if (ipv6_stub->ipv6_dst_lookup(geneve->net, gs6->sock->sk, &dst, fl6)) {
  49. -#else
  50. -#ifdef HAVE_IPV6_STUB
  51. +#elif defined(HAVE_IPV6_STUB)
  52. if (ipv6_stub->ipv6_dst_lookup(gs6->sock->sk, &dst, fl6)) {
  53. #else
  54. if (ip6_dst_lookup(gs6->sock->sk, &dst, fl6)) {
  55. -#endif
  56. #endif
  57. netdev_dbg(dev, "no route to %pI6\n", &fl6->daddr);
  58. return ERR_PTR(-ENETUNREACH);
  59. diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
  60. index 23118e8b6..ff10ae6f4 100644
  61. --- a/datapath/linux/compat/vxlan.c
  62. +++ b/datapath/linux/compat/vxlan.c
  63. @@ -990,17 +990,19 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
  64. fl6.fl6_dport = dport;
  65. fl6.fl6_sport = sport;
  66. -#ifdef HAVE_IPV6_DST_LOOKUP_NET
  67. - err = ipv6_stub->ipv6_dst_lookup(vxlan->net,
  68. - sock6->sock->sk,
  69. +#if defined(HAVE_IPV6_DST_LOOKUP_FLOW_NET)
  70. + err = ipv6_stub->ipv6_dst_lookup_flow(vxlan->net, sock6->sock->sk,
  71. + &ndst, &fl6);
  72. +#elif defined(HAVE_IPV6_DST_LOOKUP_FLOW)
  73. + err = ipv6_stub->ipv6_dst_lookup_flow(sock6->sock->sk, &ndst, &fl6);
  74. +#elif defined(HAVE_IPV6_DST_LOOKUP_NET)
  75. + err = ipv6_stub->ipv6_dst_lookup(vxlan->net, sock6->sock->sk,
  76. &ndst, &fl6);
  77. -#else
  78. -#ifdef HAVE_IPV6_STUB
  79. +#elif defined(HAVE_IPV6_STUB)
  80. err = ipv6_stub->ipv6_dst_lookup(vxlan->vn6_sock->sock->sk,
  81. &ndst, &fl6);
  82. #else
  83. err = ip6_dst_lookup(vxlan->vn6_sock->sock->sk, &ndst, &fl6);
  84. -#endif
  85. #endif
  86. if (err < 0)
  87. return ERR_PTR(err);