Commit 7436bcf6 authored by David Ward's avatar David Ward Committed by Greg Kroah-Hartman

net/ipv4: Ensure that location of timestamp option is stored

[ Upstream commit 4660c7f4 ]

This is needed in order to detect if the timestamp option appears
more than once in a packet, to remove the option if the packet is
fragmented, etc. My previous change neglected to store the option
location when the router addresses were prespecified and Pointer >
Length. But now the option location is also stored when Flag is an
unrecognized value, to ensure these option handling behaviors are
still performed.
Signed-off-by: default avatarDavid Ward <david.ward@ll.mit.edu>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1c93c2e7
...@@ -360,7 +360,6 @@ int ip_options_compile(struct net *net, ...@@ -360,7 +360,6 @@ int ip_options_compile(struct net *net,
} }
switch (optptr[3]&0xF) { switch (optptr[3]&0xF) {
case IPOPT_TS_TSONLY: case IPOPT_TS_TSONLY:
opt->ts = optptr - iph;
if (skb) if (skb)
timeptr = &optptr[optptr[2]-1]; timeptr = &optptr[optptr[2]-1];
opt->ts_needtime = 1; opt->ts_needtime = 1;
...@@ -371,7 +370,6 @@ int ip_options_compile(struct net *net, ...@@ -371,7 +370,6 @@ int ip_options_compile(struct net *net,
pp_ptr = optptr + 2; pp_ptr = optptr + 2;
goto error; goto error;
} }
opt->ts = optptr - iph;
if (rt) { if (rt) {
memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4); memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4);
timeptr = &optptr[optptr[2]+3]; timeptr = &optptr[optptr[2]+3];
...@@ -385,7 +383,6 @@ int ip_options_compile(struct net *net, ...@@ -385,7 +383,6 @@ int ip_options_compile(struct net *net,
pp_ptr = optptr + 2; pp_ptr = optptr + 2;
goto error; goto error;
} }
opt->ts = optptr - iph;
{ {
__be32 addr; __be32 addr;
memcpy(&addr, &optptr[optptr[2]-1], 4); memcpy(&addr, &optptr[optptr[2]-1], 4);
...@@ -418,12 +415,12 @@ int ip_options_compile(struct net *net, ...@@ -418,12 +415,12 @@ int ip_options_compile(struct net *net,
pp_ptr = optptr + 3; pp_ptr = optptr + 3;
goto error; goto error;
} }
opt->ts = optptr - iph;
if (skb) { if (skb) {
optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4);
opt->is_changed = 1; opt->is_changed = 1;
} }
} }
opt->ts = optptr - iph;
break; break;
case IPOPT_RA: case IPOPT_RA:
if (optlen < 4) { if (optlen < 4) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment