diff options
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 51246579592e..390c04700590 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -390,6 +390,7 @@ enum sock_flags { | |||
390 | SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ | 390 | SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ |
391 | SOCK_DBG, /* %SO_DEBUG setting */ | 391 | SOCK_DBG, /* %SO_DEBUG setting */ |
392 | SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ | 392 | SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ |
393 | SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */ | ||
393 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ | 394 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ |
394 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ | 395 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ |
395 | }; | 396 | }; |
@@ -1283,21 +1284,17 @@ static inline int sock_intr_errno(long timeo) | |||
1283 | return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; | 1284 | return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; |
1284 | } | 1285 | } |
1285 | 1286 | ||
1287 | extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, | ||
1288 | struct sk_buff *skb); | ||
1289 | |||
1286 | static __inline__ void | 1290 | static __inline__ void |
1287 | sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | 1291 | sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) |
1288 | { | 1292 | { |
1289 | ktime_t kt = skb->tstamp; | 1293 | ktime_t kt = skb->tstamp; |
1290 | 1294 | ||
1291 | if (sock_flag(sk, SOCK_RCVTSTAMP)) { | 1295 | if (sock_flag(sk, SOCK_RCVTSTAMP)) |
1292 | struct timeval tv; | 1296 | __sock_recv_timestamp(msg, sk, skb); |
1293 | /* Race occurred between timestamp enabling and packet | 1297 | else |
1294 | receiving. Fill in the current time for now. */ | ||
1295 | if (kt.tv64 == 0) | ||
1296 | kt = ktime_get_real(); | ||
1297 | skb->tstamp = kt; | ||
1298 | tv = ktime_to_timeval(kt); | ||
1299 | put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(tv), &tv); | ||
1300 | } else | ||
1301 | sk->sk_stamp = kt; | 1298 | sk->sk_stamp = kt; |
1302 | } | 1299 | } |
1303 | 1300 | ||