Commit 3862c6a9 authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: ipv4: prefer skb_ensure_writable

.. so skb_make_writable can be removed soon.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 86f04538
...@@ -17,7 +17,7 @@ target(struct sk_buff *skb, const struct xt_action_param *par) ...@@ -17,7 +17,7 @@ target(struct sk_buff *skb, const struct xt_action_param *par)
unsigned char *arpptr; unsigned char *arpptr;
int pln, hln; int pln, hln;
if (!skb_make_writable(skb, skb->len)) if (skb_ensure_writable(skb, skb->len))
return NF_DROP; return NF_DROP;
arp = arp_hdr(skb); arp = arp_hdr(skb);
......
...@@ -32,7 +32,7 @@ set_ect_ip(struct sk_buff *skb, const struct ipt_ECN_info *einfo) ...@@ -32,7 +32,7 @@ set_ect_ip(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) { if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) {
__u8 oldtos; __u8 oldtos;
if (!skb_make_writable(skb, sizeof(struct iphdr))) if (skb_ensure_writable(skb, sizeof(struct iphdr)))
return false; return false;
iph = ip_hdr(skb); iph = ip_hdr(skb);
oldtos = iph->tos; oldtos = iph->tos;
...@@ -61,7 +61,7 @@ set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo) ...@@ -61,7 +61,7 @@ set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
tcph->cwr == einfo->proto.tcp.cwr)) tcph->cwr == einfo->proto.tcp.cwr))
return true; return true;
if (!skb_make_writable(skb, ip_hdrlen(skb) + sizeof(*tcph))) if (skb_ensure_writable(skb, ip_hdrlen(skb) + sizeof(*tcph)))
return false; return false;
tcph = (void *)ip_hdr(skb) + ip_hdrlen(skb); tcph = (void *)ip_hdr(skb) + ip_hdrlen(skb);
......
...@@ -59,7 +59,7 @@ static int set_addr(struct sk_buff *skb, unsigned int protoff, ...@@ -59,7 +59,7 @@ static int set_addr(struct sk_buff *skb, unsigned int protoff,
net_notice_ratelimited("nf_nat_h323: nf_nat_mangle_udp_packet error\n"); net_notice_ratelimited("nf_nat_h323: nf_nat_mangle_udp_packet error\n");
return -1; return -1;
} }
/* nf_nat_mangle_udp_packet uses skb_make_writable() to copy /* nf_nat_mangle_udp_packet uses skb_ensure_writable() to copy
* or pull everything in a linear buffer, so we can safely * or pull everything in a linear buffer, so we can safely
* use the skb pointers now */ * use the skb pointers now */
*data = skb->data + ip_hdrlen(skb) + sizeof(struct udphdr); *data = skb->data + ip_hdrlen(skb) + sizeof(struct udphdr);
......
...@@ -186,7 +186,7 @@ static int help(struct sk_buff *skb, unsigned int protoff, ...@@ -186,7 +186,7 @@ static int help(struct sk_buff *skb, unsigned int protoff,
return NF_DROP; return NF_DROP;
} }
if (!skb_make_writable(skb, skb->len)) { if (skb_ensure_writable(skb, skb->len)) {
nf_ct_helper_log(skb, ct, "cannot mangle packet"); nf_ct_helper_log(skb, ct, "cannot mangle packet");
return NF_DROP; return NF_DROP;
} }
......
...@@ -285,7 +285,7 @@ static unsigned int nf_nat_sip(struct sk_buff *skb, unsigned int protoff, ...@@ -285,7 +285,7 @@ static unsigned int nf_nat_sip(struct sk_buff *skb, unsigned int protoff,
if (dir == IP_CT_DIR_REPLY && ct_sip_info->forced_dport) { if (dir == IP_CT_DIR_REPLY && ct_sip_info->forced_dport) {
struct udphdr *uh; struct udphdr *uh;
if (!skb_make_writable(skb, skb->len)) { if (skb_ensure_writable(skb, skb->len)) {
nf_ct_helper_log(skb, ct, "cannot mangle packet"); nf_ct_helper_log(skb, ct, "cannot mangle packet");
return NF_DROP; return NF_DROP;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment