[En-Nut-Discussion] MSS not calculated correctly
Thiago A. Corrêa
thiago.correa at gmail.com
Sun Apr 25 16:52:18 CEST 2010
Hi,
2010/4/25 Henrik Maier <hmnews at proconx.com>:
>
> /* Read MAXSEG option */
> case TCPOPT_MAXSEG:
> s = ((u_short)cp[2] << 8) | cp[3];
> if (s < sock->so_mss)
> sock->so_mss = s;
>
> Any thoughts/agreements/disagreements?
>
I think this would break any future little endian platform. I believe
the proper way should be to keep the ntohs call and remove the bit
shift:
/* Read MAXSEG option */
case TCPOPT_MAXSEG:
s = ntohs(*((u_short*)&cp[2]));
if (s < sock->so_mss)
sock->so_mss = s;
You could also make sure someone doesn't inject this bogus MSS value,
adding a check to make sure it's above 4.
> PS2: I am also not sure if topics like this should go to the mailing list or
> rather be lodged as bug report on SourceForge instead (or both)?
Both is cool, gives us a warning and an oportunity to discuss, the
bugtracker makes sure it's not forgotten :)
Kind Regards,
Thiago A. Correa
More information about the En-Nut-Discussion
mailing list