/* Get a new flow ID */

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>

int s, r, l;

main() {
	if ((s = socket(AF_INET6, SOCK_STREAM, 0)) < 0) {
		perror("socket");
		exit(1);
	}
	l = sizeof(int);
	if (getsockopt(s, IPPROTO_IPV6, FLOW6_RAND, (char *)&r, &l) < 0) {
		perror("getsockopt");
		exit(1);
	}
	printf("IPv6 flowlabel random generator gives %d\n", r);
	exit(0);
}
