643-bridge_remove_ipv6_dependency.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. --- a/include/net/addrconf.h
  2. +++ b/include/net/addrconf.h
  3. @@ -93,6 +93,12 @@ extern void addrconf_join_solict(struc
  4. extern void addrconf_leave_solict(struct inet6_dev *idev,
  5. struct in6_addr *addr);
  6. +extern int (*ipv6_dev_get_saddr_hook)(struct net *net,
  7. + struct net_device *dev,
  8. + const struct in6_addr *daddr,
  9. + unsigned int srcprefs,
  10. + struct in6_addr *saddr);
  11. +
  12. static inline unsigned long addrconf_timeout_fixup(u32 timeout,
  13. unsigned 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. @@ -40,3 +40,4 @@ obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.
  28. obj-y += addrconf_core.o exthdrs_core.o
  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. @@ -1116,7 +1116,7 @@ out:
  34. return ret;
  35. }
  36. -int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
  37. +static int __ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
  38. const struct in6_addr *daddr, unsigned int prefs,
  39. struct in6_addr *saddr)
  40. {
  41. @@ -1241,7 +1241,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. @@ -4715,6 +4714,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. @@ -4733,6 +4735,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,27 @@
  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 <net/ipv6.h>
  75. +
  76. +int (*ipv6_dev_get_saddr_hook)(struct net *net, struct net_device *dev,
  77. + const struct in6_addr *daddr, unsigned int srcprefs,
  78. + struct in6_addr *saddr);
  79. +
  80. +EXPORT_SYMBOL(ipv6_dev_get_saddr_hook);
  81. +
  82. +int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
  83. + const struct in6_addr *daddr, unsigned int prefs,
  84. + struct in6_addr *saddr)
  85. +{
  86. + typeof(ipv6_dev_get_saddr_hook) dev_get_saddr = rcu_dereference(ipv6_dev_get_saddr_hook);
  87. +
  88. + if (dev_get_saddr)
  89. + return dev_get_saddr(net, dst_dev, daddr, prefs, saddr);
  90. +
  91. + return -EADDRNOTAVAIL;
  92. +}
  93. +EXPORT_SYMBOL(ipv6_dev_get_saddr);
  94. +