diff options
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/netfilter/ebt_dnat.c | 13 | ||||
-rw-r--r-- | net/bridge/netfilter/ebt_redirect.c | 13 | ||||
-rw-r--r-- | net/bridge/netfilter/ebt_snat.c | 13 |
3 files changed, 9 insertions, 30 deletions
diff --git a/net/bridge/netfilter/ebt_dnat.c b/net/bridge/netfilter/ebt_dnat.c index 4582659dff0e..9d74dee20ab0 100644 --- a/net/bridge/netfilter/ebt_dnat.c +++ b/net/bridge/netfilter/ebt_dnat.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/netfilter.h> | ||
11 | #include <linux/netfilter_bridge/ebtables.h> | 12 | #include <linux/netfilter_bridge/ebtables.h> |
12 | #include <linux/netfilter_bridge/ebt_nat.h> | 13 | #include <linux/netfilter_bridge/ebt_nat.h> |
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
@@ -19,17 +20,9 @@ static int ebt_target_dnat(struct sk_buff **pskb, unsigned int hooknr, | |||
19 | { | 20 | { |
20 | struct ebt_nat_info *info = (struct ebt_nat_info *)data; | 21 | struct ebt_nat_info *info = (struct ebt_nat_info *)data; |
21 | 22 | ||
22 | if (skb_shared(*pskb) || skb_cloned(*pskb)) { | 23 | if (skb_make_writable(*pskb, 0)) |
23 | struct sk_buff *nskb; | 24 | return NF_DROP; |
24 | 25 | ||
25 | nskb = skb_copy(*pskb, GFP_ATOMIC); | ||
26 | if (!nskb) | ||
27 | return NF_DROP; | ||
28 | if ((*pskb)->sk) | ||
29 | skb_set_owner_w(nskb, (*pskb)->sk); | ||
30 | kfree_skb(*pskb); | ||
31 | *pskb = nskb; | ||
32 | } | ||
33 | memcpy(eth_hdr(*pskb)->h_dest, info->mac, ETH_ALEN); | 26 | memcpy(eth_hdr(*pskb)->h_dest, info->mac, ETH_ALEN); |
34 | return info->target; | 27 | return info->target; |
35 | } | 28 | } |
diff --git a/net/bridge/netfilter/ebt_redirect.c b/net/bridge/netfilter/ebt_redirect.c index 9f378eab72d0..81371cd01bd0 100644 --- a/net/bridge/netfilter/ebt_redirect.c +++ b/net/bridge/netfilter/ebt_redirect.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/netfilter.h> | ||
11 | #include <linux/netfilter_bridge/ebtables.h> | 12 | #include <linux/netfilter_bridge/ebtables.h> |
12 | #include <linux/netfilter_bridge/ebt_redirect.h> | 13 | #include <linux/netfilter_bridge/ebt_redirect.h> |
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
@@ -20,17 +21,9 @@ static int ebt_target_redirect(struct sk_buff **pskb, unsigned int hooknr, | |||
20 | { | 21 | { |
21 | struct ebt_redirect_info *info = (struct ebt_redirect_info *)data; | 22 | struct ebt_redirect_info *info = (struct ebt_redirect_info *)data; |
22 | 23 | ||
23 | if (skb_shared(*pskb) || skb_cloned(*pskb)) { | 24 | if (skb_make_writable(*pskb, 0)) |
24 | struct sk_buff *nskb; | 25 | return NF_DROP; |
25 | 26 | ||
26 | nskb = skb_copy(*pskb, GFP_ATOMIC); | ||
27 | if (!nskb) | ||
28 | return NF_DROP; | ||
29 | if ((*pskb)->sk) | ||
30 | skb_set_owner_w(nskb, (*pskb)->sk); | ||
31 | kfree_skb(*pskb); | ||
32 | *pskb = nskb; | ||
33 | } | ||
34 | if (hooknr != NF_BR_BROUTING) | 27 | if (hooknr != NF_BR_BROUTING) |
35 | memcpy(eth_hdr(*pskb)->h_dest, | 28 | memcpy(eth_hdr(*pskb)->h_dest, |
36 | in->br_port->br->dev->dev_addr, ETH_ALEN); | 29 | in->br_port->br->dev->dev_addr, ETH_ALEN); |
diff --git a/net/bridge/netfilter/ebt_snat.c b/net/bridge/netfilter/ebt_snat.c index a50722182bfe..b0c63684e2f5 100644 --- a/net/bridge/netfilter/ebt_snat.c +++ b/net/bridge/netfilter/ebt_snat.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/netfilter.h> | ||
11 | #include <linux/netfilter_bridge/ebtables.h> | 12 | #include <linux/netfilter_bridge/ebtables.h> |
12 | #include <linux/netfilter_bridge/ebt_nat.h> | 13 | #include <linux/netfilter_bridge/ebt_nat.h> |
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
@@ -21,17 +22,9 @@ static int ebt_target_snat(struct sk_buff **pskb, unsigned int hooknr, | |||
21 | { | 22 | { |
22 | struct ebt_nat_info *info = (struct ebt_nat_info *) data; | 23 | struct ebt_nat_info *info = (struct ebt_nat_info *) data; |
23 | 24 | ||
24 | if (skb_shared(*pskb) || skb_cloned(*pskb)) { | 25 | if (skb_make_writable(*pskb, 0)) |
25 | struct sk_buff *nskb; | 26 | return NF_DROP; |
26 | 27 | ||
27 | nskb = skb_copy(*pskb, GFP_ATOMIC); | ||
28 | if (!nskb) | ||
29 | return NF_DROP; | ||
30 | if ((*pskb)->sk) | ||
31 | skb_set_owner_w(nskb, (*pskb)->sk); | ||
32 | kfree_skb(*pskb); | ||
33 | *pskb = nskb; | ||
34 | } | ||
35 | memcpy(eth_hdr(*pskb)->h_source, info->mac, ETH_ALEN); | 28 | memcpy(eth_hdr(*pskb)->h_source, info->mac, ETH_ALEN); |
36 | if (!(info->target & NAT_ARP_BIT) && | 29 | if (!(info->target & NAT_ARP_BIT) && |
37 | eth_hdr(*pskb)->h_proto == htons(ETH_P_ARP)) { | 30 | eth_hdr(*pskb)->h_proto == htons(ETH_P_ARP)) { |