void *(*realloc)(void *ptr, size_t size));
 psmb_result_t psmb_set_pmtu(psmb_ctx_t *ctx, unsigned int pmtu);
 psmb_result_t psmb_set_port(psmb_ctx_t *ctx, unsigned short pmtu);
+psmb_result_t psmb_set_mgrp(psmb_ctx_t *ctx, struct {unsigned char _uc[16];} pfx, unsigned char bits);
 psmb_result_t psmb_open(psmb_ctx_t *ctx);
 void psmb_destroy(psmb_ctx_t *ctx);
 int psmb_getfd(psmb_ctx_t *ctx);
 
        }
        if (setsockopt(ctx->fd, SOL_SOCKET, SO_REUSEADDR,
                        &on, sizeof(on)) < 0) {
+               int sverr = errno;
                close(ctx->fd);
                ctx->fd = -1;
+               errno = sverr;
                return (psmb_result_t){PSMB_ERROR};
        }
        if (setsockopt(ctx->fd, IPPROTO_IPV6, IPV6_PKTINFO,
                        &on, sizeof(on)) < 0) {
+               int sverr = errno;
                close(ctx->fd);
                ctx->fd = -1;
+               errno = sverr;
                return (psmb_result_t){PSMB_ERROR};
        }
        if (bind(ctx->fd, (struct sockaddr *)&addr,
                        sizeof(struct sockaddr)) == -1) {
+               int sverr = errno;
                close(ctx->fd);
                ctx->fd = -1;
+               errno = sverr;
                return (psmb_result_t){PSMB_ERROR};
        }
        return (psmb_result_t){PSMB_OK};