3 * Linux ethernet bridge
6 * Lennert Buytenhek <buytenh@gnu.org>
8 * $Id: br_forward.c,v 1.2 2000/02/21 15:51:33 davem Exp $
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
16 #include <linux/kernel.h>
17 #include <linux/netdevice.h>
18 #include <linux/inetdevice.h>
19 #include <linux/skbuff.h>
20 #include <linux/if_bridge.h>
21 #include "br_private.h"
23 static inline int should_forward(struct net_bridge_port
*p
, struct sk_buff
*skb
)
25 if (skb
->dev
== p
->dev
||
26 p
->state
!= BR_STATE_FORWARDING
)
32 static void __br_forward(struct net_bridge_port
*to
, struct sk_buff
*skb
)
38 /* called under bridge lock */
39 void br_forward(struct net_bridge_port
*to
, struct sk_buff
*skb
)
41 if (should_forward(to
, skb
)) {
42 __br_forward(to
, skb
);
49 /* called under bridge lock */
50 void br_flood(struct net_bridge
*br
, struct sk_buff
*skb
, int clone
)
52 struct net_bridge_port
*p
;
53 struct net_bridge_port
*prev
;
58 if ((skb2
= skb_clone(skb
, GFP_ATOMIC
)) == NULL
) {
59 br
->statistics
.tx_dropped
++;
70 if (should_forward(p
, skb
)) {
74 if ((skb2
= skb_clone(skb
, GFP_ATOMIC
)) == NULL
) {
75 br
->statistics
.tx_dropped
++;
80 __br_forward(prev
, skb2
);
90 __br_forward(prev
, skb
);