Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
5b036bf3
Commit
5b036bf3
authored
Jun 11, 2003
by
Stephen Hemminger
Committed by
David S. Miller
Jun 11, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BRIDGE]: Bridge using alloc_netdev.
parent
2022e705
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
39 additions
and
43 deletions
+39
-43
net/bridge/br_device.c
net/bridge/br_device.c
+4
-5
net/bridge/br_if.c
net/bridge/br_if.c
+9
-12
net/bridge/br_input.c
net/bridge/br_input.c
+3
-3
net/bridge/br_netfilter.c
net/bridge/br_netfilter.c
+1
-1
net/bridge/br_notify.c
net/bridge/br_notify.c
+2
-2
net/bridge/br_private.h
net/bridge/br_private.h
+1
-1
net/bridge/br_stp.c
net/bridge/br_stp.c
+5
-5
net/bridge/br_stp_bpdu.c
net/bridge/br_stp_bpdu.c
+1
-1
net/bridge/br_stp_if.c
net/bridge/br_stp_if.c
+2
-2
net/bridge/br_stp_timer.c
net/bridge/br_stp_timer.c
+8
-8
net/bridge/netfilter/ebt_redirect.c
net/bridge/netfilter/ebt_redirect.c
+1
-1
net/bridge/netfilter/ebtables.c
net/bridge/netfilter/ebtables.c
+2
-2
No files found.
net/bridge/br_device.c
View file @
5b036bf3
...
...
@@ -110,10 +110,6 @@ static int br_dev_accept_fastpath(struct net_device *dev, struct dst_entry *dst)
return
-
1
;
}
static
void
br_dev_destruct
(
struct
net_device
*
dev
)
{
kfree
(
dev
->
priv
);
}
void
br_dev_setup
(
struct
net_device
*
dev
)
{
...
...
@@ -124,10 +120,13 @@ void br_dev_setup(struct net_device *dev)
dev
->
hard_start_xmit
=
br_dev_xmit
;
dev
->
open
=
br_dev_open
;
dev
->
set_multicast_list
=
br_dev_set_multicast_list
;
dev
->
destructor
=
br_dev_destruct
;
dev
->
destructor
=
(
void
(
*
)(
struct
net_device
*
))
kfree
;
SET_MODULE_OWNER
(
dev
);
dev
->
stop
=
br_dev_stop
;
dev
->
accept_fastpath
=
br_dev_accept_fastpath
;
dev
->
tx_queue_len
=
0
;
dev
->
set_mac_address
=
NULL
;
dev
->
priv_flags
=
IFF_EBRIDGE
;
ether_setup
(
dev
);
}
net/bridge/br_if.c
View file @
5b036bf3
...
...
@@ -78,17 +78,14 @@ static struct net_bridge *new_nb(const char *name)
struct
net_bridge
*
br
;
struct
net_device
*
dev
;
if
((
br
=
kmalloc
(
sizeof
(
*
br
),
GFP_KERNEL
))
==
NULL
)
dev
=
alloc_netdev
(
sizeof
(
struct
net_bridge
),
name
,
br_dev_setup
);
if
(
!
dev
)
return
NULL
;
memset
(
br
,
0
,
sizeof
(
*
br
));
dev
=
&
br
->
dev
;
strlcpy
(
dev
->
name
,
name
,
sizeof
(
dev
->
name
));
dev
->
priv
=
br
;
dev
->
priv_flags
=
IFF_EBRIDGE
;
ether_setup
(
dev
);
br_dev_setup
(
dev
);
br
=
dev
->
priv
;
br
->
dev
=
dev
;
br
->
lock
=
SPIN_LOCK_UNLOCKED
;
INIT_LIST_HEAD
(
&
br
->
port_list
);
...
...
@@ -159,9 +156,9 @@ int br_add_bridge(const char *name)
if
((
br
=
new_nb
(
name
))
==
NULL
)
return
-
ENOMEM
;
ret
=
register_netdev
(
&
br
->
dev
);
ret
=
register_netdev
(
br
->
dev
);
if
(
ret
)
kfree
(
br
);
kfree
(
br
->
dev
);
return
ret
;
}
...
...
@@ -219,7 +216,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
br_stp_recalculate_bridge_id
(
br
);
br_fdb_insert
(
br
,
p
,
dev
->
dev_addr
,
1
);
if
((
br
->
dev
.
flags
&
IFF_UP
)
&&
(
dev
->
flags
&
IFF_UP
))
if
((
br
->
dev
->
flags
&
IFF_UP
)
&&
(
dev
->
flags
&
IFF_UP
))
br_stp_enable_port
(
p
);
spin_unlock_bh
(
&
br
->
lock
);
...
...
net/bridge/br_input.c
View file @
5b036bf3
...
...
@@ -40,7 +40,7 @@ static void br_pass_frame_up(struct net_bridge *br, struct sk_buff *skb)
br
->
statistics
.
rx_bytes
+=
skb
->
len
;
indev
=
skb
->
dev
;
skb
->
dev
=
&
br
->
dev
;
skb
->
dev
=
br
->
dev
;
NF_HOOK
(
PF_BRIDGE
,
NF_BR_LOCAL_IN
,
skb
,
indev
,
NULL
,
br_pass_frame_up_finish
);
...
...
@@ -67,7 +67,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
br
=
p
->
br
;
passedup
=
0
;
if
(
br
->
dev
.
flags
&
IFF_PROMISC
)
{
if
(
br
->
dev
->
flags
&
IFF_PROMISC
)
{
struct
sk_buff
*
skb2
;
skb2
=
skb_clone
(
skb
,
GFP_ATOMIC
);
...
...
@@ -140,7 +140,7 @@ int br_handle_frame(struct sk_buff *skb)
return
-
1
;
}
if
(
!
memcmp
(
p
->
br
->
dev
.
dev_addr
,
dest
,
ETH_ALEN
))
if
(
!
memcmp
(
p
->
br
->
dev
->
dev_addr
,
dest
,
ETH_ALEN
))
skb
->
pkt_type
=
PACKET_HOST
;
NF_HOOK
(
PF_BRIDGE
,
NF_BR_PRE_ROUTING
,
skb
,
skb
->
dev
,
NULL
,
...
...
net/bridge/br_netfilter.c
View file @
5b036bf3
...
...
@@ -37,7 +37,7 @@
sizeof(struct bridge_skb_cb)))
#define has_bridge_parent(device) ((device)->br_port != NULL)
#define bridge_parent(device) (
&((device)->br_port->br->dev)
)
#define bridge_parent(device) (
(device)->br_port->br->dev
)
/* We need these fake structures to make netfilter happy --
* lots of places assume that skb->dst != NULL, which isn't
...
...
net/bridge/br_notify.c
View file @
5b036bf3
...
...
@@ -52,7 +52,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
break
;
case
NETDEV_DOWN
:
if
(
br
->
dev
.
flags
&
IFF_UP
)
{
if
(
br
->
dev
->
flags
&
IFF_UP
)
{
spin_lock_bh
(
&
br
->
lock
);
br_stp_disable_port
(
p
);
spin_unlock_bh
(
&
br
->
lock
);
...
...
@@ -60,7 +60,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
break
;
case
NETDEV_UP
:
if
(
!
(
br
->
dev
.
flags
&
IFF_UP
))
{
if
(
!
(
br
->
dev
->
flags
&
IFF_UP
))
{
spin_lock_bh
(
&
br
->
lock
);
br_stp_enable_port
(
p
);
spin_unlock_bh
(
&
br
->
lock
);
...
...
net/bridge/br_private.h
View file @
5b036bf3
...
...
@@ -81,7 +81,7 @@ struct net_bridge
{
spinlock_t
lock
;
struct
list_head
port_list
;
struct
net_device
dev
;
struct
net_device
*
dev
;
struct
net_device_stats
statistics
;
rwlock_t
hash_lock
;
struct
hlist_head
hash
[
BR_HASH_SIZE
];
...
...
net/bridge/br_stp.c
View file @
5b036bf3
...
...
@@ -26,7 +26,7 @@ static const char *br_port_state_names[] = {
void
br_log_state
(
const
struct
net_bridge_port
*
p
)
{
pr_info
(
"%s: port %d(%s) entering %s state
\n
"
,
p
->
br
->
dev
.
name
,
p
->
port_no
,
p
->
dev
->
name
,
p
->
br
->
dev
->
name
,
p
->
port_no
,
p
->
dev
->
name
,
br_port_state_names
[
p
->
state
]);
}
...
...
@@ -130,7 +130,7 @@ void br_become_root_bridge(struct net_bridge *br)
br_topology_change_detection
(
br
);
del_timer
(
&
br
->
tcn_timer
);
if
(
br
->
dev
.
flags
&
IFF_UP
)
{
if
(
br
->
dev
->
flags
&
IFF_UP
)
{
br_config_bpdu_generation
(
br
);
mod_timer
(
&
br
->
hello_timer
,
jiffies
+
br
->
hello_time
);
}
...
...
@@ -289,10 +289,10 @@ static inline void br_topology_change_acknowledged(struct net_bridge *br)
/* called under bridge lock */
void
br_topology_change_detection
(
struct
net_bridge
*
br
)
{
if
(
!
(
br
->
dev
.
flags
&
IFF_UP
))
if
(
!
(
br
->
dev
->
flags
&
IFF_UP
))
return
;
pr_info
(
"%s: topology change detected"
,
br
->
dev
.
name
);
pr_info
(
"%s: topology change detected"
,
br
->
dev
->
name
);
if
(
br_is_root_bridge
(
br
))
{
printk
(
", propagating"
);
br
->
topology_change
=
1
;
...
...
@@ -446,7 +446,7 @@ void br_received_tcn_bpdu(struct net_bridge_port *p)
{
if
(
br_is_designated_port
(
p
))
{
pr_info
(
"%s: received tcn bpdu on port %i(%s)
\n
"
,
p
->
br
->
dev
.
name
,
p
->
port_no
,
p
->
dev
->
name
);
p
->
br
->
dev
->
name
,
p
->
port_no
,
p
->
dev
->
name
);
br_topology_change_detection
(
p
->
br
);
br_topology_change_acknowledge
(
p
);
...
...
net/bridge/br_stp_bpdu.c
View file @
5b036bf3
...
...
@@ -145,7 +145,7 @@ void br_stp_handle_bpdu(struct sk_buff *skb)
spin_lock_bh
(
&
br
->
lock
);
if
(
p
->
state
==
BR_STATE_DISABLED
||
!
(
br
->
dev
.
flags
&
IFF_UP
)
||
!
(
br
->
dev
->
flags
&
IFF_UP
)
||
!
br
->
stp_enabled
||
memcmp
(
buf
,
header
,
6
))
goto
out
;
...
...
net/bridge/br_stp_if.c
View file @
5b036bf3
...
...
@@ -93,7 +93,7 @@ void br_stp_disable_port(struct net_bridge_port *p)
br
=
p
->
br
;
printk
(
KERN_INFO
"%s: port %i(%s) entering %s state
\n
"
,
br
->
dev
.
name
,
p
->
port_no
,
p
->
dev
->
name
,
"disabled"
);
br
->
dev
->
name
,
p
->
port_no
,
p
->
dev
->
name
,
"disabled"
);
wasroot
=
br_is_root_bridge
(
br
);
br_become_designated_port
(
p
);
...
...
@@ -124,7 +124,7 @@ static void br_stp_change_bridge_id(struct net_bridge *br, unsigned char *addr)
memcpy
(
oldaddr
,
br
->
bridge_id
.
addr
,
ETH_ALEN
);
memcpy
(
br
->
bridge_id
.
addr
,
addr
,
ETH_ALEN
);
memcpy
(
br
->
dev
.
dev_addr
,
addr
,
ETH_ALEN
);
memcpy
(
br
->
dev
->
dev_addr
,
addr
,
ETH_ALEN
);
list_for_each_entry
(
p
,
&
br
->
port_list
,
list
)
{
if
(
!
memcmp
(
p
->
designated_bridge
.
addr
,
oldaddr
,
ETH_ALEN
))
...
...
net/bridge/br_stp_timer.c
View file @
5b036bf3
...
...
@@ -38,9 +38,9 @@ static void br_hello_timer_expired(unsigned long arg)
{
struct
net_bridge
*
br
=
(
struct
net_bridge
*
)
arg
;
pr_debug
(
"%s: hello timer expired
\n
"
,
br
->
dev
.
name
);
pr_debug
(
"%s: hello timer expired
\n
"
,
br
->
dev
->
name
);
spin_lock_bh
(
&
br
->
lock
);
if
(
br
->
dev
.
flags
&
IFF_UP
)
{
if
(
br
->
dev
->
flags
&
IFF_UP
)
{
br_config_bpdu_generation
(
br
);
br
->
hello_timer
.
expires
=
jiffies
+
br
->
hello_time
;
...
...
@@ -61,7 +61,7 @@ static void br_message_age_timer_expired(unsigned long arg)
pr_info
(
"%s: neighbor %.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x lost on port %d(%s)
\n
"
,
br
->
dev
.
name
,
br
->
dev
->
name
,
id
->
prio
[
0
],
id
->
prio
[
1
],
id
->
addr
[
0
],
id
->
addr
[
1
],
id
->
addr
[
2
],
id
->
addr
[
3
],
id
->
addr
[
4
],
id
->
addr
[
5
],
...
...
@@ -89,7 +89,7 @@ static void br_forward_delay_timer_expired(unsigned long arg)
struct
net_bridge
*
br
=
p
->
br
;
pr_debug
(
"%s: %d(%s) forward delay timer
\n
"
,
br
->
dev
.
name
,
p
->
port_no
,
p
->
dev
->
name
);
br
->
dev
->
name
,
p
->
port_no
,
p
->
dev
->
name
);
spin_lock_bh
(
&
br
->
lock
);
if
(
p
->
state
==
BR_STATE_LISTENING
)
{
p
->
state
=
BR_STATE_LEARNING
;
...
...
@@ -108,9 +108,9 @@ static void br_tcn_timer_expired(unsigned long arg)
{
struct
net_bridge
*
br
=
(
struct
net_bridge
*
)
arg
;
pr_debug
(
"%s: tcn timer expired
\n
"
,
br
->
dev
.
name
);
pr_debug
(
"%s: tcn timer expired
\n
"
,
br
->
dev
->
name
);
spin_lock_bh
(
&
br
->
lock
);
if
(
br
->
dev
.
flags
&
IFF_UP
)
{
if
(
br
->
dev
->
flags
&
IFF_UP
)
{
br_transmit_tcn
(
br
);
br
->
tcn_timer
.
expires
=
jiffies
+
br
->
bridge_hello_time
;
...
...
@@ -123,7 +123,7 @@ static void br_topology_change_timer_expired(unsigned long arg)
{
struct
net_bridge
*
br
=
(
struct
net_bridge
*
)
arg
;
pr_debug
(
"%s: topo change timer expired
\n
"
,
br
->
dev
.
name
);
pr_debug
(
"%s: topo change timer expired
\n
"
,
br
->
dev
->
name
);
spin_lock_bh
(
&
br
->
lock
);
br
->
topology_change_detected
=
0
;
br
->
topology_change
=
0
;
...
...
@@ -135,7 +135,7 @@ static void br_hold_timer_expired(unsigned long arg)
struct
net_bridge_port
*
p
=
(
struct
net_bridge_port
*
)
arg
;
pr_debug
(
"%s: %d(%s) hold timer expired
\n
"
,
p
->
br
->
dev
.
name
,
p
->
port_no
,
p
->
dev
->
name
);
p
->
br
->
dev
->
name
,
p
->
port_no
,
p
->
dev
->
name
);
spin_lock_bh
(
&
p
->
br
->
lock
);
if
(
p
->
config_pending
)
...
...
net/bridge/netfilter/ebt_redirect.c
View file @
5b036bf3
...
...
@@ -22,7 +22,7 @@ static int ebt_target_redirect(struct sk_buff **pskb, unsigned int hooknr,
if
(
hooknr
!=
NF_BR_BROUTING
)
memcpy
((
**
pskb
).
mac
.
ethernet
->
h_dest
,
in
->
br_port
->
br
->
dev
.
dev_addr
,
ETH_ALEN
);
in
->
br_port
->
br
->
dev
->
dev_addr
,
ETH_ALEN
);
else
{
memcpy
((
**
pskb
).
mac
.
ethernet
->
h_dest
,
in
->
dev_addr
,
ETH_ALEN
);
...
...
net/bridge/netfilter/ebtables.c
View file @
5b036bf3
...
...
@@ -135,10 +135,10 @@ static inline int ebt_basic_match(struct ebt_entry *e, struct ethhdr *h,
if
(
FWINV2
(
ebt_dev_check
(
e
->
out
,
out
),
EBT_IOUT
))
return
1
;
if
((
!
in
||
!
in
->
br_port
)
?
0
:
FWINV2
(
ebt_dev_check
(
e
->
logical_in
,
&
in
->
br_port
->
br
->
dev
),
EBT_ILOGICALIN
))
e
->
logical_in
,
in
->
br_port
->
br
->
dev
),
EBT_ILOGICALIN
))
return
1
;
if
((
!
out
||
!
out
->
br_port
)
?
0
:
FWINV2
(
ebt_dev_check
(
e
->
logical_out
,
&
out
->
br_port
->
br
->
dev
),
EBT_ILOGICALOUT
))
e
->
logical_out
,
out
->
br_port
->
br
->
dev
),
EBT_ILOGICALOUT
))
return
1
;
if
(
e
->
bitmask
&
EBT_SOURCEMAC
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment