On Tuesday, December 22, 2015, Bruno Jesus <<a href="mailto:00cpxxx@gmail.com">00cpxxx@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Dec 22, 2015 at 7:58 PM, Hans Leidekker <<a href="javascript:;" onclick="_e(event, 'cvml', 'hans@codeweavers.com')">hans@codeweavers.com</a>> wrote:<br>
> Hi Bruno,<br>
>>+        if (wsa->addr->sa_family == WS_AF_INET)<br>
>>+        {<br>
>>+            /* When the target IPv4 address ends in 255 we must always send it as<br>
>>+             * a broadcast. Trying to send the packet without setting SO_BROADCAST<br>
>>+             * results in EACCES, to avoid that we will manually enable the flag<br>
>>+             * and send the packet, after that we will restore the disabled flag<br>
>>+             * behavior. This is the most common estimate as the broadcast address<br>
>>+             * should actually be calculated using the netmask for the interface. */<br>
><br>
> It should really be calculated using the netmask, sending a broadcast packet here<br>
> is wrong if the user is not in a /24 network.<br>
<br>
<br>
Hi, Hans. Thanks for the reply, I'll update the patch when I have time.<br>
</blockquote><div><br></div><div>Actually I have no idea how to do this because I would have to check every UDP packet destination against all configured IP broadcast address, this would slow down too much.</div><div><br></div><div>And caching the broadcast addresses would introduce the problem of watching for network changes.</div><div><br></div><div>I believe that the current solution is ok for most use cases and I don't know if it is an issue to attempt a broadcast to a non broadcast address, I have to check that.</div><div><br></div><div>Or I am missing something obvious that someone will tell me in the next reply ;-)</div><div><br></div><div>Best wishes, </div><div>Bruno </div>