/* Make sure to use the correct group definitions as the older bitmask definitions for  */
int nl_socket_add_memberships(struct nl_sock *sk, int group,...)
/* Make sure to use the correct group definitions as the older bitmask definitions for  */
int nl_socket_add_memberships(struct nl_sock *sk, int group,...)
{
	int err;
	va_list ap;
	if (sk->s_fd == -1)
		return -NLE_BAD_SOCK;
	va_start(ap, group);
	while (group != 0) {
		if (group < 0)
			return -NLE_INVAL;
		err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP,
						 &group, sizeof(group));
		if (err < 0)
			return -nl_syserr2nlerr(errno);
		group = va_arg(ap, int);
	}
	va_end(ap);
	return 0;
}