From nobody Tue Apr 05 02:25:38 2022 X-Original-To: net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2EB621A990E0 for ; Tue, 5 Apr 2022 02:25:39 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KXWhf5tV2z3wWt for ; Tue, 5 Apr 2022 02:25:38 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EA2C1E01F for ; Tue, 5 Apr 2022 02:25:38 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 2352Pcbb035719 for ; Tue, 5 Apr 2022 02:25:38 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 2352Pc6e035718 for net@FreeBSD.org; Tue, 5 Apr 2022 02:25:38 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: net@FreeBSD.org Subject: [Bug 210726] tcp connect() can return invalid EADDRINUSE (Eg: multiple jails with the same IP address) Date: Tue, 05 Apr 2022 02:25:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: firk@cantconnect.ru X-Bugzilla-Status: Closed X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: karels@freebsd.org X-Bugzilla-Flags: mfc-stable12+ mfc-stable11- X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649125538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6zoaxgdaWEvhwXfermThd7Y8y4JCgkctfIUWJW/kfX8=; b=A3KI4GaiLs7I96hVQETxnWvaxGp02a799yrqQtC8BIz/yOQpaWejmjjfOz6zlCGwJkfzu2 Ygoqd60nfYigRc5qt486ch9g20j9OL0wMvIY5ALXoa0eFz4Mw0qvL55x2oYQNIZ9+ZpbKF CoGrZRgkLIMuTxWSfHX/is4EuGQIgPncIdlFoJW9up7gL6ZWXbVaeiF0E7JMkhOloiwZG7 IP0JvsQR4wULR3bYbrc6JA7RntXeJV6lv6REV+ome5vvdtO9d0qnb9t6AEPI9afi4t9oH9 RDIo15YTKi6RwxlVdVP/u4PMa3pb8wMtwwI1+7iwhHpMHzUmzEFZ3u/jpQWGjA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649125538; a=rsa-sha256; cv=none; b=vEUdJvFdMoSaFkWpoE4bkzx8sCTtq+KQ7fBsIX0Hw1b6JiQ+XWZtlNR4yZHxXOGb0cV6dJ mtd8L/can9WVNKpIIBIf39Sx8U36nEybna/9qSsqhpvJrYywJ7pgbcWv0dRG505W31lKT8 nCSc359nwVjzThtWrBOL6GDMaz8y6fY1Am6Be3E7eiqD8yJXemipQdJFexqRjc/3S+11Fq MTlfxLF88Cj2ODInbaSBL0Zdxsmads48m6i2GCTg1s8lgLKdOfrRZOvn4UgGscdwiEYNaP TUagbi63YFhSQFZNBITxRoolHYJJ5kWMjmNG92xDvZWPU2mNdUGuO4qH3m6kAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D210726 --- Comment #27 from firk@cantconnect.ru --- Created attachment 232951 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D232951&action= =3Dedit test program Test program First, reduce portrange to hit the problem faster: sysctl net.inet.ip.portrange.first=3D10000 sysctl net.inet.ip.portrange.last=3D10004 Compile: cc -o test test.c Open two screens, first: ./test 10 1.2.3.4 0.0.0.0 Second: jail / x your.real.ip.address csh cd /your/dir ./test 10 1.2.3.4 0.0.0.0 with unpatched system, second program will show (EADDRINUSE) > connect() error 48 (Address already in use) with patched, it will show the proper error (EADDRNOTAVAIL) > bind() error 49 (Can't assign requested address) --=20 You are receiving this mail because: You are on the CC list for the bug.=