net: ipv4: Convert IP network timestamps to be y2038 safe
commitb11e1542feca30e7ea0baf1b412e44e7b27f93c2
authorDeepa Dinamani <deepa.kernel@gmail.com>
Sat, 27 Feb 2016 08:32:15 +0000 (27 00:32 -0800)
committerSasha Levin <alexander.levin@verizon.com>
Fri, 13 Jan 2017 17:21:08 +0000 (13 12:21 -0500)
treed98cf41225b8c98891fc34bb438bd13b59a6fe74
parent5023ae270216fd980d51770aec1806acaf90846c
net: ipv4: Convert IP network timestamps to be y2038 safe

[ Upstream commit 822c868532cae2cc1c51f4f18ab61c194d98aaf6 ]

ICMP timestamp messages and IP source route options require
timestamps to be in milliseconds modulo 24 hours from
midnight UT format.

Add inet_current_timestamp() function to support this. The function
returns the required timestamp in network byte order.

Timestamp calculation is also changed to call ktime_get_real_ts64()
which uses struct timespec64. struct timespec64 is y2038 safe.
Previously it called getnstimeofday() which uses struct timespec.
struct timespec is not y2038 safe.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: James Morris <jmorris@namei.org>
Cc: Patrick McHardy <kaber@trash.net>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
include/net/ip.h
net/ipv4/af_inet.c
net/ipv4/icmp.c
net/ipv4/ip_options.c