--- zzzz-none-000/linux-5.4.213/net/bridge/br_private.h 2022-09-15 10:04:56.000000000 +0000 +++ alder-5690pro-762/linux-5.4.213/net/bridge/br_private.h 2024-08-14 09:02:13.000000000 +0000 @@ -18,6 +18,8 @@ #include #include #include +#include +#include #define BR_HASH_BITS 8 #define BR_HASH_SIZE (1 << BR_HASH_BITS) @@ -172,6 +174,11 @@ u16 pvid; }; +/* bridge fdb flags */ +enum { + BR_FDB_DYNAMIC_LEARNED, +}; + struct net_bridge_fdb_key { mac_addr addr; u16 vlan_id; @@ -183,6 +190,7 @@ struct net_bridge_fdb_key key; struct hlist_node fdb_node; + unsigned long flags; unsigned char is_local:1, is_static:1, is_sticky:1, @@ -345,6 +353,8 @@ u16 group_fwd_mask; u16 group_fwd_mask_required; + bool disable_eap_hack; + /* STP */ bridge_id designated_root; bridge_id bridge_id; @@ -413,6 +423,9 @@ struct kobject *ifobj; u32 auto_cnt; + atomic_t fdb_n_learned; + u32 fdb_max_learned; + #ifdef CONFIG_NET_SWITCHDEV int offload_fwd_mark; #endif @@ -625,6 +638,7 @@ int nbp_backup_change(struct net_bridge_port *p, struct net_device *backup_dev); /* br_input.c */ +int br_pass_frame_up(struct sk_buff *skb); int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb); rx_handler_result_t br_handle_frame(struct sk_buff **pskb); @@ -909,6 +923,7 @@ void br_vlan_port_event(struct net_bridge_port *p, unsigned long event); int br_vlan_bridge_event(struct net_device *dev, unsigned long event, void *ptr); +void br_vlan_disable_default_pvid(struct net_bridge *br); static inline struct net_bridge_vlan_group *br_vlan_group( const struct net_bridge *br) @@ -1115,12 +1130,25 @@ int br_nf_core_init(void); void br_nf_core_fini(void); void br_netfilter_rtable_init(struct net_bridge *); +bool br_netfilter_run_hooks(struct net *net); #else static inline int br_nf_core_init(void) { return 0; } static inline void br_nf_core_fini(void) {} #define br_netfilter_rtable_init(x) +static inline bool br_netfilter_run_hooks(struct net *net) { return false; } #endif +static inline int +BR_HOOK(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, + struct sk_buff *skb, struct net_device *in, struct net_device *out, + int (*okfn)(struct net *, struct sock *, struct sk_buff *)) +{ + if (!br_netfilter_run_hooks(net)) + return okfn(net, sk, skb); + + return NF_HOOK(pf, hook, net, sk, skb, in, out, okfn); +} + /* br_stp.c */ void br_set_state(struct net_bridge_port *p, unsigned int state); struct net_bridge_port *br_get_port(struct net_bridge *br, u16 port_no); @@ -1266,4 +1294,16 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br, u16 vid, struct net_bridge_port *p, struct nd_msg *msg); struct nd_msg *br_is_nd_neigh_msg(struct sk_buff *skb, struct nd_msg *m); + +#define __br_get(__hook, __default, __args ...) \ + (__hook ? (__hook(__args)) : (__default)) + +static inline void __br_notify(int group, int type, const void *data) +{ + br_notify_hook_t *notify_hook = rcu_dereference(br_notify_hook); + + if (notify_hook) + notify_hook(group, type, data); +} + #endif