[Bug 210726] tcp connect() can return invalid EADDRINUSE (Eg: multiple jails with the same IP address)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 05 Apr 2022 02:17:31 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210726 --- Comment #26 from firk@cantconnect.ru --- Created attachment 232948 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=232948&action=edit patch for 12.x 13.x 14-CURRENT > connecting from an IPv6 address to an IPv4 one. How do you connect from IPv6 to IPv4? It giving me EINVAL (12.3) or EAFNOSUPPORT (14) when I try to call bind() or connect() with IPv4 address on IPv6 socket. And that's check at the very beginning of tcp6_usr_connect(): > if (nam->sa_family != AF_INET6) > return (EAFNOSUPPORT); > if (nam->sa_len != sizeof (*sin6)) > return (EINVAL); giving no chance to handle IPv4 address with it. Do you using jails? I found a way to still trigger EADDRINUSE from connect() from a jail in 12.3 and 14-CURRENT, may be that's your case: bind(fd,{0.0.0.0:0}) and then do connect (that's all for a pure IPv4 socket). Since the issue you linked contains "connect from wildcard IPv6", most likely it was really wildcard-bound IPv4 (because connecting from IPv6 to IPv4 is not possible at all). Adding a patch to fix that (that's the same patch that was posted 6 years ago but very slightly modified for freebsd 12+). -- You are receiving this mail because: You are on the CC list for the bug.