aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_output.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-10-18 17:00:24 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-19 03:10:46 -0400
commit9e903e085262ffbf1fc44a17ac06058aca03524a (patch)
tree4acefc97ba38c1733474d25c0b2053b56af97db1 /net/ipv4/ip_output.c
parentdd767856a36e00b631d65ebc4bb81b19915532d6 (diff)
net: add skb frag size accessors
To ease skb->truesize sanitization, its better to be able to localize all references to skb frags size. Define accessors : skb_frag_size() to fetch frag size, and skb_frag_size_{set|add|sub}() to manipulate it. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r--net/ipv4/ip_output.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index ae3bb147affd..e1374ab034bb 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1015,13 +1015,13 @@ alloc_new_skb:
1015 err = -EMSGSIZE; 1015 err = -EMSGSIZE;
1016 goto error; 1016 goto error;
1017 } 1017 }
1018 if (getfrag(from, skb_frag_address(frag)+frag->size, 1018 if (getfrag(from, skb_frag_address(frag)+skb_frag_size(frag),
1019 offset, copy, skb->len, skb) < 0) { 1019 offset, copy, skb->len, skb) < 0) {
1020 err = -EFAULT; 1020 err = -EFAULT;
1021 goto error; 1021 goto error;
1022 } 1022 }
1023 cork->off += copy; 1023 cork->off += copy;
1024 frag->size += copy; 1024 skb_frag_size_add(frag, copy);
1025 skb->len += copy; 1025 skb->len += copy;
1026 skb->data_len += copy; 1026 skb->data_len += copy;
1027 skb->truesize += copy; 1027 skb->truesize += copy;
@@ -1230,7 +1230,7 @@ ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
1230 if (len > size) 1230 if (len > size)
1231 len = size; 1231 len = size;
1232 if (skb_can_coalesce(skb, i, page, offset)) { 1232 if (skb_can_coalesce(skb, i, page, offset)) {
1233 skb_shinfo(skb)->frags[i-1].size += len; 1233 skb_frag_size_add(&skb_shinfo(skb)->frags[i-1], len);
1234 } else if (i < MAX_SKB_FRAGS) { 1234 } else if (i < MAX_SKB_FRAGS) {
1235 get_page(page); 1235 get_page(page);
1236 skb_fill_page_desc(skb, i, page, offset, len); 1236 skb_fill_page_desc(skb, i, page, offset, len);