Fix: Silence warning by casting *sin_addr to *sockaddr
[lttng-tools.git] / src / common / sessiond-comm / inet6.c
index 52e2f8e5853d9abdb6b6bc059998fb8a92e3057c..a29adad4214c941d3287c6dc7f6851559c2d8af5 100644 (file)
@@ -15,7 +15,7 @@
  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <assert.h>
 #include <limits.h>
 #include <stdio.h>
@@ -57,6 +57,7 @@ LTTNG_HIDDEN
 int lttcomm_create_inet6_sock(struct lttcomm_sock *sock, int type, int proto)
 {
        int val = 1, ret;
+       unsigned long timeout;
 
        /* Create server socket */
        if ((sock->fd = socket(PF_INET6, type, proto)) < 0) {
@@ -74,6 +75,17 @@ int lttcomm_create_inet6_sock(struct lttcomm_sock *sock, int type, int proto)
                PERROR("setsockopt inet6");
                goto error;
        }
+       timeout = lttcomm_get_network_timeout();
+       if (timeout) {
+               ret = lttcomm_setsockopt_rcv_timeout(sock->fd, timeout);
+               if (ret) {
+                       goto error;
+               }
+               ret = lttcomm_setsockopt_snd_timeout(sock->fd, timeout);
+               if (ret) {
+                       goto error;
+               }
+       }
 
        return 0;
 
@@ -89,7 +101,7 @@ int lttcomm_bind_inet6_sock(struct lttcomm_sock *sock)
 {
        int ret;
 
-       ret = bind(sock->fd, &sock->sockaddr.addr.sin6,
+       ret = bind(sock->fd, (const struct sockaddr *) &sock->sockaddr.addr.sin6,
                        sizeof(sock->sockaddr.addr.sin6));
        if (ret < 0) {
                PERROR("bind inet6");
This page took 0.024111 seconds and 4 git commands to generate.