diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2005-10-03 16:57:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-10-03 16:57:23 -0400 |
commit | 325ed8239309cb29f10ea58c5a668058ead11479 (patch) | |
tree | 77386825b72ac44f4f42a942ef78bd1ff924b351 /net/packet/af_packet.c | |
parent | ddea7be0ec8d1374f0b483a81566ed56ec9f3905 (diff) |
[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>
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r-- | net/packet/af_packet.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 6a67a87384cc..499ae3df4a44 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -654,8 +654,8 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
654 | __net_timestamp(skb); | 654 | __net_timestamp(skb); |
655 | sock_enable_timestamp(sk); | 655 | sock_enable_timestamp(sk); |
656 | } | 656 | } |
657 | h->tp_sec = skb_tv_base.tv_sec + skb->tstamp.off_sec; | 657 | h->tp_sec = skb->tstamp.off_sec; |
658 | h->tp_usec = skb_tv_base.tv_usec + skb->tstamp.off_usec; | 658 | h->tp_usec = skb->tstamp.off_usec; |
659 | 659 | ||
660 | sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h))); | 660 | sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h))); |
661 | sll->sll_halen = 0; | 661 | sll->sll_halen = 0; |