643-bridge_remove_ipv6_dependency.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. --- a/include/net/addrconf.h
  2. +++ b/include/net/addrconf.h
  3. @@ -90,6 +90,12 @@ int ipv6_rcv_saddr_equal(const struct so
  4. void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr);
  5. void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr);
  6. +extern int (*ipv6_dev_get_saddr_hook)(struct net *net,
  7. + const struct net_device *dev,
  8. + const struct in6_addr *daddr,
  9. + unsigned int prefs,
  10. + struct in6_addr *saddr);
  11. +
  12. static inline unsigned long addrconf_timeout_fixup(u32 timeout,
  13. unsigned int unit)
  14. {
  15. --- a/net/bridge/Kconfig
  16. +++ b/net/bridge/Kconfig
  17. @@ -6,7 +6,6 @@ config BRIDGE
  18. tristate "802.1d Ethernet Bridging"
  19. select LLC
  20. select STP
  21. - depends on IPV6 || IPV6=n
  22. ---help---
  23. If you say Y here, then your Linux box will be able to act as an
  24. Ethernet bridge, which means that the different Ethernet segments it
  25. --- a/net/ipv6/Makefile
  26. +++ b/net/ipv6/Makefile
  27. @@ -45,6 +45,7 @@ obj-y += addrconf_core.o exthdrs_core.o
  28. obj-$(CONFIG_INET) += output_core.o protocol.o $(ipv6-offload)
  29. obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_hashtables.o
  30. +obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_stubs.o
  31. ifneq ($(CONFIG_IPV6),)
  32. obj-$(CONFIG_NET_UDP_TUNNEL) += ip6_udp_tunnel.o
  33. --- a/net/ipv6/addrconf.c
  34. +++ b/net/ipv6/addrconf.c
  35. @@ -1318,7 +1318,7 @@ out:
  36. return ret;
  37. }
  38. -int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
  39. +static int __ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
  40. const struct in6_addr *daddr, unsigned int prefs,
  41. struct in6_addr *saddr)
  42. {
  43. @@ -1443,7 +1443,6 @@ try_nextdev:
  44. in6_ifa_put(hiscore->ifa);
  45. return 0;
  46. }
  47. -EXPORT_SYMBOL(ipv6_dev_get_saddr);
  48. int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr,
  49. u32 banned_flags)
  50. @@ -5473,6 +5472,9 @@ int __init addrconf_init(void)
  51. ipv6_addr_label_rtnl_register();
  52. + BUG_ON(ipv6_dev_get_saddr_hook != NULL);
  53. + rcu_assign_pointer(ipv6_dev_get_saddr_hook, __ipv6_dev_get_saddr);
  54. +
  55. return 0;
  56. errout:
  57. rtnl_af_unregister(&inet6_ops);
  58. @@ -5492,6 +5494,9 @@ void addrconf_cleanup(void)
  59. struct net_device *dev;
  60. int i;
  61. + rcu_assign_pointer(ipv6_dev_get_saddr_hook, NULL);
  62. + synchronize_rcu();
  63. +
  64. unregister_netdevice_notifier(&ipv6_dev_notf);
  65. unregister_pernet_subsys(&addrconf_ops);
  66. ipv6_addr_label_cleanup();
  67. --- /dev/null
  68. +++ b/net/ipv6/inet6_stubs.c
  69. @@ -0,0 +1,33 @@
  70. +/*
  71. + * This program is free software; you can redistribute it and/or
  72. + * modify it under the terms of the GNU General Public License
  73. + * as published by the Free Software Foundation; either version
  74. + * 2 of the License, or (at your option) any later version.
  75. + */
  76. +#include <linux/export.h>
  77. +#include <net/ipv6.h>
  78. +
  79. +int (*ipv6_dev_get_saddr_hook)(struct net *net, const struct net_device *dev,
  80. + const struct in6_addr *daddr, unsigned int prefs,
  81. + struct in6_addr *saddr);
  82. +
  83. +EXPORT_SYMBOL(ipv6_dev_get_saddr_hook);
  84. +
  85. +int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
  86. + const struct in6_addr *daddr, unsigned int prefs,
  87. + struct in6_addr *saddr)
  88. +{
  89. + int ret = -EADDRNOTAVAIL;
  90. + typeof(ipv6_dev_get_saddr_hook) dev_get_saddr;
  91. +
  92. + rcu_read_lock();
  93. + dev_get_saddr = rcu_dereference(ipv6_dev_get_saddr_hook);
  94. +
  95. + if (dev_get_saddr)
  96. + ret = dev_get_saddr(net, dst_dev, daddr, prefs, saddr);
  97. +
  98. + rcu_read_unlock();
  99. + return ret;
  100. +}
  101. +EXPORT_SYMBOL(ipv6_dev_get_saddr);
  102. +