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
nexedi
linux
Commits
07211edd
Commit
07211edd
authored
Apr 29, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/acme/net-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents
89c03538
93996134
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
net/802/psnap.c
net/802/psnap.c
+17
-15
No files found.
net/802/psnap.c
View file @
07211edd
...
@@ -21,9 +21,9 @@
...
@@ -21,9 +21,9 @@
#include <linux/mm.h>
#include <linux/mm.h>
#include <linux/in.h>
#include <linux/in.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/brlock.h>
LIST_HEAD
(
snap_list
);
static
LIST_HEAD
(
snap_list
);
static
spinlock_t
snap_lock
=
SPIN_LOCK_UNLOCKED
;
static
struct
llc_sap
*
snap_sap
;
static
struct
llc_sap
*
snap_sap
;
/*
/*
...
@@ -34,17 +34,13 @@ static struct datalink_proto *find_snap_client(unsigned char *desc)
...
@@ -34,17 +34,13 @@ static struct datalink_proto *find_snap_client(unsigned char *desc)
struct
list_head
*
entry
;
struct
list_head
*
entry
;
struct
datalink_proto
*
proto
=
NULL
,
*
p
;
struct
datalink_proto
*
proto
=
NULL
,
*
p
;
if
(
list_empty
(
&
snap_list
))
list_for_each_rcu
(
entry
,
&
snap_list
)
{
goto
out
;
list_for_each
(
entry
,
&
snap_list
)
{
p
=
list_entry
(
entry
,
struct
datalink_proto
,
node
);
p
=
list_entry
(
entry
,
struct
datalink_proto
,
node
);
if
(
!
memcmp
(
p
->
type
,
desc
,
5
))
{
if
(
!
memcmp
(
p
->
type
,
desc
,
5
))
{
proto
=
p
;
proto
=
p
;
break
;
break
;
}
}
}
}
out:
return
proto
;
return
proto
;
}
}
...
@@ -55,11 +51,13 @@ static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
...
@@ -55,11 +51,13 @@ static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
struct
packet_type
*
pt
)
struct
packet_type
*
pt
)
{
{
int
rc
=
1
;
int
rc
=
1
;
struct
datalink_proto
*
proto
=
find_snap_client
(
skb
->
h
.
raw
)
;
struct
datalink_proto
*
proto
;
static
struct
packet_type
snap_packet_type
=
{
static
struct
packet_type
snap_packet_type
=
{
.
type
=
__constant_htons
(
ETH_P_SNAP
),
.
type
=
__constant_htons
(
ETH_P_SNAP
),
};
};
rcu_read_lock
();
proto
=
find_snap_client
(
skb
->
h
.
raw
);
if
(
proto
)
{
if
(
proto
)
{
/* Pass the frame on. */
/* Pass the frame on. */
skb
->
h
.
raw
+=
5
;
skb
->
h
.
raw
+=
5
;
...
@@ -71,6 +69,7 @@ static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
...
@@ -71,6 +69,7 @@ static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
rc
=
1
;
rc
=
1
;
}
}
rcu_read_unlock
();
return
rc
;
return
rc
;
}
}
...
@@ -124,7 +123,7 @@ struct datalink_proto *register_snap_client(unsigned char *desc,
...
@@ -124,7 +123,7 @@ struct datalink_proto *register_snap_client(unsigned char *desc,
{
{
struct
datalink_proto
*
proto
=
NULL
;
struct
datalink_proto
*
proto
=
NULL
;
br_write_lock_bh
(
BR_NETPROTO_LOCK
);
spin_lock_bh
(
&
snap_lock
);
if
(
find_snap_client
(
desc
))
if
(
find_snap_client
(
desc
))
goto
out
;
goto
out
;
...
@@ -135,10 +134,12 @@ struct datalink_proto *register_snap_client(unsigned char *desc,
...
@@ -135,10 +134,12 @@ struct datalink_proto *register_snap_client(unsigned char *desc,
proto
->
rcvfunc
=
rcvfunc
;
proto
->
rcvfunc
=
rcvfunc
;
proto
->
header_length
=
5
+
3
;
/* snap + 802.2 */
proto
->
header_length
=
5
+
3
;
/* snap + 802.2 */
proto
->
request
=
snap_request
;
proto
->
request
=
snap_request
;
list_add
(
&
proto
->
node
,
&
snap_list
);
list_add
_rcu
(
&
proto
->
node
,
&
snap_list
);
}
}
out:
out:
br_write_unlock_bh
(
BR_NETPROTO_LOCK
);
spin_unlock_bh
(
&
snap_lock
);
synchronize_net
();
return
proto
;
return
proto
;
}
}
...
@@ -147,12 +148,13 @@ struct datalink_proto *register_snap_client(unsigned char *desc,
...
@@ -147,12 +148,13 @@ struct datalink_proto *register_snap_client(unsigned char *desc,
*/
*/
void
unregister_snap_client
(
struct
datalink_proto
*
proto
)
void
unregister_snap_client
(
struct
datalink_proto
*
proto
)
{
{
br_write_lock_bh
(
BR_NETPROTO_LOCK
);
spin_lock_bh
(
&
snap_lock
);
list_del_rcu
(
&
proto
->
node
);
spin_unlock_bh
(
&
snap_lock
);
list_del
(
&
proto
->
node
);
synchronize_net
();
kfree
(
proto
);
br_write_unlock_bh
(
BR_NETPROTO_LOCK
);
kfree
(
proto
);
}
}
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
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