[Bug 51097] New: Listening on the same port on two different IPs does not work

WineHQ Bugzilla wine-bugs at winehq.org
Tue May 4 05:17:33 CDT 2021


https://bugs.winehq.org/show_bug.cgi?id=51097

            Bug ID: 51097
           Summary: Listening on the same port on two different IPs does
                    not work
           Product: Wine
           Version: unspecified
          Hardware: x86-64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: winsock
          Assignee: wine-bugs at winehq.org
          Reporter: stefan at codeweavers.com
      Distribution: ---

Creating two UDP sockets and binding them to the same port on different IP
addresses does not work. Only the last bound socket receives its packets while
the other's are silently discarded.

Description in pseudo code:

sock1 = socket(AF_INET, SOCK_DGRAM, 0);
sock2 = socket(AF_INET, SOCK_DGRAM, 0);

addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr("192.168.1.100");
addr.sin_port = htons(22222);
res = bind(sock1, &addr, sizeof(addr));

addr.sin_addr.s_addr = inet_addr("192.168.250.100");
res = bind(sock2, &addr, sizeof(addr));

Now put them into non-blocking mode and select() on them. Only sock1 will
receive something.

The cause is the custom BPF filter written to solve bug 7929. It binds both
ports to 0.0.0.0:22222 and sets up a custom filter to filter for
192.168.250.100 + 192.168.250.255 and 192.168.1.100 + 192.168.1.255
respectively. Packets received on 192.168.250.100 are evaluated by the filter
rule for sock1, found not matching and discarded without being evaluated for a
possible match on sock 2.

Disabling the custom filter rules and passing the actual IP addresses to Unix
bind() solves the problem but brings back the non-matching broadcast rules that
are at the heart of bug 7929.

-- 
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.



More information about the wine-bugs mailing list