2 * Linux ethernet bridge
5 * Lennert Buytenhek <buytenh@gnu.org>
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.
16 #include <linux/netdevice.h>
17 #include <linux/if_bridge.h>
18 #include <linux/netpoll.h>
19 #include <linux/u64_stats_sync.h>
20 #include <net/route.h>
21 #include <linux/if_vlan.h>
23 #define BR_HASH_BITS 8
24 #define BR_HASH_SIZE (1 << BR_HASH_BITS)
26 #define BR_HOLD_TIME (1*HZ)
28 #define BR_PORT_BITS 10
29 #define BR_MAX_PORTS (1<<BR_PORT_BITS)
30 #define BR_VLAN_BITMAP_LEN BITS_TO_LONGS(VLAN_N_VID)
32 #define BR_VERSION "2.3"
34 /* Control of forwarding link local multicast */
35 #define BR_GROUPFWD_DEFAULT 0
36 /* Don't allow forwarding control protocols like STP and LLDP */
37 #define BR_GROUPFWD_RESTRICTED 0x4007u
39 /* Path to usermode spanning tree program */
40 #define BR_STP_PROG "/sbin/bridge-stp"
42 typedef struct bridge_id bridge_id
;
43 typedef struct mac_addr mac_addr
;
44 typedef __u16 port_id
;
48 unsigned char prio
[2];
49 unsigned char addr
[6];
54 unsigned char addr
[6];
61 #if IS_ENABLED(CONFIG_IPV6)
69 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
71 struct bridge_mcast_query
{
72 struct timer_list timer
;
77 struct bridge_mcast_querier
{
78 struct timer_list timer
;
79 unsigned long delay_time
;
83 struct net_port_vlans
{
87 struct net_bridge_port
*port
;
88 struct net_bridge
*br
;
91 unsigned long vlan_bitmap
[BR_VLAN_BITMAP_LEN
];
92 unsigned long untagged_bitmap
[BR_VLAN_BITMAP_LEN
];
96 struct net_bridge_fdb_entry
98 struct hlist_node hlist
;
99 struct net_bridge_port
*dst
;
102 unsigned long updated
;
105 unsigned char is_local
;
106 unsigned char is_static
;
110 struct net_bridge_port_group
{
111 struct net_bridge_port
*port
;
112 struct net_bridge_port_group __rcu
*next
;
113 struct hlist_node mglist
;
115 struct timer_list timer
;
120 struct net_bridge_mdb_entry
122 struct hlist_node hlist
[2];
123 struct net_bridge
*br
;
124 struct net_bridge_port_group __rcu
*ports
;
126 struct timer_list timer
;
131 struct net_bridge_mdb_htable
133 struct hlist_head
*mhash
;
135 struct net_bridge_mdb_htable
*old
;
142 struct net_bridge_port
144 struct net_bridge
*br
;
145 struct net_device
*dev
;
146 struct list_head list
;
152 unsigned char topology_change_ack
;
153 unsigned char config_pending
;
155 port_id designated_port
;
156 bridge_id designated_root
;
157 bridge_id designated_bridge
;
160 unsigned long designated_age
;
162 struct timer_list forward_delay_timer
;
163 struct timer_list hold_timer
;
164 struct timer_list message_age_timer
;
169 #define BR_HAIRPIN_MODE 0x00000001
170 #define BR_BPDU_GUARD 0x00000002
171 #define BR_ROOT_BLOCK 0x00000004
172 #define BR_MULTICAST_FAST_LEAVE 0x00000008
173 #define BR_ADMIN_COST 0x00000010
174 #define BR_LEARNING 0x00000020
175 #define BR_FLOOD 0x00000040
177 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
178 struct bridge_mcast_query ip4_query
;
179 #if IS_ENABLED(CONFIG_IPV6)
180 struct bridge_mcast_query ip6_query
;
181 #endif /* IS_ENABLED(CONFIG_IPV6) */
182 unsigned char multicast_router
;
183 struct timer_list multicast_router_timer
;
184 struct hlist_head mglist
;
185 struct hlist_node rlist
;
189 char sysfs_name
[IFNAMSIZ
];
192 #ifdef CONFIG_NET_POLL_CONTROLLER
195 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
196 struct net_port_vlans __rcu
*vlan_info
;
200 #define br_port_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT)
202 static inline struct net_bridge_port
*br_port_get_rcu(const struct net_device
*dev
)
204 return rcu_dereference(dev
->rx_handler_data
);
207 static inline struct net_bridge_port
*br_port_get_rtnl(const struct net_device
*dev
)
209 return br_port_exists(dev
) ?
210 rtnl_dereference(dev
->rx_handler_data
) : NULL
;
213 struct br_cpu_netstats
{
218 struct u64_stats_sync syncp
;
224 struct list_head port_list
;
225 struct net_device
*dev
;
227 struct br_cpu_netstats __percpu
*stats
;
228 spinlock_t hash_lock
;
229 struct hlist_head hash
[BR_HASH_SIZE
];
230 #ifdef CONFIG_BRIDGE_NETFILTER
231 struct rtable fake_rtable
;
232 bool nf_call_iptables
;
233 bool nf_call_ip6tables
;
234 bool nf_call_arptables
;
239 bridge_id designated_root
;
242 unsigned long max_age
;
243 unsigned long hello_time
;
244 unsigned long forward_delay
;
245 unsigned long bridge_max_age
;
246 unsigned long ageing_time
;
247 unsigned long bridge_hello_time
;
248 unsigned long bridge_forward_delay
;
250 u8 group_addr
[ETH_ALEN
];
254 BR_NO_STP
, /* no spanning tree */
255 BR_KERNEL_STP
, /* old STP in kernel */
256 BR_USER_STP
, /* new RSTP in userspace */
259 unsigned char topology_change
;
260 unsigned char topology_change_detected
;
262 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
263 unsigned char multicast_router
;
265 u8 multicast_disabled
:1;
266 u8 multicast_querier
:1;
267 u8 multicast_query_use_ifaddr
:1;
272 u32 multicast_last_member_count
;
273 u32 multicast_startup_query_count
;
275 unsigned long multicast_last_member_interval
;
276 unsigned long multicast_membership_interval
;
277 unsigned long multicast_querier_interval
;
278 unsigned long multicast_query_interval
;
279 unsigned long multicast_query_response_interval
;
280 unsigned long multicast_startup_query_interval
;
282 spinlock_t multicast_lock
;
283 struct net_bridge_mdb_htable __rcu
*mdb
;
284 struct hlist_head router_list
;
286 struct timer_list multicast_router_timer
;
287 struct bridge_mcast_querier ip4_querier
;
288 struct bridge_mcast_query ip4_query
;
289 #if IS_ENABLED(CONFIG_IPV6)
290 struct bridge_mcast_querier ip6_querier
;
291 struct bridge_mcast_query ip6_query
;
292 #endif /* IS_ENABLED(CONFIG_IPV6) */
295 struct timer_list hello_timer
;
296 struct timer_list tcn_timer
;
297 struct timer_list topology_change_timer
;
298 struct timer_list gc_timer
;
299 struct kobject
*ifobj
;
300 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
302 struct net_port_vlans __rcu
*vlan_info
;
306 struct br_input_skb_cb
{
307 struct net_device
*brdev
;
308 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
314 #define BR_INPUT_SKB_CB(__skb) ((struct br_input_skb_cb *)(__skb)->cb)
316 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
317 # define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb) (BR_INPUT_SKB_CB(__skb)->mrouters_only)
319 # define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb) (0)
322 #define br_printk(level, br, format, args...) \
323 printk(level "%s: " format, (br)->dev->name, ##args)
325 #define br_err(__br, format, args...) \
326 br_printk(KERN_ERR, __br, format, ##args)
327 #define br_warn(__br, format, args...) \
328 br_printk(KERN_WARNING, __br, format, ##args)
329 #define br_notice(__br, format, args...) \
330 br_printk(KERN_NOTICE, __br, format, ##args)
331 #define br_info(__br, format, args...) \
332 br_printk(KERN_INFO, __br, format, ##args)
334 #define br_debug(br, format, args...) \
335 pr_debug("%s: " format, (br)->dev->name, ##args)
337 extern struct notifier_block br_device_notifier
;
339 /* called under bridge lock */
340 static inline int br_is_root_bridge(const struct net_bridge
*br
)
342 return !memcmp(&br
->bridge_id
, &br
->designated_root
, 8);
346 extern void br_dev_setup(struct net_device
*dev
);
347 extern void br_dev_delete(struct net_device
*dev
, struct list_head
*list
);
348 extern netdev_tx_t
br_dev_xmit(struct sk_buff
*skb
,
349 struct net_device
*dev
);
350 #ifdef CONFIG_NET_POLL_CONTROLLER
351 static inline void br_netpoll_send_skb(const struct net_bridge_port
*p
,
354 struct netpoll
*np
= p
->np
;
357 netpoll_send_skb(np
, skb
);
360 extern int br_netpoll_enable(struct net_bridge_port
*p
, gfp_t gfp
);
361 extern void br_netpoll_disable(struct net_bridge_port
*p
);
363 static inline void br_netpoll_send_skb(const struct net_bridge_port
*p
,
368 static inline int br_netpoll_enable(struct net_bridge_port
*p
, gfp_t gfp
)
373 static inline void br_netpoll_disable(struct net_bridge_port
*p
)
379 extern int br_fdb_init(void);
380 extern void br_fdb_fini(void);
381 extern void br_fdb_flush(struct net_bridge
*br
);
382 extern void br_fdb_changeaddr(struct net_bridge_port
*p
,
383 const unsigned char *newaddr
);
384 extern void br_fdb_change_mac_address(struct net_bridge
*br
, const u8
*newaddr
);
385 extern void br_fdb_cleanup(unsigned long arg
);
386 extern void br_fdb_delete_by_port(struct net_bridge
*br
,
387 const struct net_bridge_port
*p
, int do_all
);
388 extern struct net_bridge_fdb_entry
*__br_fdb_get(struct net_bridge
*br
,
389 const unsigned char *addr
,
391 extern int br_fdb_test_addr(struct net_device
*dev
, unsigned char *addr
);
392 extern int br_fdb_fillbuf(struct net_bridge
*br
, void *buf
,
393 unsigned long count
, unsigned long off
);
394 extern int br_fdb_insert(struct net_bridge
*br
,
395 struct net_bridge_port
*source
,
396 const unsigned char *addr
,
398 extern void br_fdb_update(struct net_bridge
*br
,
399 struct net_bridge_port
*source
,
400 const unsigned char *addr
,
402 extern int fdb_delete_by_addr(struct net_bridge
*br
, const u8
*addr
, u16 vid
);
404 extern int br_fdb_delete(struct ndmsg
*ndm
, struct nlattr
*tb
[],
405 struct net_device
*dev
,
406 const unsigned char *addr
);
407 extern int br_fdb_add(struct ndmsg
*nlh
, struct nlattr
*tb
[],
408 struct net_device
*dev
,
409 const unsigned char *addr
,
411 extern int br_fdb_dump(struct sk_buff
*skb
,
412 struct netlink_callback
*cb
,
413 struct net_device
*dev
,
417 extern void br_deliver(const struct net_bridge_port
*to
,
418 struct sk_buff
*skb
);
419 extern int br_dev_queue_push_xmit(struct sk_buff
*skb
);
420 extern void br_forward(const struct net_bridge_port
*to
,
421 struct sk_buff
*skb
, struct sk_buff
*skb0
);
422 extern int br_forward_finish(struct sk_buff
*skb
);
423 extern void br_flood_deliver(struct net_bridge
*br
, struct sk_buff
*skb
,
425 extern void br_flood_forward(struct net_bridge
*br
, struct sk_buff
*skb
,
426 struct sk_buff
*skb2
, bool unicast
);
429 extern void br_port_carrier_check(struct net_bridge_port
*p
);
430 extern int br_add_bridge(struct net
*net
, const char *name
);
431 extern int br_del_bridge(struct net
*net
, const char *name
);
432 extern void br_net_exit(struct net
*net
);
433 extern int br_add_if(struct net_bridge
*br
,
434 struct net_device
*dev
);
435 extern int br_del_if(struct net_bridge
*br
,
436 struct net_device
*dev
);
437 extern int br_min_mtu(const struct net_bridge
*br
);
438 extern netdev_features_t
br_features_recompute(struct net_bridge
*br
,
439 netdev_features_t features
);
442 extern int br_handle_frame_finish(struct sk_buff
*skb
);
443 extern rx_handler_result_t
br_handle_frame(struct sk_buff
**pskb
);
445 static inline bool br_rx_handler_check_rcu(const struct net_device
*dev
)
447 return rcu_dereference(dev
->rx_handler
) == br_handle_frame
;
450 static inline struct net_bridge_port
*br_port_get_check_rcu(const struct net_device
*dev
)
452 return br_rx_handler_check_rcu(dev
) ? br_port_get_rcu(dev
) : NULL
;
456 extern int br_dev_ioctl(struct net_device
*dev
, struct ifreq
*rq
, int cmd
);
457 extern int br_ioctl_deviceless_stub(struct net
*net
, unsigned int cmd
, void __user
*arg
);
460 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
461 extern unsigned int br_mdb_rehash_seq
;
462 extern int br_multicast_rcv(struct net_bridge
*br
,
463 struct net_bridge_port
*port
,
464 struct sk_buff
*skb
);
465 extern struct net_bridge_mdb_entry
*br_mdb_get(struct net_bridge
*br
,
466 struct sk_buff
*skb
, u16 vid
);
467 extern void br_multicast_add_port(struct net_bridge_port
*port
);
468 extern void br_multicast_del_port(struct net_bridge_port
*port
);
469 extern void br_multicast_enable_port(struct net_bridge_port
*port
);
470 extern void br_multicast_disable_port(struct net_bridge_port
*port
);
471 extern void br_multicast_init(struct net_bridge
*br
);
472 extern void br_multicast_open(struct net_bridge
*br
);
473 extern void br_multicast_stop(struct net_bridge
*br
);
474 extern void br_multicast_deliver(struct net_bridge_mdb_entry
*mdst
,
475 struct sk_buff
*skb
);
476 extern void br_multicast_forward(struct net_bridge_mdb_entry
*mdst
,
477 struct sk_buff
*skb
, struct sk_buff
*skb2
);
478 extern int br_multicast_set_router(struct net_bridge
*br
, unsigned long val
);
479 extern int br_multicast_set_port_router(struct net_bridge_port
*p
,
481 extern int br_multicast_toggle(struct net_bridge
*br
, unsigned long val
);
482 extern int br_multicast_set_querier(struct net_bridge
*br
, unsigned long val
);
483 extern int br_multicast_set_hash_max(struct net_bridge
*br
, unsigned long val
);
484 extern struct net_bridge_mdb_entry
*br_mdb_ip_get(
485 struct net_bridge_mdb_htable
*mdb
,
487 extern struct net_bridge_mdb_entry
*br_multicast_new_group(struct net_bridge
*br
,
488 struct net_bridge_port
*port
, struct br_ip
*group
);
489 extern void br_multicast_free_pg(struct rcu_head
*head
);
490 extern struct net_bridge_port_group
*br_multicast_new_port_group(
491 struct net_bridge_port
*port
,
493 struct net_bridge_port_group __rcu
*next
,
494 unsigned char state
);
495 extern void br_mdb_init(void);
496 extern void br_mdb_uninit(void);
497 extern void br_mdb_notify(struct net_device
*dev
, struct net_bridge_port
*port
,
498 struct br_ip
*group
, int type
);
500 #define mlock_dereference(X, br) \
501 rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock))
503 static inline bool br_multicast_is_router(struct net_bridge
*br
)
505 return br
->multicast_router
== 2 ||
506 (br
->multicast_router
== 1 &&
507 timer_pending(&br
->multicast_router_timer
));
511 __br_multicast_querier_exists(struct net_bridge
*br
,
512 struct bridge_mcast_querier
*querier
)
514 return time_is_before_jiffies(querier
->delay_time
) &&
515 (br
->multicast_querier
|| timer_pending(&querier
->timer
));
518 static inline bool br_multicast_querier_exists(struct net_bridge
*br
,
521 switch (eth
->h_proto
) {
522 case (htons(ETH_P_IP
)):
523 return __br_multicast_querier_exists(br
, &br
->ip4_querier
);
524 #if IS_ENABLED(CONFIG_IPV6)
525 case (htons(ETH_P_IPV6
)):
526 return __br_multicast_querier_exists(br
, &br
->ip6_querier
);
533 static inline int br_multicast_rcv(struct net_bridge
*br
,
534 struct net_bridge_port
*port
,
540 static inline struct net_bridge_mdb_entry
*br_mdb_get(struct net_bridge
*br
,
541 struct sk_buff
*skb
, u16 vid
)
546 static inline void br_multicast_add_port(struct net_bridge_port
*port
)
550 static inline void br_multicast_del_port(struct net_bridge_port
*port
)
554 static inline void br_multicast_enable_port(struct net_bridge_port
*port
)
558 static inline void br_multicast_disable_port(struct net_bridge_port
*port
)
562 static inline void br_multicast_init(struct net_bridge
*br
)
566 static inline void br_multicast_open(struct net_bridge
*br
)
570 static inline void br_multicast_stop(struct net_bridge
*br
)
574 static inline void br_multicast_deliver(struct net_bridge_mdb_entry
*mdst
,
579 static inline void br_multicast_forward(struct net_bridge_mdb_entry
*mdst
,
581 struct sk_buff
*skb2
)
584 static inline bool br_multicast_is_router(struct net_bridge
*br
)
588 static inline bool br_multicast_querier_exists(struct net_bridge
*br
,
593 static inline void br_mdb_init(void)
596 static inline void br_mdb_uninit(void)
602 #ifdef CONFIG_BRIDGE_VLAN_FILTERING
603 extern bool br_allowed_ingress(struct net_bridge
*br
, struct net_port_vlans
*v
,
604 struct sk_buff
*skb
, u16
*vid
);
605 extern bool br_allowed_egress(struct net_bridge
*br
,
606 const struct net_port_vlans
*v
,
607 const struct sk_buff
*skb
);
608 bool br_should_learn(struct net_bridge_port
*p
, struct sk_buff
*skb
, u16
*vid
);
609 extern struct sk_buff
*br_handle_vlan(struct net_bridge
*br
,
610 const struct net_port_vlans
*v
,
611 struct sk_buff
*skb
);
612 extern int br_vlan_add(struct net_bridge
*br
, u16 vid
, u16 flags
);
613 extern int br_vlan_delete(struct net_bridge
*br
, u16 vid
);
614 extern void br_vlan_flush(struct net_bridge
*br
);
615 extern int br_vlan_filter_toggle(struct net_bridge
*br
, unsigned long val
);
616 extern int nbp_vlan_add(struct net_bridge_port
*port
, u16 vid
, u16 flags
);
617 extern int nbp_vlan_delete(struct net_bridge_port
*port
, u16 vid
);
618 extern void nbp_vlan_flush(struct net_bridge_port
*port
);
619 extern bool nbp_vlan_find(struct net_bridge_port
*port
, u16 vid
);
621 static inline struct net_port_vlans
*br_get_vlan_info(
622 const struct net_bridge
*br
)
624 return rcu_dereference_rtnl(br
->vlan_info
);
627 static inline struct net_port_vlans
*nbp_get_vlan_info(
628 const struct net_bridge_port
*p
)
630 return rcu_dereference_rtnl(p
->vlan_info
);
633 /* Since bridge now depends on 8021Q module, but the time bridge sees the
634 * skb, the vlan tag will always be present if the frame was tagged.
636 static inline int br_vlan_get_tag(const struct sk_buff
*skb
, u16
*vid
)
640 if (vlan_tx_tag_present(skb
))
641 *vid
= vlan_tx_tag_get(skb
) & VLAN_VID_MASK
;
650 static inline u16
br_get_pvid(const struct net_port_vlans
*v
)
652 /* Return just the VID if it is set, or VLAN_N_VID (invalid vid) if
656 return v
->pvid
?: VLAN_N_VID
;
660 static inline bool br_allowed_ingress(struct net_bridge
*br
,
661 struct net_port_vlans
*v
,
668 static inline bool br_allowed_egress(struct net_bridge
*br
,
669 const struct net_port_vlans
*v
,
670 const struct sk_buff
*skb
)
675 static inline bool br_should_learn(struct net_bridge_port
*p
,
676 struct sk_buff
*skb
, u16
*vid
)
681 static inline struct sk_buff
*br_handle_vlan(struct net_bridge
*br
,
682 const struct net_port_vlans
*v
,
688 static inline int br_vlan_add(struct net_bridge
*br
, u16 vid
, u16 flags
)
693 static inline int br_vlan_delete(struct net_bridge
*br
, u16 vid
)
698 static inline void br_vlan_flush(struct net_bridge
*br
)
702 static inline int nbp_vlan_add(struct net_bridge_port
*port
, u16 vid
, u16 flags
)
707 static inline int nbp_vlan_delete(struct net_bridge_port
*port
, u16 vid
)
712 static inline void nbp_vlan_flush(struct net_bridge_port
*port
)
716 static inline struct net_port_vlans
*br_get_vlan_info(
717 const struct net_bridge
*br
)
721 static inline struct net_port_vlans
*nbp_get_vlan_info(
722 const struct net_bridge_port
*p
)
727 static inline bool nbp_vlan_find(struct net_bridge_port
*port
, u16 vid
)
732 static inline u16
br_vlan_get_tag(const struct sk_buff
*skb
, u16
*tag
)
736 static inline u16
br_get_pvid(const struct net_port_vlans
*v
)
738 return VLAN_N_VID
; /* Returns invalid vid */
743 #ifdef CONFIG_BRIDGE_NETFILTER
744 extern int br_netfilter_init(void);
745 extern void br_netfilter_fini(void);
746 extern void br_netfilter_rtable_init(struct net_bridge
*);
748 #define br_netfilter_init() (0)
749 #define br_netfilter_fini() do { } while(0)
750 #define br_netfilter_rtable_init(x)
754 extern void br_log_state(const struct net_bridge_port
*p
);
755 extern struct net_bridge_port
*br_get_port(struct net_bridge
*br
,
757 extern void br_init_port(struct net_bridge_port
*p
);
758 extern void br_become_designated_port(struct net_bridge_port
*p
);
760 extern void __br_set_forward_delay(struct net_bridge
*br
, unsigned long t
);
761 extern int br_set_forward_delay(struct net_bridge
*br
, unsigned long x
);
762 extern int br_set_hello_time(struct net_bridge
*br
, unsigned long x
);
763 extern int br_set_max_age(struct net_bridge
*br
, unsigned long x
);
767 extern void br_stp_enable_bridge(struct net_bridge
*br
);
768 extern void br_stp_disable_bridge(struct net_bridge
*br
);
769 extern void br_stp_set_enabled(struct net_bridge
*br
, unsigned long val
);
770 extern void br_stp_enable_port(struct net_bridge_port
*p
);
771 extern void br_stp_disable_port(struct net_bridge_port
*p
);
772 extern bool br_stp_recalculate_bridge_id(struct net_bridge
*br
);
773 extern void br_stp_change_bridge_id(struct net_bridge
*br
, const unsigned char *a
);
774 extern void br_stp_set_bridge_priority(struct net_bridge
*br
,
776 extern int br_stp_set_port_priority(struct net_bridge_port
*p
,
777 unsigned long newprio
);
778 extern int br_stp_set_path_cost(struct net_bridge_port
*p
,
779 unsigned long path_cost
);
780 extern ssize_t
br_show_bridge_id(char *buf
, const struct bridge_id
*id
);
784 extern void br_stp_rcv(const struct stp_proto
*proto
, struct sk_buff
*skb
,
785 struct net_device
*dev
);
788 extern void br_stp_timer_init(struct net_bridge
*br
);
789 extern void br_stp_port_timer_init(struct net_bridge_port
*p
);
790 extern unsigned long br_timer_value(const struct timer_list
*timer
);
793 #if IS_ENABLED(CONFIG_ATM_LANE)
794 extern int (*br_fdb_test_addr_hook
)(struct net_device
*dev
, unsigned char *addr
);
798 extern struct rtnl_link_ops br_link_ops
;
799 extern int br_netlink_init(void);
800 extern void br_netlink_fini(void);
801 extern void br_ifinfo_notify(int event
, struct net_bridge_port
*port
);
802 extern int br_setlink(struct net_device
*dev
, struct nlmsghdr
*nlmsg
);
803 extern int br_dellink(struct net_device
*dev
, struct nlmsghdr
*nlmsg
);
804 extern int br_getlink(struct sk_buff
*skb
, u32 pid
, u32 seq
,
805 struct net_device
*dev
, u32 filter_mask
);
809 extern const struct sysfs_ops brport_sysfs_ops
;
810 extern int br_sysfs_addif(struct net_bridge_port
*p
);
811 extern int br_sysfs_renameif(struct net_bridge_port
*p
);
814 extern int br_sysfs_addbr(struct net_device
*dev
);
815 extern void br_sysfs_delbr(struct net_device
*dev
);
819 static inline int br_sysfs_addif(struct net_bridge_port
*p
) { return 0; }
820 static inline int br_sysfs_renameif(struct net_bridge_port
*p
) { return 0; }
821 static inline int br_sysfs_addbr(struct net_device
*dev
) { return 0; }
822 static inline void br_sysfs_delbr(struct net_device
*dev
) { return; }
823 #endif /* CONFIG_SYSFS */