<div dir="ltr"><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 26, 2015 at 2:16 PM John Crispin <<a href="mailto:blogic@openwrt.org">blogic@openwrt.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
was about to merge this but then ... see inline<br>
<br>
On 02/10/2015 15:53, Javier Domingo Cansino wrote:<br>
> Signed-off-by: Javier Domingo Cansino <<a href="mailto:javierdo1@gmail.com" target="_blank">javierdo1@gmail.com</a>><br>
> ---<br>
> usock.c | 4 +++-<br>
> usock.h | 1 +<br>
> 2 files changed, 4 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/usock.c b/usock.c<br>
> index 6748ef3..3dd9957 100644<br>
> --- a/usock.c<br>
> +++ b/usock.c<br>
> @@ -42,6 +42,7 @@ static void usock_set_flags(int sock, unsigned int type)<br>
><br>
> static int usock_connect(int type, struct sockaddr *sa, int sa_len, int family, int socktype, bool server)<br>
> {<br>
> + const int one = 1;<br>
> int sock;<br>
><br>
> sock = socket(family, socktype, 0);<br>
> @@ -49,9 +50,10 @@ static int usock_connect(int type, struct sockaddr *sa, int sa_len, int family,<br>
> return -1;<br>
><br>
> usock_set_flags(sock, type);<br>
> + if (socktype != SOCK_STREAM && type & USOCK_BROADCAST)<br>
<br>
should it not be<br>
<br>
if (socktype == SOCK_DGRAM .... ?<br>
<br>
John<br></blockquote><div><br></div><div>It is more clear with your expression, they have the same effect anyway. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> + setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one));<br>
><br>
> if (server) {<br>
> - const int one = 1;<br>
> setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));<br>
><br>
> if (!bind(sock, sa, sa_len) &&<br>
> diff --git a/usock.h b/usock.h<br>
> index b0b952b..3471f2a 100644<br>
> --- a/usock.h<br>
> +++ b/usock.h<br>
> @@ -26,6 +26,7 @@<br>
> #define USOCK_NOCLOEXEC 0x0200<br>
> #define USOCK_NONBLOCK 0x0400<br>
> #define USOCK_NUMERIC 0x0800<br>
> +#define USOCK_BROADCAST 0x1000<br>
> #define USOCK_IPV6ONLY 0x2000<br>
> #define USOCK_IPV4ONLY 0x4000<br>
> #define USOCK_UNIX 0x8000<br>
><br>
</blockquote></div></div>