[NET]: Fix packet timestamping.
I've found the problem in general. It affects any 64-bit architecture. The problem occurs when you change the system time. Suppose that when you boot your system clock is forward by a day. This gets recorded down in skb_tv_base. You then wind the clock back by a day. From that point onwards the offset will be negative which essentially overflows the 32-bit variables they're stored in. In fact, why don't we just store the real time stamp in those 32-bit variables? After all, we're not going to overflow for quite a while yet. When we do overflow, we'll need a better solution of course. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
ddea7be0ec
commit
325ed82393
@@ -238,8 +238,8 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp)
|
||||
|
||||
pmsg->packet_id = (unsigned long )entry;
|
||||
pmsg->data_len = data_len;
|
||||
pmsg->timestamp_sec = skb_tv_base.tv_sec + entry->skb->tstamp.off_sec;
|
||||
pmsg->timestamp_usec = skb_tv_base.tv_usec + entry->skb->tstamp.off_usec;
|
||||
pmsg->timestamp_sec = entry->skb->tstamp.off_sec;
|
||||
pmsg->timestamp_usec = entry->skb->tstamp.off_usec;
|
||||
pmsg->mark = entry->skb->nfmark;
|
||||
pmsg->hook = entry->info->hook;
|
||||
pmsg->hw_protocol = entry->skb->protocol;
|
||||
|
Reference in New Issue
Block a user