Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2022 21:35:05 +0000
From:      bugzilla-noreply@freebsd.org
To:        net@FreeBSD.org
Subject:   [Bug 265064] connect(2): unexpected EADDRINUSE when connecting from IPv6 wildcard to IPv4 address
Message-ID:  <bug-265064-7501-yvxEHgeOFU@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-265064-7501@https.bugs.freebsd.org/bugzilla/>
References:  <bug-265064-7501@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D265064

--- Comment #6 from Mike Karels <karels@freebsd.org> ---
(In reply to firk from comment #5)

> No, wildcard ipv6 bind() shouldn't fail just because ipv4 port
> for the specifiec ipv4 address is busy.

There is nothing specific in this bind() call.  The address is ANY and the =
port
is zero.  Also, the application has cleared the IPV6_ONLY option, specifica=
lly
enabling IPv4.  It seems far better to allocate a port that can work for IP=
v4
as well as IPv6 in this case.  My in-progress change modifies only that
situation.  Hopefully I'll be ready to circulate the change soon.

> I'm not sure how this error should be reported to userland, but it surely
> shouldn't be triggered until we try to connect() to ipv6-wrapped ipv4 add=
ress.
> May be it will be okay to return EADDRNOTAVAIL from such connect(), consi=
dering
> wildcard-bound socket as partially unbound socket as we really have to do
> new ipv4-bind() over existing ipv6-wildcard-bind.

We can't do a new bind() for IPv4; ports are immutable once bound.  Note th=
at
the application could have skipped the bind() call, in which case connect()=
 can
do the right thing.  But this procedure should also work.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-265064-7501-yvxEHgeOFU>