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
3348a894
Commit
3348a894
authored
Jul 20, 2003
by
Bart De Schuymer
Committed by
David S. Miller
Jul 20, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EBTABLES]: Copy skb when shared.
parent
900eb6a5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
net/bridge/netfilter/ebt_dnat.c
net/bridge/netfilter/ebt_dnat.c
+11
-0
net/bridge/netfilter/ebt_redirect.c
net/bridge/netfilter/ebt_redirect.c
+11
-0
net/bridge/netfilter/ebt_snat.c
net/bridge/netfilter/ebt_snat.c
+12
-0
No files found.
net/bridge/netfilter/ebt_dnat.c
View file @
3348a894
...
@@ -19,6 +19,17 @@ static int ebt_target_dnat(struct sk_buff **pskb, unsigned int hooknr,
...
@@ -19,6 +19,17 @@ static int ebt_target_dnat(struct sk_buff **pskb, unsigned int hooknr,
{
{
struct
ebt_nat_info
*
info
=
(
struct
ebt_nat_info
*
)
data
;
struct
ebt_nat_info
*
info
=
(
struct
ebt_nat_info
*
)
data
;
if
(
skb_shared
(
*
pskb
)
||
skb_cloned
(
*
pskb
))
{
struct
sk_buff
*
nskb
;
nskb
=
skb_copy
(
*
pskb
,
GFP_ATOMIC
);
if
(
!
nskb
)
return
NF_DROP
;
if
((
*
pskb
)
->
sk
)
skb_set_owner_w
(
nskb
,
(
*
pskb
)
->
sk
);
kfree_skb
(
*
pskb
);
*
pskb
=
nskb
;
}
memcpy
(((
**
pskb
).
mac
.
ethernet
)
->
h_dest
,
info
->
mac
,
memcpy
(((
**
pskb
).
mac
.
ethernet
)
->
h_dest
,
info
->
mac
,
ETH_ALEN
*
sizeof
(
unsigned
char
));
ETH_ALEN
*
sizeof
(
unsigned
char
));
return
info
->
target
;
return
info
->
target
;
...
...
net/bridge/netfilter/ebt_redirect.c
View file @
3348a894
...
@@ -20,6 +20,17 @@ static int ebt_target_redirect(struct sk_buff **pskb, unsigned int hooknr,
...
@@ -20,6 +20,17 @@ static int ebt_target_redirect(struct sk_buff **pskb, unsigned int hooknr,
{
{
struct
ebt_redirect_info
*
info
=
(
struct
ebt_redirect_info
*
)
data
;
struct
ebt_redirect_info
*
info
=
(
struct
ebt_redirect_info
*
)
data
;
if
(
skb_shared
(
*
pskb
)
||
skb_cloned
(
*
pskb
))
{
struct
sk_buff
*
nskb
;
nskb
=
skb_copy
(
*
pskb
,
GFP_ATOMIC
);
if
(
!
nskb
)
return
NF_DROP
;
if
((
*
pskb
)
->
sk
)
skb_set_owner_w
(
nskb
,
(
*
pskb
)
->
sk
);
kfree_skb
(
*
pskb
);
*
pskb
=
nskb
;
}
if
(
hooknr
!=
NF_BR_BROUTING
)
if
(
hooknr
!=
NF_BR_BROUTING
)
memcpy
((
**
pskb
).
mac
.
ethernet
->
h_dest
,
memcpy
((
**
pskb
).
mac
.
ethernet
->
h_dest
,
in
->
br_port
->
br
->
dev
->
dev_addr
,
ETH_ALEN
);
in
->
br_port
->
br
->
dev
->
dev_addr
,
ETH_ALEN
);
...
...
net/bridge/netfilter/ebt_snat.c
View file @
3348a894
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include <linux/netfilter_bridge/ebtables.h>
#include <linux/netfilter_bridge/ebtables.h>
#include <linux/netfilter_bridge/ebt_nat.h>
#include <linux/netfilter_bridge/ebt_nat.h>
#include <linux/module.h>
#include <linux/module.h>
#include <net/sock.h>
static
int
ebt_target_snat
(
struct
sk_buff
**
pskb
,
unsigned
int
hooknr
,
static
int
ebt_target_snat
(
struct
sk_buff
**
pskb
,
unsigned
int
hooknr
,
const
struct
net_device
*
in
,
const
struct
net_device
*
out
,
const
struct
net_device
*
in
,
const
struct
net_device
*
out
,
...
@@ -18,6 +19,17 @@ static int ebt_target_snat(struct sk_buff **pskb, unsigned int hooknr,
...
@@ -18,6 +19,17 @@ static int ebt_target_snat(struct sk_buff **pskb, unsigned int hooknr,
{
{
struct
ebt_nat_info
*
info
=
(
struct
ebt_nat_info
*
)
data
;
struct
ebt_nat_info
*
info
=
(
struct
ebt_nat_info
*
)
data
;
if
(
skb_shared
(
*
pskb
)
||
skb_cloned
(
*
pskb
))
{
struct
sk_buff
*
nskb
;
nskb
=
skb_copy
(
*
pskb
,
GFP_ATOMIC
);
if
(
!
nskb
)
return
NF_DROP
;
if
((
*
pskb
)
->
sk
)
skb_set_owner_w
(
nskb
,
(
*
pskb
)
->
sk
);
kfree_skb
(
*
pskb
);
*
pskb
=
nskb
;
}
memcpy
(((
**
pskb
).
mac
.
ethernet
)
->
h_source
,
info
->
mac
,
memcpy
(((
**
pskb
).
mac
.
ethernet
)
->
h_source
,
info
->
mac
,
ETH_ALEN
*
sizeof
(
unsigned
char
));
ETH_ALEN
*
sizeof
(
unsigned
char
));
return
info
->
target
;
return
info
->
target
;
...
...
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