diff mbox

[RFC,06/13] workaround: detect time stamp when command flags are expected

Message ID 1226415426.31699.5.camel@ecld0pohly
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Patrick Ohly Oct. 29, 2008, 2:48 p.m. UTC
This happens when IP_MULTICAST_LOOP is on. Apparently the time
stamped packet goes through the loop device's start_hard_xmit?!
TODO: find a clean solution.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
---
 net/core/skbuff.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Comments

David Miller Nov. 12, 2008, 10 a.m. UTC | #1
From: Patrick Ohly <patrick.ohly@intel.com>
Date: Wed, 29 Oct 2008 15:48:48 +0100

> +	/* sanity check: extra bits set => might be a real time stamp */
> +	if (orig_skb->tstamp.tv64 & ~(SKB_TSTAMP_TX_HARDWARE|SKB_TSTAMP_TX_HARDWARE_IN_PROGRESS|SKB_TSTAMP_TX_SOFTWARE)) {

Line is way too long, split up and group the bits:

	if (orig_skb->tstamp.tv64 & ~(SKB_TSTAMP_TX_HARDWARE |
				      SKB_TSTAMP_TX_HARDWARE_IN_PROGRESS |
				      SKB_TSTAMP_TX_SOFTWARE)) {
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7d714b8..7d9f1dd 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2574,6 +2574,13 @@  void skb_hwtstamp_tx(struct sk_buff *orig_skb,
 	struct sk_buff *skb;
 	int err = -ENOMEM;
 
+	/* sanity check: extra bits set => might be a real time stamp */
+	if (orig_skb->tstamp.tv64 & ~(SKB_TSTAMP_TX_HARDWARE|SKB_TSTAMP_TX_HARDWARE_IN_PROGRESS|SKB_TSTAMP_TX_SOFTWARE)) {
+		printk(KERN_DEBUG
+			"skb_hwtstamp_tx: invalid command flags\n");
+		return;
+	}
+
 	if (!sk)
 		return;