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