From nobody Tue Aug 02 14:51:33 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 4LxycP5g3Hz4YJ8W for ; Tue, 2 Aug 2022 14:51:33 +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 4LxycP3G9Lz3dts for ; Tue, 2 Aug 2022 14:51:33 +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 4LxycP2HzFzGtp for ; Tue, 2 Aug 2022 14:51:33 +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 272EpXvI042620 for ; Tue, 2 Aug 2022 14:51:33 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 272EpXvU042619 for net@FreeBSD.org; Tue, 2 Aug 2022 14:51:33 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: net@FreeBSD.org Subject: [Bug 265064] connect(2): unexpected EADDRINUSE when connecting from IPv6 wildcard to IPv4 address Date: Tue, 02 Aug 2022 14:51:33 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: net@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=1659451893; 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=GR9n0mH6L9+zJpdxFaqYy8CJRSOde7owxLIJvZHobTA=; b=NpKmUh5G3zcIJZE7HQW2WfJavvAqEXrmrTi+u3HV8YMPJVp03vlp29oPj2xtTkzItobtIq XHlqRQtfUuiK1kOOcqXQ+WWE8cdGBge57kROP0rQevFDRD9XHgHrctpiAnXAlkSL865EIb T9Ea2Rp+l2tHRueKjLm323Z+mn3eCJtSIPZHIehvDTDqlCIK5T2yQj+A1fAEXd3zBjYzxa 0Xc/2JBxT8+h3cXnQygCuIYBJP7061YSFw8aO6RNXD0OMXe0ky8uSZGqQaHekHAHF0OWyj q9Hn5jOgu6q9zLlWWsX8Qo5enbFKo0SSSmG102fh9VblToN9uaBJK45I5+Mmhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659451893; a=rsa-sha256; cv=none; b=Nj98+N4PUE7RpGLeKg4iN1Q0AyvAbrjfC3MhuOeuprPlLfIwEx+R6OikUYyo/IMNUDESUO 3HERjQgtkpRRjMssLSsnsHtWkywIhYRdlbtP7Z1gHV2qeDS7addaRovUJamLX1FTmuf+9D ipO8R/Tb01I6z2bwUnwWFSF6/zp3iPGb7hzrqHDmZ11956h4kdu02NSs9XsylwjoM1CQ0j AOdTFVYc7V9FVIFk5btnzPEXoZ9DQo7o2HNbQ0rITrLGXxFXyz6HSV/oCUeRe/3dRS9oMJ /yritWkYZC+iM4jPLHW7cMO96fR8LCzv+D/IbzYF5TWo9IJTzWFP1cCInzZT5w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D265064 --- Comment #15 from commit-hook@FreeBSD.org --- A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D637f317c6d9c0c689677f499fc78ac545= b192071 commit 637f317c6d9c0c689677f499fc78ac545b192071 Author: Mike Karels AuthorDate: 2022-07-29 14:23:23 +0000 Commit: Mike Karels CommitDate: 2022-08-02 14:49:46 +0000 IPv6: fix problem with duplicate port assignment with v4-mapped addrs In in_pcb_lport_dest(), if an IPv6 socket does not match any other IPv6 socket using in6_pcblookup_local(), and if the socket can also connect to IPv4 (the INP_IPV4 vflag is set), check for IPv4 matches as well. Otherwise, we can allocate a port that is used by an IPv4 socket (possibly one created from IPv6 via the same procedure), and then connect() can fail with EADDRINUSE, when it could have succeeded if the bound port was not in use. PR: 265064 Submitted by: firk at cantconnect.ru (with modifications) Reviewed by: bz, melifaro Differential Revision: https://reviews.freebsd.org/D36012 sys/netinet/in_pcb.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --=20 You are receiving this mail because: You are the assignee for the bug.=