aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_options.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ip_options.c')
-rw-r--r--net/ipv4/ip_options.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index bd246792360b..4d158ff1def1 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -58,10 +58,9 @@ void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
58 if (opt->ts_needaddr) 58 if (opt->ts_needaddr)
59 ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, skb, rt); 59 ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, skb, rt);
60 if (opt->ts_needtime) { 60 if (opt->ts_needtime) {
61 struct timespec tv;
62 __be32 midtime; 61 __be32 midtime;
63 getnstimeofday(&tv); 62
64 midtime = htonl((tv.tv_sec % 86400) * MSEC_PER_SEC + tv.tv_nsec / NSEC_PER_MSEC); 63 midtime = inet_current_timestamp();
65 memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4); 64 memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4);
66 } 65 }
67 return; 66 return;
@@ -415,11 +414,10 @@ int ip_options_compile(struct net *net,
415 break; 414 break;
416 } 415 }
417 if (timeptr) { 416 if (timeptr) {
418 struct timespec tv; 417 __be32 midtime;
419 u32 midtime; 418
420 getnstimeofday(&tv); 419 midtime = inet_current_timestamp();
421 midtime = (tv.tv_sec % 86400) * MSEC_PER_SEC + tv.tv_nsec / NSEC_PER_MSEC; 420 memcpy(timeptr, &midtime, 4);
422 put_unaligned_be32(midtime, timeptr);
423 opt->is_changed = 1; 421 opt->is_changed = 1;
424 } 422 }
425 } else if ((optptr[3]&0xF) != IPOPT_TS_PRESPEC) { 423 } else if ((optptr[3]&0xF) != IPOPT_TS_PRESPEC) {