aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c
index ea8f81abc45c..1ad62c08377b 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -585,6 +585,37 @@ int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
585 return result; 585 return result;
586} 586}
587 587
588/*
589 * called from sock_recv_timestamp() if sock_flag(sk, SOCK_RCVTSTAMP)
590 */
591void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
592 struct sk_buff *skb)
593{
594 ktime_t kt = skb->tstamp;
595
596 if (!sock_flag(sk, SOCK_RCVTSTAMPNS)) {
597 struct timeval tv;
598 /* Race occurred between timestamp enabling and packet
599 receiving. Fill in the current time for now. */
600 if (kt.tv64 == 0)
601 kt = ktime_get_real();
602 skb->tstamp = kt;
603 tv = ktime_to_timeval(kt);
604 put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMP, sizeof(tv), &tv);
605 } else {
606 struct timespec ts;
607 /* Race occurred between timestamp enabling and packet
608 receiving. Fill in the current time for now. */
609 if (kt.tv64 == 0)
610 kt = ktime_get_real();
611 skb->tstamp = kt;
612 ts = ktime_to_timespec(kt);
613 put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPNS, sizeof(ts), &ts);
614 }
615}
616
617EXPORT_SYMBOL_GPL(__sock_recv_timestamp);
618
588static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock, 619static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock,
589 struct msghdr *msg, size_t size, int flags) 620 struct msghdr *msg, size_t size, int flags)
590{ 621{
@@ -1292,7 +1323,7 @@ asmlinkage long sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen)
1292 int err, fput_needed; 1323 int err, fput_needed;
1293 1324
1294 sock = sockfd_lookup_light(fd, &err, &fput_needed); 1325 sock = sockfd_lookup_light(fd, &err, &fput_needed);
1295 if(sock) { 1326 if (sock) {
1296 err = move_addr_to_kernel(umyaddr, addrlen, address); 1327 err = move_addr_to_kernel(umyaddr, addrlen, address);
1297 if (err >= 0) { 1328 if (err >= 0) {
1298 err = security_socket_bind(sock, 1329 err = security_socket_bind(sock,