From owner-freebsd-hackers Tue Jan 27 12:40:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA03923 for hackers-outgoing; Tue, 27 Jan 1998 12:40:05 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from schubert.promo.de (schubert.Promo.DE [194.45.188.65]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA03873 for ; Tue, 27 Jan 1998 12:39:50 -0800 (PST) (envelope-from stefan@promo.de) Received: from stefan.promo.de (stefan.Promo.DE [194.45.188.81]) by schubert.promo.de (8.8.8/8.8.8) with SMTP id VAA25385; Tue, 27 Jan 1998 21:27:10 +0100 (MET) Date: Tue, 27 Jan 1998 21:29:07 +0100 From: "Stefan Bethke" To: "Niall Smart" cc: hackers@FreeBSD.ORG Subject: Re: TCP_MAXSEG and path MTU discovery Message-ID: <2507803.3094925347@stefan.promo.de> X-Mailer: Mulberry Demo (MacOS) [1.4.0a1, s/n Evaluation] X-Licensed-To: Unlicensed - for evaluation only MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk --On Die, 27. Jan 1998 19:10 Uhr +0000 "Niall Smart" wrote: > if (setsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, &opt, optlen) < 0) > perror("setsockopt"), exit(1); > > if (connect(fd, (struct sockaddr*) &sin, sizeof(sin)) < 0) > perror("connect"), exit(1); > With argv[3] == "300", I'm getting this, 146.169.50.56 being my host. > > 19:04:07.726242 146.169.50.56.1171 > 146.169.46.7.21: S 1185413053:1185413053(0) win 16384 (DF) > 19:04:07.728505 146.169.46.7.21 > 146.169.50.56.1171: S 4095294624:4095294624(0) ack 1185413054 win 8760 (DF) > 19:04:07.728603 146.169.50.56.1171 > 146.169.46.7.21: . ack 4095294625 win 17520 (DF) > > What happened to my maximum segment size?? (Yes, the program prints 1460) Quoting from Stevens, TCP/IP Illustrated, Vol. II, pp. 1022: TCP_MAXSEG option [...] When a SYN is received from the other end with a MSS option, tcp_input calls tcp_mss, and t_maxseg can be set as high as the outgoing interface MTU. [1460 for Ethernet ...] Therefore, after a call to socket but before a connection is established, a process can only decrease the MSS from its default of 512. After a connection is established, the process can decrease the MSS from whatever was selected by tcp_mss. The logic here seems to be that a SYN with MSS is the equivalent of a setsockopt(TCP_MAXSEG). I've haven't read enought to say *why* this is useful, and Net/3 even doesn't include path MTU discovery, so Stevens doesn't explain it's implementation. Stefan -- Stefan Bethke Promo Datentechnik | Tel. +49-40-851744-18 + Systemberatung GmbH | Fax. +49-40-851744-44 Eduardstrasse 46-48 | e-mail: stefan@Promo.DE D-20257 Hamburg | http://www.Promo.DE/