summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-01-11 01:54:28 +0300
committerDavid S. Miller <davem@davemloft.net>2016-01-11 01:54:28 +0300
commit749f7df18689b113dc0d914e40122b37ddaeff41 (patch)
tree3b01575dd9d774bcfbeb65f0ca302d606a26f895 /include/linux
parent4156afafcc4c522adfd59c694126edc30247b7ad (diff)
parentf8ffad69c9f8b8dfb0b633425d4ef4d2493ba61a (diff)
downloadlinux-749f7df18689b113dc0d914e40122b37ddaeff41.tar.xz
Merge branch 'bpf-next'
Daniel Borkmann says: ==================== BPF update Fixes a csum issue on ingress. As mentioned previously, net-next seems just fine imho. Later on, will follow up with couple of replacements like ovs_skb_postpush_rcsum() etc. Thanks! v1 -> v2: - Added patch 1 with helper - Implemented Hannes' idea to just use csum_partial, thanks! ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/skbuff.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6b6bd42d6134..07f9ccd28654 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2805,6 +2805,23 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb,
unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
+static inline void skb_postpush_rcsum(struct sk_buff *skb,
+ const void *start, unsigned int len)
+{
+ /* For performing the reverse operation to skb_postpull_rcsum(),
+ * we can instead of ...
+ *
+ * skb->csum = csum_add(skb->csum, csum_partial(start, len, 0));
+ *
+ * ... just use this equivalent version here to save a few
+ * instructions. Feeding csum of 0 in csum_partial() and later
+ * on adding skb->csum is equivalent to feed skb->csum in the
+ * first place.
+ */
+ if (skb->ip_summed == CHECKSUM_COMPLETE)
+ skb->csum = csum_partial(start, len, skb->csum);
+}
+
/**
* pskb_trim_rcsum - trim received skb and update checksum
* @skb: buffer to trim