#include <netinet/in.h>
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),
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
+#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
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");
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");
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);