DF-3309 / df3309.c
/* DF-3309: getsockopt(IPV6_MULTICAST_LOOP) echoes ip6_defmcasthlim when no * multicast options are attached (ip6_output.c:2511-2515 copy-paste bug). */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> int main(void) { int s = socket(AF_INET6, SOCK_DGRAM, 0); if (s < 0) { perror("socket"); exit(1); } unsigned int loop = 0xdeadbeef; socklen_t l = sizeof(loop); if (getsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &loop, &l) < 0) { perror("getsockopt"); exit(1); } printf("IPV6_MULTICAST_LOOP = %u (l=%u)\n", loop, (unsigned)l); return (loop == 1) ? 0 : 2; /* 1 == IPV6_DEFAULT_MULTICAST_LOOP */ } |