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
abea3264
Commit
abea3264
authored
Sep 15, 2003
by
Mitchell Blank Jr
Committed by
David S. Miller
Sep 15, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Tiny af_packet.c cleanup.
parent
7f1bc512
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
net/packet/af_packet.c
net/packet/af_packet.c
+19
-18
No files found.
net/packet/af_packet.c
View file @
abea3264
...
...
@@ -381,6 +381,23 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
}
#endif
static
inline
unsigned
run_filter
(
struct
sk_buff
*
skb
,
struct
sock
*
sk
,
unsigned
res
)
{
struct
sk_filter
*
filter
;
bh_lock_sock
(
sk
);
filter
=
sk
->
sk_filter
;
/*
* Our caller already checked that filter != NULL but we need to
* verify that under bh_lock_sock() to be safe
*/
if
(
likely
(
filter
!=
NULL
))
res
=
sk_run_filter
(
skb
,
filter
->
insns
,
filter
->
len
);
bh_unlock_sock
(
sk
);
return
res
;
}
/*
This function makes lazy skb cloning in hope that most of packets
are discarded by BPF.
...
...
@@ -429,15 +446,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
snaplen
=
skb
->
len
;
if
(
sk
->
sk_filter
)
{
unsigned
res
=
snaplen
;
struct
sk_filter
*
filter
;
bh_lock_sock
(
sk
);
if
((
filter
=
sk
->
sk_filter
)
!=
NULL
)
res
=
sk_run_filter
(
skb
,
sk
->
sk_filter
->
insns
,
sk
->
sk_filter
->
len
);
bh_unlock_sock
(
sk
);
unsigned
res
=
run_filter
(
skb
,
sk
,
snaplen
);
if
(
res
==
0
)
goto
drop_n_restore
;
if
(
snaplen
>
res
)
...
...
@@ -533,15 +542,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
snaplen
=
skb
->
len
;
if
(
sk
->
sk_filter
)
{
unsigned
res
=
snaplen
;
struct
sk_filter
*
filter
;
bh_lock_sock
(
sk
);
if
((
filter
=
sk
->
sk_filter
)
!=
NULL
)
res
=
sk_run_filter
(
skb
,
sk
->
sk_filter
->
insns
,
sk
->
sk_filter
->
len
);
bh_unlock_sock
(
sk
);
unsigned
res
=
run_filter
(
skb
,
sk
,
snaplen
);
if
(
res
==
0
)
goto
drop_n_restore
;
if
(
snaplen
>
res
)
...
...
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