Networking Forums

Networking Forums > Computer Networking > Linux Networking > decreasing MAXSEG (MSS)

Reply
Thread Tools Display Modes

decreasing MAXSEG (MSS)

 
 
vishal...@gmail.com
Guest
Posts: n/a

 
      04-06-2006, 12:22 AM
Hello:

I have a question on setting MSS (MAXSEG option):

--[client-program....code-snip]
---------------------------------------------------------------------------------

sockfd = socket(AF_INET, SOCK_STREAM, 0);
maxseg = 0;
maxseg_len = sizeof (maxseg);
getsockopt(sockfd, IPPROTO_TCP, TCP_MAXSEG, &maxseg, &maxseg_len);

maxseg = 1024;
setsockopt(sockfd, IPPROTO_TCP, TCP_MAXSEG, &maxseg, maxseg_len)

connect (.....)
.....
--------------------------------------------------------------------------------------------------------

Using TCPDUMP, I notice that the MSS value sent by my client m/c (with
above code) is still 1460...
(not *1024*, as I would expect).

Does anyone know if there is something else to be done to decrease the
MSS value

I have tried this on Linux 2.6.5-1.358 and Linux 2.4.20.

Thanks in advance,
Vishal.

 
Reply With Quote
 
 
 
 
Rick Jones
Guest
Posts: n/a

 
      04-06-2006, 12:37 AM
vishal...@gmail.com <(E-Mail Removed)> wrote:
> maxseg = 0;
> maxseg_len = sizeof (maxseg);
> getsockopt(sockfd, IPPROTO_TCP, TCP_MAXSEG, &maxseg, &maxseg_len);


> maxseg = 1024;
> setsockopt(sockfd, IPPROTO_TCP, TCP_MAXSEG, &maxseg, maxseg_len)


I know it is a pedantic question, but are you sure the setsockopt()
returned success?

Do you have another getsockopt() call after it to retrieve the value
again?

Just a really wild guess, and likely wrong, perhaps setting the MSS is
a priviledged operation and regular userids cannot do it?

The manpage for TCP doesn't say anything about priviledge though:

TCP_MAXSEG
The maximum segment size for outgoing TCP packets. If this
option is set before connection establishment, it also changes
the MSS value announced to the other end in the initial packet.
Values greater than the (eventual) interface MTU have no effect.
TCP will also impose its minimum and maximum bounds over the
value provided.


Also, if you intend your code to be portable, keep in mind that not
all stacks actually allow the application to set the MSS, only to
retrieve it.

rick jones
--
The glass is neither half-empty nor half-full. The glass has a leak.
The real question is "Can it be patched?"
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
 
Reply With Quote
 
vishal...@gmail.com
Guest
Posts: n/a

 
      04-06-2006, 01:52 AM
I didn't cut-paste the whole thing...but yes:
I do check for the return status of setsockopt () and it is success.
Also, getsockopt(MAXSEG) (after setsockopt(MAXSEG)) returns the 1024.
I am running the program as "root".

Not sure if there is anything else missing ... could somone please
provide
some pointers.

Thanks,
Vishal.

 
Reply With Quote
 
Rick Jones
Guest
Posts: n/a

 
      04-06-2006, 05:48 PM
vishal...@gmail.com <(E-Mail Removed)> wrote:
> I didn't cut-paste the whole thing...but yes:
> I do check for the return status of setsockopt () and it is success.
> Also, getsockopt(MAXSEG) (after setsockopt(MAXSEG)) returns the 1024.
> I am running the program as "root".


> Not sure if there is anything else missing ... could somone please
> provide some pointers.


Well, the manpage did suggest there were limits applied, and there is
always the prospect of a bug, so an examination of the stack's source
code may be inorder.

Lets back-up a bit first though - why do you want to set the MSS to
1024 bytes? What issue are you trying to resolve?

rick jones
--
oxymoron n, commuter in a gas-guzzling luxury SUV with an American flag
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
 
Reply With Quote
 
vishal...@gmail.com
Guest
Posts: n/a

 
      04-06-2006, 11:01 PM
I want to test whether my TCP stack abides by MSS advertised by the
peer. Hence, thought of decreasing MSS from the peer to see how my TCP
behaves.

 
Reply With Quote
 
Rick Jones
Guest
Posts: n/a

 
      04-06-2006, 11:38 PM
vishal...@gmail.com <(E-Mail Removed)> wrote:
> I want to test whether my TCP stack abides by MSS advertised by the
> peer. Hence, thought of decreasing MSS from the peer to see how my TCP
> behaves.


You might try setting, on the linux system, a route PMTU on a specific
hostroute for the IP on which your TCP stack resides. Or, if you know
that it is only for testing and there isn't much else going-on, you
could simply change the interface MTU on the linux system for the
duration of your test.

rick jones
--
oxymoron n, commuter in a gas-guzzling luxury SUV with an American flag
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
O2 and BE Broadbands buck trend with decreasing speeds: Al Bowlly Broadband 15 01-08-2010 03:47 PM
The ever decreasing circles syndrome & wireless networking! David W Allen Wireless Networks 9 11-18-2004 10:57 AM



1 2 3 4 5 6 7 8 9 10 11