[Bug 279881] socket support for IPv4-mapped IPv6 misbehave

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 21 Jun 2024 12:41:08 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279881

--- Comment #2 from Andrey V. Elsukov <ae@FreeBSD.org> ---
So, I used attached test program:

% clang main.c -o test
% sudo ifconfig lo0 inet 10.0.0.1/24 alias
% ./test
main:74: sysctlbyname(net.inet6.ip6.v6only) = 1
test:29: socket fd = 3
test:35: getsockopt(IPV6_V6ONLY) = 1
test:41: setsockopt(IPV6_V6ONLY) -> 0
test:58: connect(::ffff:10.0.0.2) -> 0
test:60: ----------
test:29: socket fd = 3
test:35: getsockopt(IPV6_V6ONLY) = 1
test:56: connect(::ffff:10.0.0.2): Invalid argument
test:60: ----------
% sudo sysctl net.inet6.ip6.v6only=0
net.inet6.ip6.v6only: 1 -> 0
% ./test
main:74: sysctlbyname(net.inet6.ip6.v6only) = 0
test:29: socket fd = 3
test:35: getsockopt(IPV6_V6ONLY) = 0
test:58: connect(::ffff:10.0.0.2) -> 0
test:60: ----------
test:29: socket fd = 3
test:35: getsockopt(IPV6_V6ONLY) = 0
test:41: setsockopt(IPV6_V6ONLY) -> 1
test:56: connect(::ffff:10.0.0.2): Invalid argument
test:60: ----------

1. As you can see, getsockopt() returns default value of socket option, that
depends on sysctl variable.
2. Depending on V6ONLY sockopt your app can or can not connect.

Probably your problem is python related.

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