643-bridge_remove_ipv6_dependency.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. --- a/include/net/addrconf.h
  2. +++ b/include/net/addrconf.h
  3. @@ -92,6 +92,12 @@ extern void addrconf_join_solict(struc
  4. extern void addrconf_leave_solict(struct inet6_dev *idev,
  5. 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. @@ -44,3 +44,4 @@ 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. --- a/net/ipv6/addrconf.c
  32. +++ b/net/ipv6/addrconf.c
  33. @@ -1243,7 +1243,7 @@ out:
  34. return ret;
  35. }
  36. -int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
  37. +static int __ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
  38. const struct in6_addr *daddr, unsigned int prefs,
  39. struct in6_addr *saddr)
  40. {
  41. @@ -1368,7 +1368,6 @@ try_nextdev:
  42. in6_ifa_put(hiscore->ifa);
  43. return 0;
  44. }
  45. -EXPORT_SYMBOL(ipv6_dev_get_saddr);
  46. int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,
  47. unsigned char banned_flags)
  48. @@ -4968,6 +4967,9 @@ int __init addrconf_init(void)
  49. ipv6_addr_label_rtnl_register();
  50. + BUG_ON(ipv6_dev_get_saddr_hook != NULL);
  51. + rcu_assign_pointer(ipv6_dev_get_saddr_hook, __ipv6_dev_get_saddr);
  52. +
  53. return 0;
  54. errout:
  55. rtnl_af_unregister(&inet6_ops);
  56. @@ -4986,6 +4988,9 @@ void addrconf_cleanup(void)
  57. struct net_device *dev;
  58. int i;
  59. + rcu_assign_pointer(ipv6_dev_get_saddr_hook, NULL);
  60. + synchronize_rcu();
  61. +
  62. unregister_netdevice_notifier(&ipv6_dev_notf);
  63. unregister_pernet_subsys(&addrconf_ops);
  64. ipv6_addr_label_cleanup();
  65. --- /dev/null
  66. +++ b/net/ipv6/inet6_stubs.c
  67. @@ -0,0 +1,33 @@
  68. +/*
  69. + * This program is free software; you can redistribute it and/or
  70. + * modify it under the terms of the GNU General Public License
  71. + * as published by the Free Software Foundation; either version
  72. + * 2 of the License, or (at your option) any later version.
  73. + */
  74. +#include <linux/export.h>
  75. +#include <net/ipv6.h>
  76. +
  77. +int (*ipv6_dev_get_saddr_hook)(struct net *net, const struct net_device *dev,
  78. + const struct in6_addr *daddr, unsigned int prefs,
  79. + struct in6_addr *saddr);
  80. +
  81. +EXPORT_SYMBOL(ipv6_dev_get_saddr_hook);
  82. +
  83. +int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
  84. + const struct in6_addr *daddr, unsigned int prefs,
  85. + struct in6_addr *saddr)
  86. +{
  87. + int ret = -EADDRNOTAVAIL;
  88. + typeof(ipv6_dev_get_saddr_hook) dev_get_saddr;
  89. +
  90. + rcu_read_lock();
  91. + dev_get_saddr = rcu_dereference(ipv6_dev_get_saddr_hook);
  92. +
  93. + if (dev_get_saddr)
  94. + ret = dev_get_saddr(net, dst_dev, daddr, prefs, saddr);
  95. +
  96. + rcu_read_unlock();
  97. + return ret;
  98. +}
  99. +EXPORT_SYMBOL(ipv6_dev_get_saddr);
  100. +