lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] Dynamic MSS


From: Kjell Andersson XW (LI/EAB)
Subject: [lwip-devel] Dynamic MSS
Date: Fri, 9 Jan 2004 14:39:28 +0100

I'm implementing a way to dynamically set the MSS of a connection before it is 
established. As it is today it can only be configured at compile time using the 
TCP_MSS define. When searching through the code, TCP_MSS is only used on three 
places which should make the change small for what I need.

Two of the uses are in tcp.c. One in tcp_connect and one in tcp_alloc. Why is 
there one in tcp_connect anyway? If we remove that one, then the MSS can be set 
by a client program before the tcp_connect is called as long as the set MSS 
value is smaller than the defined TCP_MSS in lwipopts.h. Maybe a check against 
TCP_MSS in tcp_connect for the set pcb->mss could be added so that the user 
does not specify a too big value. This way the TCP_MSS in lwipopts.h would 
really mean the maximum MSS and the default value used if no other is specified 
by the user.

The second use of TCP_MSS is in tcp_in.c, in tcp_parseopt.

I propose changing the following lines:

        /* An MSS option with the right option length. */
        mss = (opts[c + 2] << 8) | opts[c + 3];
        pcb->mss = mss > TCP_MSS? TCP_MSS: mss;

to:

        /* An MSS option with the right option length. */
        mss = (opts[c + 2] << 8) | opts[c + 3];
        pcb->mss = mss > pcb_mss ? pcb_mss: mss;

since the MSS of a connection is never allowed to increase anyway.

Comments anyone?

 / Kjell





reply via email to

[Prev in Thread] Current Thread [Next in Thread]