--- zzzz-none-000/linux-5.4.213/include/linux/if_bridge.h 2022-09-15 10:04:56.000000000 +0000 +++ alder-5690pro-762/linux-5.4.213/include/linux/if_bridge.h 2024-08-14 09:02:08.000000000 +0000 @@ -50,7 +50,23 @@ #define BR_DEFAULT_AGEING_TIME (300 * HZ) +struct net_bridge_port; + extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); +extern struct net_device *br_port_dev_get(struct net_device *dev, + unsigned char *addr, + struct sk_buff *skb, + unsigned int cookie); +extern void br_refresh_fdb_entry(struct net_device *dev, const char *addr); +extern void br_fdb_entry_refresh(struct net_device *dev, const char *addr, __u16 vid); +extern void br_dev_update_stats(struct net_device *dev, + struct rtnl_link_stats64 *nlstats); +extern struct net_bridge_fdb_entry *br_fdb_has_entry(struct net_device *dev, + const char *addr, + __u16 vid); +extern void br_fdb_update_register_notify(struct notifier_block *nb); +extern void br_fdb_update_unregister_notify(struct notifier_block *nb); +extern bool br_is_hairpin_enabled(struct net_device *dev); #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) int br_multicast_list_adjacent(struct net_device *dev, @@ -92,6 +108,12 @@ int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto); int br_vlan_get_info(const struct net_device *dev, u16 vid, struct bridge_vlan_info *p_vinfo); + +extern struct net_device *br_fdb_find_vid_by_mac(struct net_device *dev, u8 *mac, u16 *vid); +extern int br_vlan_get_tag_skb(const struct sk_buff *skb, u16 *vid); +extern int br_dev_is_vlan_filter_enabled(const struct net_device *dev); +extern int br_vlan_update_stats(struct net_device* dev, u32 vid, u64 rx_bytes, u64 rx_packets, u64 tx_bytes, u64 tx_packets); +extern int br_vlan_get_info_rcu(const struct net_device *dev, u16 vid, struct bridge_vlan_info *p_vinfo); #else static inline bool br_vlan_enabled(const struct net_device *dev) { @@ -113,8 +135,32 @@ return -EINVAL; } -static inline int br_vlan_get_info(const struct net_device *dev, u16 vid, - struct bridge_vlan_info *p_vinfo) +static inline int br_vlan_get_info(const struct net_device *dev, u16 vid, struct bridge_vlan_info *p_vinfo) +{ + return -EINVAL; +} + +static inline struct net_device *br_fdb_find_vid_by_mac(struct net_device *dev, u8 *mac, u16 *vid) +{ + return NULL; +} + +static inline int br_vlan_get_tag_skb(const struct sk_buff *skb, u16 *vid) +{ + return -EINVAL; +} + +static inline int br_dev_is_vlan_filter_enabled(const struct net_device *dev) +{ + return -EINVAL; +} + +static inline int br_vlan_update_stats(struct net_device* dev, u32 vid, u64 rx_bytes, u64 rx_packets, u64 tx_bytes, u64 tx_packets) +{ + return -EINVAL; +} + +static inline int br_vlan_get_info_rcu(const struct net_device *dev, u16 vid, struct bridge_vlan_info *p_vinfo) { return -EINVAL; } @@ -146,4 +192,42 @@ } #endif +typedef struct net_bridge_port *br_port_dev_get_hook_t(struct net_device *dev, + struct sk_buff *skb, + unsigned char *addr, + unsigned int cookie); +extern br_port_dev_get_hook_t __rcu *br_port_dev_get_hook; + +typedef void (br_notify_hook_t)(int group, int event, const void *ptr); +extern br_notify_hook_t __rcu *br_notify_hook; +typedef int (br_multicast_handle_hook_t)(const struct net_bridge_port *src, + struct sk_buff *skb); +extern br_multicast_handle_hook_t __rcu *br_multicast_handle_hook; + +#define BR_FDB_EVENT_ADD 0x01 +#define BR_FDB_EVENT_DEL 0x02 + +struct br_fdb_event { + unsigned char addr[6]; + unsigned char is_local; + struct net_device *dev; + struct net_bridge *br; + struct net_device *orig_dev; +}; + +extern void br_fdb_register_notify(struct notifier_block *nb); +extern void br_fdb_unregister_notify(struct notifier_block *nb); +extern struct net_device *br_fdb_bridge_dev_get_and_hold(struct net_bridge *br); +extern int br_fdb_delete_by_netdev(struct net_device *dev, + const unsigned char *addr, u16 vid); +extern int br_fdb_add_or_refresh_by_netdev(struct net_device *dev, + const unsigned char *addr, u16 vid, u16 state); + +typedef struct net_bridge_port *br_get_dst_hook_t( + const struct net_bridge_port *src, + struct sk_buff **skb); +extern br_get_dst_hook_t __rcu *br_get_dst_hook; + +typedef void (br_notify_hook_t)(int group, int event, const void *ptr); +extern br_notify_hook_t __rcu *br_notify_hook; #endif