net: add skb_checksum_complete_unset
authorTom Herbert <tom@herbertland.com>
Mon, 20 Apr 2015 21:10:04 +0000 (14:10 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Apr 2015 01:57:26 +0000 (21:57 -0400)
This function changes ip_summed to CHECKSUM_NONE if CHECKSUM_COMPLETE
is set. This is called to discard checksum-complete when packet
is being modified and checksum is not pulled for headers in a layer.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h

index 0991259643d6ef44eac3940728a4c3fd1d51d7bb..06793b598f44828c5e36804c530aa5fd2400e8e2 100644 (file)
@@ -3016,6 +3016,18 @@ static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,
  */
 #define CHECKSUM_BREAK 76
 
+/* Unset checksum-complete
+ *
+ * Unset checksum complete can be done when packet is being modified
+ * (uncompressed for instance) and checksum-complete value is
+ * invalidated.
+ */
+static inline void skb_checksum_complete_unset(struct sk_buff *skb)
+{
+       if (skb->ip_summed == CHECKSUM_COMPLETE)
+               skb->ip_summed = CHECKSUM_NONE;
+}
+
 /* Validate (init) checksum based on checksum complete.
  *
  * Return values: