Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37d41879 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller
Browse files

[NETFILTER]: Do not copy skb in skb_make_writable



Now that all callers of netfilter can guarantee that the skb is not shared,
we no longer have to copy the skb in skb_make_writable.

Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7b995651
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -287,7 +287,7 @@ extern void nf_invalidate_cache(int pf);
/* Call this before modifying an existing packet: ensures it is
   modifiable and linear to the point you care about (writable_len).
   Returns true or false. */
extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len);
extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);

static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
{
+1 −1
Original line number Diff line number Diff line
@@ -365,7 +365,7 @@ ipq_mangle_ipv4(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
		}
		skb_put(e->skb, diff);
	}
	if (!skb_make_writable(&e->skb, v->data_len))
	if (!skb_make_writable(e->skb, v->data_len))
		return -ENOMEM;
	skb_copy_to_linear_data(e->skb, v->payload, v->data_len);
	e->skb->ip_summed = CHECKSUM_NONE;
+2 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)

	if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) {
		__u8 oldtos;
		if (!skb_make_writable(pskb, sizeof(struct iphdr)))
		if (!skb_make_writable(*pskb, sizeof(struct iphdr)))
			return false;
		iph = ip_hdr(*pskb);
		oldtos = iph->tos;
@@ -62,7 +62,7 @@ set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
	     tcph->cwr == einfo->proto.tcp.cwr))
		return true;

	if (!skb_make_writable(pskb, ip_hdrlen(*pskb) + sizeof(*tcph)))
	if (!skb_make_writable(*pskb, ip_hdrlen(*pskb) + sizeof(*tcph)))
		return false;
	tcph = (void *)ip_hdr(*pskb) + ip_hdrlen(*pskb);

+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ target(struct sk_buff **pskb,

	if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) {
		__u8 oldtos;
		if (!skb_make_writable(pskb, sizeof(struct iphdr)))
		if (!skb_make_writable(*pskb, sizeof(struct iphdr)))
			return NF_DROP;
		iph = ip_hdr(*pskb);
		oldtos = iph->tos;
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ ipt_ttl_target(struct sk_buff **pskb,
	const struct ipt_TTL_info *info = targinfo;
	int new_ttl;

	if (!skb_make_writable(pskb, (*pskb)->len))
	if (!skb_make_writable(*pskb, (*pskb)->len))
		return NF_DROP;

	iph = ip_hdr(*pskb);
Loading