[Bug 59682] New: Windrose server: UDP bind to specific IPv4 behaves like 0.0.0.0%iface, causing wrong source IP and multihoming conflicts
http://bugs.winehq.org/show_bug.cgi?id=59682 Bug ID: 59682 Summary: Windrose server: UDP bind to specific IPv4 behaves like 0.0.0.0%iface, causing wrong source IP and multihoming conflicts Product: Wine Version: 11.0 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wineserver Assignee: wine-bugs@list.winehq.org Reporter: koekdendeniz@gmail.com Distribution: --- A Windows dedicated server application (WindroseServer-Win64-Shipping.exe) works correctly on native Windows, where binding to a specific IP via -Multihome=<IP> results in UDP sockets bound to that IP:PORT. Under Wine on Linux, the same server appears to bind correctly in Wine debug logs, but the resulting Linux UDP socket shows up as 0.0.0.0%iface:PORT instead of IP:PORT. This causes two problems: 1. Outgoing UDP replies use the wrong source IP (the host's main IP instead of the IP passed to -Multihome). 2. Multiple instances cannot use the same UDP port on different local IPs, because the socket effectively behaves like 0.0.0.0:PORT instead of IP_A:PORT and IP_B:PORT. Tested with: * host networking * multiple public IPv4 addresses assigned on the same host * command line using -Multihome=<IP> Expected result: UDP socket is bound to the specific IPv4 address, replies use that source IP, and multiple instances can bind the same UDP port on different local IPs. Actual result: UDP socket appears as 0.0.0.0%iface:PORT, replies use the wrong source IP, and same-port multi-IP hosting fails. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59682 Zeb Figura <z.figura12@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com Component|wineserver |winsock -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59682 Zeb Figura <z.figura12@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marisa.adinolfi@italtel.com --- Comment #1 from Zeb Figura <z.figura12@gmail.com> --- *** Bug 60025 has been marked as a duplicate of this bug. *** -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59682 Ken Sharp <imwellcushtymelike@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source Summary|Windrose server: UDP bind |IPv4 UDP bind always binds |to specific IPv4 behaves |to 0.0.0.0 |like 0.0.0.0%iface, causing | |wrong source IP and | |multihoming conflicts | URL| |https://web.archive.org/web | |/20190523161058/https://ipe | |rf.fr/download/windows/iper | |f-2.0.8-win32.zip Status|UNCONFIRMED |NEW CC| |imwellcushtymelike@gmail.co | |m Ever confirmed|0 |1 --- Comment #2 from Ken Sharp <imwellcushtymelike@gmail.com> --- Confirming with iperf 2.0.8 (source available) and Wine 11.13. Same app works as expected in Windows 10. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59682 Ken Sharp <imwellcushtymelike@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.winehq.org/show | |_bug.cgi?id=33008 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59682 --- Comment #3 from marisa <marisa.adinolfi@italtel.com> --- Root cause analysis (Wine 8.10, AlmaLinux 8, kernel 4.18 el8) The problem occurs specifically when multiple local IPs are configured on the SAME network interface and the app binds UDP sockets to different specific IPs on the same port. strace of wineserver during a bind to a specific IP (e.g. 10.5.87.4:5060): setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, "ens224") = -1 EPERM setsockopt(fd, SOL_IP, IP_UNICAST_IF, ...) = 0 setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, ...) = 0 bind(fd, {sin_port=htons(5060), sin_addr=0.0.0.0}) = -1 EADDRINUSE In server/sock.c, bind_to_interface() / bind_to_iface_name(): SO_BINDTODEVICE fails (no CAP_NET_RAW), but the fallback IP_UNICAST_IF + SO_ATTACH_FILTER succeeds, so bind_to_interface() returns success and the IOCTL_AFD_BIND handler replaces the address with INADDR_ANY. The interface-level restriction (BPF filter on ifindex) cannot distinguish between multiple IPs on the same interface. As a result every socket ends up bound to 0.0.0.0 on the same port, causing EADDRINUSE on the second bind and a wrong source IP on outgoing datagrams. Note: on this kernel SO_ATTACH_FILTER (classic cBPF via setsockopt) succeeds even with kernel.unprivileged_bpf_disabled=1, because that sysctl only affects eBPF via the bpf() syscall, not classic cBPF. Expected: a socket explicitly bound to a specific local IP should stay bound to that IP (Windows behaviour), so that multiple sockets can share the same UDP port on different local IPs of the same interface, and outgoing packets use the correct source IP. Workaround that confirms the diagnosis: forcing SO_ATTACH_FILTER / IP_UNICAST_IF to fail (so bind_to_interface() returns FALSE) makes Wine keep the specific IP; bind then works correctly. The only functional loss is broadcast reception on those sockets, which is irrelevant for unicast UDP (e.g. SIP). -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla