0013-Revert-linux-backport-IPv6-SAS-fixes-for-source-specific-routes.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Sun, 21 Jun 2015 05:49:05 +0200
  3. Subject: Revert "linux: backport IPv6 SAS fixes for source-specific routes"
  4. This reverts commit 5168c9a5702648eb690d32ec821647aca80aeba9.
  5. diff --git a/target/linux/generic/patches-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch b/target/linux/generic/patches-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch
  6. deleted file mode 100644
  7. index f67ef47..0000000
  8. --- a/target/linux/generic/patches-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch
  9. +++ /dev/null
  10. @@ -1,96 +0,0 @@
  11. -From e16e888b525503be05b3aea64190e8b3bdef44d0 Mon Sep 17 00:00:00 2001
  12. -From: Markus Stenberg <markus.stenberg@iki.fi>
  13. -Date: Tue, 5 May 2015 13:36:59 +0300
  14. -Subject: [PATCH] ipv6: Fixed source specific default route handling.
  15. -
  16. -If there are only IPv6 source specific default routes present, the
  17. -host gets -ENETUNREACH on e.g. connect() because ip6_dst_lookup_tail
  18. -calls ip6_route_output first, and given source address any, it fails,
  19. -and ip6_route_get_saddr is never called.
  20. -
  21. -The change is to use the ip6_route_get_saddr, even if the initial
  22. -ip6_route_output fails, and then doing ip6_route_output _again_ after
  23. -we have appropriate source address available.
  24. -
  25. -Note that this is '99% fix' to the problem; a correct fix would be to
  26. -do route lookups only within addrconf.c when picking a source address,
  27. -and never call ip6_route_output before source address has been
  28. -populated.
  29. -
  30. -Signed-off-by: Markus Stenberg <markus.stenberg@iki.fi>
  31. -Signed-off-by: David S. Miller <davem@davemloft.net>
  32. ----
  33. - net/ipv6/ip6_output.c | 39 +++++++++++++++++++++++++++++++--------
  34. - net/ipv6/route.c | 5 +++--
  35. - 2 files changed, 34 insertions(+), 10 deletions(-)
  36. -
  37. ---- a/net/ipv6/ip6_output.c
  38. -+++ b/net/ipv6/ip6_output.c
  39. -@@ -898,21 +898,45 @@ static int ip6_dst_lookup_tail(struct so
  40. - #endif
  41. - int err;
  42. -
  43. -- if (*dst == NULL)
  44. -- *dst = ip6_route_output(net, sk, fl6);
  45. --
  46. -- if ((err = (*dst)->error))
  47. -- goto out_err_release;
  48. -+ /* The correct way to handle this would be to do
  49. -+ * ip6_route_get_saddr, and then ip6_route_output; however,
  50. -+ * the route-specific preferred source forces the
  51. -+ * ip6_route_output call _before_ ip6_route_get_saddr.
  52. -+ *
  53. -+ * In source specific routing (no src=any default route),
  54. -+ * ip6_route_output will fail given src=any saddr, though, so
  55. -+ * that's why we try it again later.
  56. -+ */
  57. -+ if (ipv6_addr_any(&fl6->saddr) && (!*dst || !(*dst)->error)) {
  58. -+ struct rt6_info *rt;
  59. -+ bool had_dst = *dst != NULL;
  60. -
  61. -- if (ipv6_addr_any(&fl6->saddr)) {
  62. -- struct rt6_info *rt = (struct rt6_info *) *dst;
  63. -+ if (!had_dst)
  64. -+ *dst = ip6_route_output(net, sk, fl6);
  65. -+ rt = (*dst)->error ? NULL : (struct rt6_info *)*dst;
  66. - err = ip6_route_get_saddr(net, rt, &fl6->daddr,
  67. - sk ? inet6_sk(sk)->srcprefs : 0,
  68. - &fl6->saddr);
  69. - if (err)
  70. - goto out_err_release;
  71. -+
  72. -+ /* If we had an erroneous initial result, pretend it
  73. -+ * never existed and let the SA-enabled version take
  74. -+ * over.
  75. -+ */
  76. -+ if (!had_dst && (*dst)->error) {
  77. -+ dst_release(*dst);
  78. -+ *dst = NULL;
  79. -+ }
  80. - }
  81. -
  82. -+ if (!*dst)
  83. -+ *dst = ip6_route_output(net, sk, fl6);
  84. -+
  85. -+ err = (*dst)->error;
  86. -+ if (err)
  87. -+ goto out_err_release;
  88. -+
  89. - #ifdef CONFIG_IPV6_OPTIMISTIC_DAD
  90. - /*
  91. - * Here if the dst entry we've looked up
  92. ---- a/net/ipv6/route.c
  93. -+++ b/net/ipv6/route.c
  94. -@@ -2182,9 +2182,10 @@ int ip6_route_get_saddr(struct net *net,
  95. - unsigned int prefs,
  96. - struct in6_addr *saddr)
  97. - {
  98. -- struct inet6_dev *idev = ip6_dst_idev((struct dst_entry *)rt);
  99. -+ struct inet6_dev *idev =
  100. -+ rt ? ip6_dst_idev((struct dst_entry *)rt) : NULL;
  101. - int err = 0;
  102. -- if (rt->rt6i_prefsrc.plen)
  103. -+ if (rt && rt->rt6i_prefsrc.plen)
  104. - *saddr = rt->rt6i_prefsrc.addr;
  105. - else
  106. - err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL,