From a8e5ec1ed734952452dde1fba33cc7be206cb28b Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Wed, 13 Mar 2019 16:02:17 +0100 Subject: [PATCH] fix types and options Signed-off-by: Eugene Crosser --- include/psmb.h | 2 +- src/psmb_priv.h | 4 ---- src/psmb_socket.c | 7 ++++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/include/psmb.h b/include/psmb.h index 8925aea..022d5b8 100644 --- a/include/psmb.h +++ b/include/psmb.h @@ -5,7 +5,7 @@ #include typedef struct _psmb_ctx psmb_ctx_t; -typedef struct _psmb_result psmb_result_t; +typedef struct _psmb_result { int code; } psmb_result_t; psmb_ctx_t *psmb_new(void); psmb_ctx_t *psmb_new_mm(void *(*malloc)(size_t size), diff --git a/src/psmb_priv.h b/src/psmb_priv.h index 517f0cf..5e3c2ad 100644 --- a/src/psmb_priv.h +++ b/src/psmb_priv.h @@ -38,10 +38,6 @@ struct _psmb_ctx { struct _msg incoming; }; -struct _psmb_result { - int code; -}; - #define LOG(ctx, ...) (*ctx->logf)(ctx->log_priv, __VA_ARGS__) #endif diff --git a/src/psmb_socket.c b/src/psmb_socket.c index 28344a7..538b87c 100644 --- a/src/psmb_socket.c +++ b/src/psmb_socket.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -102,7 +103,7 @@ psmb_result_t psmb_open(psmb_ctx_t *ctx) errno = EBUSY; return (psmb_result_t){PSMB_ERROR}; } - ctx->fd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_IPV6); + ctx->fd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (ctx->fd == -1) { int sverr = errno; LOG(ctx, LOG_ERR, "socket: %m"); @@ -118,7 +119,7 @@ psmb_result_t psmb_open(psmb_ctx_t *ctx) errno = sverr; return (psmb_result_t){PSMB_ERROR}; } - if (setsockopt(ctx->fd, IPPROTO_IPV6, IPV6_PKTINFO, + if (setsockopt(ctx->fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on)) < 0) { int sverr = errno; LOG(ctx, LOG_ERR, "setsockopt(..., IPV6_PKTINFO, ...): %m"); @@ -128,7 +129,7 @@ psmb_result_t psmb_open(psmb_ctx_t *ctx) return (psmb_result_t){PSMB_ERROR}; } if (bind(ctx->fd, (struct sockaddr *)&addr, - sizeof(struct sockaddr)) == -1) { + sizeof(struct sockaddr_in6)) == -1) { int sverr = errno; LOG(ctx, LOG_ERR, "bind(): %m"); close(ctx->fd); -- 2.39.2