From owner-freebsd-net@freebsd.org Fri Jan 17 09:36:49 2020 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02D11228867 for ; Fri, 17 Jan 2020 09:36:49 +0000 (UTC) (envelope-from vas@sibptus.ru) Received: from admin.sibptus.ru (admin.sibptus.ru [IPv6:2001:19f0:5001:21dc::10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47zbYX0Yhbz4HP7; Fri, 17 Jan 2020 09:36:47 +0000 (UTC) (envelope-from vas@sibptus.ru) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sibptus.ru; s=20181118; h=In-Reply-To:Message-ID:Subject:To:From:Date; bh=s7zjizpx1IDCt9wWx9rtEVLTkL4XrWP7Ci9lMzakVJE=; b=gB1yvi0AprdfmlbniQGqnDlwXE hrWOlr90/+Pjl8b/P9X2w0PV5WYh89Bx9EeUCtRC/offonsBWUuh4Yg8OmMnVolCMoIQyGVlj3V1O NfGPASLl/JlTTjDx2tL6DbB1CFadgKv/G5fbXrELL0mMww9AUtWXq9d5Xv8vMS4jCJy8=; Received: from vas by admin.sibptus.ru with local (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1isO3Z-000E3S-6o; Fri, 17 Jan 2020 16:36:45 +0700 Date: Fri, 17 Jan 2020 16:36:45 +0700 From: Victor Sudakov To: Eugene Grosbein Cc: freebsd-net@freebsd.org, "Andrey V. Elsukov" , Michael Tuexen Subject: Re: IPSec transport mode, mtu, fragmentation... Message-ID: <20200117093645.GA51899@admin.sibptus.ru> References: <20191220152314.GA55278@admin.sibptus.ru> <4cc83b85-dd30-8c0d-330e-aa549ce98c98@yandex.ru> <20200116155305.GA465@admin.sibptus.ru> <55f7bafa-24c4-9810-0d21-f82cb332ee2d@grosbein.net> <20200116160745.GA1356@admin.sibptus.ru> <72355e03-1cf8-c58f-3aec-b0a21e631870@grosbein.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="d6Gm4EdcadzBjdND" Content-Disposition: inline In-Reply-To: <72355e03-1cf8-c58f-3aec-b0a21e631870@grosbein.net> X-PGP-Key: http://admin.sibptus.ru/~vas/ X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 X-Rspamd-Queue-Id: 47zbYX0Yhbz4HP7 X-Spamd-Bar: -------- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=sibptus.ru header.s=20181118 header.b=gB1yvi0A; dmarc=pass (policy=none) header.from=sibptus.ru; spf=pass (mx1.freebsd.org: domain of vas@sibptus.ru designates 2001:19f0:5001:21dc::10 as permitted sender) smtp.mailfrom=vas@sibptus.ru X-Spamd-Result: default: False [-8.41 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[sibptus.ru:s=20181118]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; IP_SCORE(-3.31)[ip: (-9.89), ipnet: 2001:19f0:5000::/38(-4.94), asn: 20473(-1.69), country: US(-0.05)]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[sibptus.ru:+]; DMARC_POLICY_ALLOW(-0.50)[sibptus.ru,none]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5000::/38, country:US]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2020 09:36:49 -0000 --d6Gm4EdcadzBjdND Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Eugene Grosbein wrote: >=20 > >>> What beats me is that I cannot reproduce this problem in bhyve. In th= is > >>> packet dump: http://admin.sibptus.ru/~vas/ipsec1.pcap.gz I'm scp-ing a > >>> 50M file from 192.168.246.10 (bhyve guest) to 192.168.246.1 (bhyve > >>> host), and I see no fragments, and the largets packet is 1466 bytes, = and > >>> the scp never stalls nor fails. > >>> > >>> Why is it NOT broken this time? > >>> > >>> Both hosts are 12.1-RELEASE-p1. > >> > >> I could not reproduce the problem with unpatched recent stable/11, eit= her :-) > >=20 > > Is there a way to view the MSS in the TCP segments before encryption or > > after decryption? I want to compare them in situations with IPSec > > enabled and disabled. > >=20 > > I've never been able to see anything in "tcpdump -i enc0", probably it > > cannot do transport mode IPSec because the man page talks about "outer > > and inner header." >=20 > enc0 does what you need but before you use it, remember: >=20 > 1) before starting, you better change sysctls to: >=20 > net.enc.in.ipsec_filter_mask=3D0 > net.enc.out.ipsec_filter_mask=3D0 >=20 > so using enc0 does not pass packets over netpfilter rules extra time; >=20 > 2) don't forget: ifconfig enc0 up Perhaps I was forgetting some of those steps previously, because this time I got the desired traffic from enc0.=20 >=20 > 3) tcpdump has no means to filter by inner attributes in case of tunnel m= ode; > it still shows decoded IPSec transport mode packets correctly. Most importantly, Wireshark recognizes it as "Encapsulation type: OpenBSD enc(4) encapsulating interface" and shows the contents correctly. Back to the point. I've figured out that both encrypted (in transport mode) and unencrypted TCP segments have the same MSS=3D1460. Then I'm completely at a loss how the encrypted packets avoid being fragmented. TCP has no way to know in advance that encryption overhead will be added. --=20 Victor Sudakov, VAS4-RIPE, VAS47-RIPN 2:5005/49@fidonet http://vas.tomsk.ru/ --d6Gm4EdcadzBjdND Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJeIYAtAAoJEA2k8lmbXsY0/YUIAJlPiqAcUg7lzK50R2m20g+u nNTC+XBgaC56YkYWZtQXxLTNrZPbgXsUHdJXPiUnqQM6lWTWZ0nTdpy7PC9H0PgZ ZmeoXHzh+oKqT+Y5mWwylisGoqFetExkpE2prGp8u73y36N4VTJU4PSRBl0hAkz+ 4dG4xuNz8ZDql7QnPiEQZe5KY9BNC73Wl/2bZw19XfMdKMJ8rEHrUbA66skKVXxi 1xQeRjXiZpv38UwWc1UZ4AkYlNpkuLCXukEKkJFnF+7NtKE9hOIOqW2can07W0yY k6LbY62azEgrJEpa7E+mAChotX+Z2h3r4VNUV2u7za8WjfP2uFBmugxxRbvymSM= =LK9w -----END PGP SIGNATURE----- --d6Gm4EdcadzBjdND--