if_bridge.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Linux ethernet bridge
  3. *
  4. * Authors:
  5. * Lennert Buytenhek <buytenh@gnu.org>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #ifndef _LINUX_IF_BRIDGE_H
  13. #define _LINUX_IF_BRIDGE_H
  14. #include <linux/netdevice.h>
  15. #include <uapi/linux/if_bridge.h>
  16. #include <linux/bitops.h>
  17. struct br_ip {
  18. union {
  19. __be32 ip4;
  20. #if IS_ENABLED(CONFIG_IPV6)
  21. struct in6_addr ip6;
  22. #endif
  23. } u;
  24. __be16 proto;
  25. __u16 vid;
  26. };
  27. struct br_ip_list {
  28. struct list_head list;
  29. struct br_ip addr;
  30. };
  31. #define BR_HAIRPIN_MODE BIT(0)
  32. #define BR_BPDU_GUARD BIT(1)
  33. #define BR_ROOT_BLOCK BIT(2)
  34. #define BR_MULTICAST_FAST_LEAVE BIT(3)
  35. #define BR_ADMIN_COST BIT(4)
  36. #define BR_LEARNING BIT(5)
  37. #define BR_FLOOD BIT(6)
  38. #define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING)
  39. #define BR_PROMISC BIT(7)
  40. #define BR_PROXYARP BIT(8)
  41. #define BR_LEARNING_SYNC BIT(9)
  42. #define BR_PROXYARP_WIFI BIT(10)
  43. #define BR_MCAST_FLOOD BIT(11)
  44. #define BR_DEFAULT_AGEING_TIME (300 * HZ)
  45. extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
  46. typedef int br_should_route_hook_t(struct sk_buff *skb);
  47. extern br_should_route_hook_t __rcu *br_should_route_hook;
  48. #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING)
  49. int br_multicast_list_adjacent(struct net_device *dev,
  50. struct list_head *br_ip_list);
  51. bool br_multicast_has_querier_anywhere(struct net_device *dev, int proto);
  52. bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto);
  53. #else
  54. static inline int br_multicast_list_adjacent(struct net_device *dev,
  55. struct list_head *br_ip_list)
  56. {
  57. return 0;
  58. }
  59. static inline bool br_multicast_has_querier_anywhere(struct net_device *dev,
  60. int proto)
  61. {
  62. return false;
  63. }
  64. static inline bool br_multicast_has_querier_adjacent(struct net_device *dev,
  65. int proto)
  66. {
  67. return false;
  68. }
  69. #endif
  70. #endif