mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
net/tcp: fix TCP options processing
Current TCP code may miss an option if TCP_O_NOP option was used before it for proper aligning. Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
d580a013cc
commit
77da29b868
1 changed files with 4 additions and 2 deletions
|
@ -475,7 +475,7 @@ void tcp_parse_options(uchar *o, int o_len)
|
||||||
* NOPs are options with a zero length, and thus are special.
|
* NOPs are options with a zero length, and thus are special.
|
||||||
* All other options have length fields.
|
* All other options have length fields.
|
||||||
*/
|
*/
|
||||||
for (p = o; p < (o + o_len); p = p + p[1]) {
|
for (p = o; p < (o + o_len); ) {
|
||||||
if (!p[1])
|
if (!p[1])
|
||||||
return; /* Finished processing options */
|
return; /* Finished processing options */
|
||||||
|
|
||||||
|
@ -490,12 +490,14 @@ void tcp_parse_options(uchar *o, int o_len)
|
||||||
case TCP_O_TS:
|
case TCP_O_TS:
|
||||||
tsopt = (struct tcp_t_opt *)p;
|
tsopt = (struct tcp_t_opt *)p;
|
||||||
rmt_timestamp = tsopt->t_snd;
|
rmt_timestamp = tsopt->t_snd;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process optional NOPs */
|
/* Process optional NOPs */
|
||||||
if (p[0] == TCP_O_NOP)
|
if (p[0] == TCP_O_NOP)
|
||||||
p++;
|
p++;
|
||||||
|
else
|
||||||
|
p += p[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue