Hi,

I was trying changing the MSS for outgoing TCP connections and I’ve found out 
that it doesn’t work. 

There is an old bug report marked as “fixed” but it seems that the bug is still 
there or it resurfaced.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=144000

Moreover, I have found that the behavior of setsockopt with TCP_MAXSEG is quite 
erratic,
returning “Invalid Argument” for no apparent reason.

What I am doing is:

socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
setsockopt(TCP_MAXSEG, mss)
connect()

If I run this on FreeBSD or Mac OS X I get this when specifying a MSS of 500:

# tcpdump -i bge0 -s 0 -vv tcp port 7
tcpdump: listening on bge0, link-type EN10MB (Ethernet), capture size 262144 
bytes
11:35:58.190148 IP (tos 0x0, ttl 64, id 23840, offset 0, flags [none], proto 
TCP (6), length 60)
    192.168.1.202.39340 > 192.168.1.205.echo: Flags [S], cksum 0x9012 
(correct), seq 1054345346, win 65535, options [mss 1460,nop,wscale 8,sackOK,TS 
val 850534213 ecr 0], length 0


I tried disabling MTU discovery (sysctl net.inet.tcp.path_mtu_discovery=0) just 
in case it interfered but the result is the same. 

Curiously, on FreeBSD I get “invalid argumenr” errors if I try a MSS value 
greater than net.inet.tcp.mssdflt. 

% ./tcpmss 192.168.1.205 7 535
Setting MSS to 535
Done
^C
% ./tcpmss 192.168.1.205 7 536
Setting MSS to 536
Done
^C
% ./tcpmss 192.168.1.205 7 537
Setting MSS to 537
setsockopt(): Invalid argument
% 


Running the same on Linux it works. Here I have set the MSS to 100. 

11:39:14.223116 IP (tos 0x0, ttl 64, id 18798, offset 0, flags [DF], proto TCP 
(6), length 60)
    192.168.1.194.46698 > 192.168.1.205.echo: Flags [S], cksum 0xce33 
(correct), seq 17987680, win 43600, options [mss 100,sackOK,TS val 960030412 
ecr 0,nop,wscale 10], length 0



Is the bug back or am I terribly wrong? 


Thanks!





Borja.





_______________________________________________
freebsd-net@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to