/* * Pack all accumulated options into Buffer "buf" */ int job_options_pack (job_options_t opts, Buf buf) { uint32_t count = 0; ListIterator i; struct job_option_info *opt; packstr (JOB_OPTIONS_PACK_TAG, buf); if (opts == NULL) { pack32 (0, buf); return (0); } xassert (opts->magic == JOB_OPTIONS_MAGIC); xassert (opts->options != NULL); xassert (opts->iterator != NULL); count = list_count (opts->options); pack32 (count, buf); i = list_iterator_create (opts->options); while ((opt = list_next (i))) job_option_info_pack (opt, buf); list_iterator_destroy (i); return (count); }
ssh_string SshAgentSignEd25519(uint8_t* data, int dataSize, ssh_key key, uint32_t flags) { // Prepare a buffer for the signature in a blob of the form: // blobLength[ typeNameLength[ typeName ] signatureLength[ signature ] ] uint32_t typeNameLength = 11; unsigned long long signatureLength = dataSize + 64; uint32_t blobLength = 8 + typeNameLength + (uint32_t)signatureLength; uint8_t* signature = malloc(blobLength + 4); if (signature == NULL) { return NULL; } // Sign the data in place in the blob buffer. int signatureIndex = 12 + typeNameLength; int result = crypto_sign_ed25519(signature + signatureIndex, &signatureLength, data, dataSize, (uint8_t*)key->ed25519_privkey); if (result != 0) { free(signature); return NULL; } // Recalculate the blob length now that we have the final length of the ED25519 signature and format the rest of the blob. blobLength = 8 + typeNameLength + (uint32_t)signatureLength; pack32(signature, blobLength); int index = 4; pack32(signature + index, typeNameLength); index += 4; memcpy(signature + index, "ssh-ed25519", typeNameLength); index += typeNameLength; pack32(signature + index, (uint32_t)signatureLength); return (ssh_string)signature; }
/* * Pack current burst buffer state information for network transmission to * user (e.g. "scontrol show burst") * * Returns a SLURM errno. */ extern int bb_p_state_pack(uid_t uid, Buf buffer, uint16_t protocol_version) { uint32_t rec_count = 0; int eof, offset; pthread_mutex_lock(&bb_state.bb_mutex); packstr(bb_state.name, buffer); offset = get_buf_offset(buffer); pack32(rec_count, buffer); bb_pack_state(&bb_state, buffer, protocol_version); if (bb_state.bb_config.private_data == 0) uid = 0; /* User can see all data */ rec_count = bb_pack_bufs(uid, bb_state.bb_hash,buffer,protocol_version); if (rec_count != 0) { eof = get_buf_offset(buffer); set_buf_offset(buffer, offset); pack32(rec_count, buffer); set_buf_offset(buffer, eof); } if (bb_state.bb_config.debug_flag) { debug("%s: %s: record_count:%u", plugin_type, __func__, rec_count); } pthread_mutex_unlock(&bb_state.bb_mutex); return SLURM_SUCCESS; }
extern void pack_slurm_step_layout(slurm_step_layout_t *step_layout, Buf buffer, uint16_t protocol_version) { uint32_t i = 0; if (protocol_version >= SLURM_2_3_PROTOCOL_VERSION) { if (step_layout) i=1; pack16(i, buffer); if (!i) return; packstr(step_layout->front_end, buffer); packstr(step_layout->node_list, buffer); pack32(step_layout->node_cnt, buffer); pack32(step_layout->task_cnt, buffer); pack16(step_layout->task_dist, buffer); for (i=0; i<step_layout->node_cnt; i++) { pack32_array(step_layout->tids[i], step_layout->tasks[i], buffer); } } else { error("pack_slurm_step_layout: protocol_version " "%hu not supported", protocol_version); } }
/* * _dump_part_state - dump the state of a specific partition to a buffer * IN part_ptr - pointer to partition for which information * is requested * IN/OUT buffer - location to store data, pointers automatically advanced */ static void _dump_part_state(struct part_record *part_ptr, Buf buffer) { xassert(part_ptr); if (default_part_loc == part_ptr) part_ptr->flags |= PART_FLAG_DEFAULT; else part_ptr->flags &= (~PART_FLAG_DEFAULT); packstr(part_ptr->name, buffer); pack32(part_ptr->grace_time, buffer); pack32(part_ptr->max_time, buffer); pack32(part_ptr->default_time, buffer); pack32(part_ptr->max_nodes_orig, buffer); pack32(part_ptr->min_nodes_orig, buffer); pack16(part_ptr->flags, buffer); pack16(part_ptr->max_share, buffer); pack16(part_ptr->preempt_mode, buffer); pack16(part_ptr->priority, buffer); pack16(part_ptr->state_up, buffer); packstr(part_ptr->allow_groups, buffer); packstr(part_ptr->allow_alloc_nodes, buffer); packstr(part_ptr->alternate, buffer); packstr(part_ptr->nodes, buffer); }
extern int slurm_ckpt_pack_job(check_jobinfo_t jobinfo, Buf buffer, uint16_t protocol_version) { struct check_job_info *check_ptr = (struct check_job_info *)jobinfo; if (protocol_version >= SLURM_MIN_PROTOCOL_VERSION) { uint32_t x; uint32_t y; uint32_t z; uint32_t size; size = 0; pack16(CHECK_POE, buffer); x = get_buf_offset(buffer); pack32(size, buffer); y = get_buf_offset(buffer); pack16(check_ptr->disabled, buffer); pack16(check_ptr->node_cnt, buffer); pack16(check_ptr->reply_cnt, buffer); pack16(check_ptr->wait_time, buffer); pack32(check_ptr->error_code, buffer); packstr(check_ptr->error_msg, buffer); pack_time(check_ptr->time_stamp, buffer); z = get_buf_offset(buffer); set_buf_offset(buffer, x); pack32(z - y, buffer); set_buf_offset(buffer, z); } return SLURM_SUCCESS; }
static int _pack_coll_ring_info(pmixp_coll_t *coll, pmixp_coll_ring_msg_hdr_t *ring_hdr, Buf buf) { pmixp_proc_t *procs = coll->pset.procs; size_t nprocs = coll->pset.nprocs; uint32_t type = PMIXP_COLL_TYPE_FENCE_RING; int i; /* 1. store the type of collective */ pack32(type, buf); /* 2. Put the number of ranges */ pack32(nprocs, buf); for (i = 0; i < (int)nprocs; i++) { /* Pack namespace */ packmem(procs->nspace, strlen(procs->nspace) + 1, buf); pack32(procs->rank, buf); } /* 3. pack the ring header info */ packmem((char*)ring_hdr, sizeof(pmixp_coll_ring_msg_hdr_t), buf); return SLURM_SUCCESS; }
/* Pack individual burst buffer records into a buffer */ extern int bb_pack_bufs(uid_t uid, bb_state_t *state_ptr, Buf buffer, uint16_t protocol_version) { int i, rec_count = 0; struct bb_alloc *bb_alloc; int eof, offset; xassert(state_ptr); offset = get_buf_offset(buffer); pack32(rec_count, buffer); if (!state_ptr->bb_ahash) return rec_count; for (i = 0; i < BB_HASH_SIZE; i++) { bb_alloc = state_ptr->bb_ahash[i]; while (bb_alloc) { if ((uid == 0) || (uid == bb_alloc->user_id)) { _pack_alloc(bb_alloc, buffer, protocol_version); rec_count++; } bb_alloc = bb_alloc->next; } } if (rec_count != 0) { eof = get_buf_offset(buffer); set_buf_offset(buffer, offset); pack32(rec_count, buffer); set_buf_offset(buffer, eof); } return rec_count; }
/* Pack individual burst buffer usage records into a buffer (used for limits) */ extern int bb_pack_usage(uid_t uid, bb_state_t *state_ptr, Buf buffer, uint16_t protocol_version) { int i, rec_count = 0; bb_user_t *bb_usage; int eof, offset; xassert(state_ptr); offset = get_buf_offset(buffer); pack32(rec_count, buffer); if (!state_ptr->bb_uhash) return rec_count; for (i = 0; i < BB_HASH_SIZE; i++) { bb_usage = state_ptr->bb_uhash[i]; while (bb_usage) { if (((uid == 0) || (uid == bb_usage->user_id)) && (bb_usage->size != 0)) { pack64(bb_usage->size, buffer); pack32(bb_usage->user_id, buffer); rec_count++; } bb_usage = bb_usage->next; } } if (rec_count != 0) { eof = get_buf_offset(buffer); set_buf_offset(buffer, offset); pack32(rec_count, buffer); set_buf_offset(buffer, eof); } return rec_count; }
/* * _pack_front_end - dump all configuration information about a specific * front_end node in machine independent form (for network transmission) * IN dump_front_end_ptr - pointer to front_end node for which information is * requested * IN/OUT buffer - buffer where data is placed, pointers automatically updated * IN protocol_version - slurm protocol version of client * NOTE: if you make any changes here be sure to make the corresponding * changes to load_front_end_config in api/node_info.c */ static void _pack_front_end(struct front_end_record *dump_front_end_ptr, Buf buffer, uint16_t protocol_version) { if (protocol_version >= SLURM_2_6_PROTOCOL_VERSION) { packstr(dump_front_end_ptr->allow_groups, buffer); packstr(dump_front_end_ptr->allow_users, buffer); pack_time(dump_front_end_ptr->boot_time, buffer); packstr(dump_front_end_ptr->deny_groups, buffer); packstr(dump_front_end_ptr->deny_users, buffer); packstr(dump_front_end_ptr->name, buffer); pack16(dump_front_end_ptr->node_state, buffer); packstr(dump_front_end_ptr->reason, buffer); pack_time(dump_front_end_ptr->reason_time, buffer); pack32(dump_front_end_ptr->reason_uid, buffer); pack_time(dump_front_end_ptr->slurmd_start_time, buffer); } else if (protocol_version >= SLURM_2_5_PROTOCOL_VERSION) { pack_time(dump_front_end_ptr->boot_time, buffer); packstr(dump_front_end_ptr->name, buffer); pack16(dump_front_end_ptr->node_state, buffer); packstr(dump_front_end_ptr->reason, buffer); pack_time(dump_front_end_ptr->reason_time, buffer); pack32(dump_front_end_ptr->reason_uid, buffer); pack_time(dump_front_end_ptr->slurmd_start_time, buffer); } else { error("_pack_front_end: Unsupported slurm version %u", protocol_version); } }
int switch_p_pack_jobinfo(switch_jobinfo_t *switch_job, Buf buffer, uint16_t protocol_version) { sw_gen_step_info_t *gen_step_info = (sw_gen_step_info_t *) switch_job; sw_gen_node_t *node_ptr; sw_gen_ifa_t *ifa_ptr; int i, j; if (debug_flags & DEBUG_FLAG_SWITCH) info("switch_p_pack_jobinfo() starting"); xassert(gen_step_info); xassert(gen_step_info->magic == SW_GEN_STEP_INFO_MAGIC); if (!libstate) { /* The function is being called from srun or slurmd. * There is no more need for moving this data. */ pack32((uint32_t) 0, buffer); return SLURM_SUCCESS; } pack32(gen_step_info->node_cnt, buffer); for (i = 0; i < gen_step_info->node_cnt; i++) { node_ptr = gen_step_info->node_array[i]; packstr(node_ptr->node_name, buffer); pack16(node_ptr->ifa_cnt, buffer); for (j = 0; j < node_ptr->ifa_cnt; j++) { ifa_ptr = node_ptr->ifa_array[j]; packstr(ifa_ptr->ifa_addr, buffer); packstr(ifa_ptr->ifa_family, buffer); packstr(ifa_ptr->ifa_name, buffer); } } return SLURM_SUCCESS; }
ssh_string SshAgentSignDss(uint8_t* data, int dataSize, ssh_key key, uint32_t flags) { unsigned char hash[SHA_DIGEST_LEN] = {0}; SHACTX ctx; ctx = sha1_init(); if (ctx == NULL) { return NULL; } sha1_update(ctx, data, dataSize); sha1_final(hash, ctx); // This release ctx. DSA_SIG* sig = NULL; sig = DSA_do_sign(hash, sizeof(hash), key->dsa); if (sig == NULL) { return NULL; } uint8_t sigblob[40]; memset(sigblob, 0, 40); int rlen = BN_num_bytes(sig->r); int slen = BN_num_bytes(sig->s); BN_bn2bin(sig->r, sigblob + 20 - rlen); BN_bn2bin(sig->s, sigblob + 40 - slen); if (flags & SSH_AGENT_OLD_SIGNATURE) { uint8_t* signatureBlob = malloc(sizeof(sigblob)); if (signatureBlob == NULL) { return NULL; } memcpy(signatureBlob, sigblob, 40); return (ssh_string)signatureBlob; } int signatureTypeLength = 7; int signatureLength = 40; int signatureBlobLength = 8 + signatureTypeLength + signatureLength; uint8_t* signatureBlob = malloc(4 + signatureBlobLength); if (signatureBlob == NULL) { return NULL; } pack32(signatureBlob, signatureBlobLength); pack32(signatureBlob + 4, signatureTypeLength); memcpy(signatureBlob + 8, "ssh-dss", signatureTypeLength); pack32(signatureBlob + 15, signatureLength); memcpy(signatureBlob + 19, sigblob, 40); return (ssh_string)signatureBlob; }
/* Pack a power management data structure */ extern void power_mgmt_data_pack(power_mgmt_data_t *power, Buf buffer, uint16_t protocol_version) { if (!power) { pack32(NO_VAL, buffer); } else { pack32(power->cap_watts, buffer); } }
uint8_t* SshAgentMakeIdentityListReply(SshAgentContext* context) { uint8_t* message = NULL; int keyCount = (context->isLocked ? 0 : context->keyCount); ssh_string* keyBlobs = (keyCount > 0 ? calloc(keyCount, sizeof(ssh_string*)) : NULL); if (keyBlobs == NULL && keyCount > 0) { return NULL; } int totalBlobSize = 0; int i; for (i = 0; i < keyCount; i++) { int sshResult = ssh_pki_export_pubkey_blob(context->keys[i], keyBlobs + i); if (sshResult != SSH_OK) { goto FREE_KEY_BLOBS; } totalBlobSize += ntohl(keyBlobs[i]->size); } int messageSize = 5 + totalBlobSize + 8 * keyCount; message = malloc(messageSize + 4); if (message == NULL) { goto FREE_KEY_BLOBS; } pack32(message, messageSize); message[4] = SSH2_AGENT_IDENTITIES_ANSWER; pack32(message + 5, keyCount); int index = 9; for (i = 0; i < keyCount; i++) { ssh_string blob = keyBlobs[i]; int blobSize = unpack32((uint8_t*)blob) + 4; memcpy(message + index, blob, blobSize); index += blobSize; memset(message + index, 0, 4); index += 4; } FREE_KEY_BLOBS: for (i = 0; i < keyCount; i++) { ssh_string blob = keyBlobs[i]; ssh_string_free(blob); } free(keyBlobs); return message; }
static void _pack_register_ctld_msg(dbd_register_ctld_msg_t *msg, uint16_t rpc_version, Buf buffer) { if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { pack16(msg->dimensions, buffer); pack32(msg->flags, buffer); pack32(msg->plugin_id_select, buffer); pack16(msg->port, buffer); } }
/* Given a *uint32_t, it will pack an array of size_val */ void pack32_array(uint32_t * valp, uint32_t size_val, Buf buffer) { uint32_t i = 0; pack32(size_val, buffer); for (i = 0; i < size_val; i++) { pack32(*(valp + i), buffer); } }
static void io_init_msg_pack(struct slurm_io_init_msg *hdr, Buf buffer) { pack16(hdr->version, buffer); pack32(hdr->nodeid, buffer); pack32(hdr->stdout_objs, buffer); pack32(hdr->stderr_objs, buffer); packmem((char *) hdr->cred_signature, (uint32_t) SLURM_IO_KEY_SIZE, buffer); }
/* * _dump_front_end_state - dump state of a specific front_end node to a buffer * IN front_end_ptr - pointer to node for which information is requested * IN/OUT buffer - location to store data, pointers automatically advanced */ static void _dump_front_end_state(front_end_record_t *front_end_ptr, Buf buffer) { packstr (front_end_ptr->name, buffer); pack32 (front_end_ptr->node_state, buffer); packstr (front_end_ptr->reason, buffer); pack_time(front_end_ptr->reason_time, buffer); pack32 (front_end_ptr->reason_uid, buffer); pack16 (front_end_ptr->protocol_version, buffer); }
static void _pack_alloc(struct bb_alloc *bb_alloc, Buf buffer, uint16_t protocol_version) { if (protocol_version >= SLURM_16_05_PROTOCOL_VERSION) { packstr(bb_alloc->account, buffer); pack32(bb_alloc->array_job_id, buffer); pack32(bb_alloc->array_task_id, buffer); pack_time(bb_alloc->create_time, buffer); pack32(bb_alloc->job_id, buffer); packstr(bb_alloc->name, buffer); packstr(bb_alloc->partition, buffer); packstr(bb_alloc->pool, buffer); packstr(bb_alloc->qos, buffer); pack64(bb_alloc->size, buffer); pack16(bb_alloc->state, buffer); pack32(bb_alloc->user_id, buffer); } else { packstr(bb_alloc->account, buffer); pack32(bb_alloc->array_job_id, buffer); pack32(bb_alloc->array_task_id, buffer); pack_time(bb_alloc->create_time, buffer); pack32((uint32_t)0, buffer); pack32(bb_alloc->job_id, buffer); packstr(bb_alloc->name, buffer); packstr(bb_alloc->partition, buffer); packstr(bb_alloc->qos, buffer); pack64(bb_alloc->size, buffer); pack16(bb_alloc->state, buffer); pack32(bb_alloc->user_id, buffer); } }
extern void slurmdbd_pack_id_rc_msg(void *in, uint16_t rpc_version, Buf buffer) { dbd_id_rc_msg_t *msg = (dbd_id_rc_msg_t *)in; if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { pack32(msg->job_id, buffer); pack64(msg->db_index, buffer); pack32(msg->return_code, buffer); } }
static void _pack_jobacct_id(jobacct_id_t *jobacct_id, uint16_t rpc_version, Buf buffer) { if (jobacct_id) { pack32((uint32_t) jobacct_id->nodeid, buffer); pack16((uint16_t) jobacct_id->taskid, buffer); } else { pack32((uint32_t) NO_VAL, buffer); pack16((uint16_t) NO_VAL, buffer); } }
static void _pack_job_suspend_msg(dbd_job_suspend_msg_t *msg, uint16_t rpc_version, Buf buffer) { if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { pack32(msg->assoc_id, buffer); pack64(msg->db_index, buffer); pack32(msg->job_id, buffer); pack32(msg->job_state, buffer); pack_time(msg->submit_time, buffer); pack_time(msg->suspend_time, buffer); } }
/* * pack_all_front_end - dump all front_end node information for all nodes * in machine independent form (for network transmission) * OUT buffer_ptr - pointer to the stored data * OUT buffer_size - set to size of the buffer in bytes * IN protocol_version - slurm protocol version of client * NOTE: the caller must xfree the buffer at *buffer_ptr * NOTE: READ lock_slurmctld config before entry */ extern void pack_all_front_end(char **buffer_ptr, int *buffer_size, uid_t uid, uint16_t protocol_version) { time_t now = time(NULL); uint32_t nodes_packed = 0; Buf buffer; #ifdef HAVE_FRONT_END uint32_t tmp_offset; front_end_record_t *front_end_ptr; int i; buffer_ptr[0] = NULL; *buffer_size = 0; buffer = init_buf(BUF_SIZE * 2); nodes_packed = 0; if (protocol_version >= SLURM_2_5_PROTOCOL_VERSION) { /* write header: count and time */ pack32(nodes_packed, buffer); pack_time(now, buffer); /* write records */ for (i = 0, front_end_ptr = front_end_nodes; i < front_end_node_cnt; i++, front_end_ptr++) { xassert(front_end_ptr->magic == FRONT_END_MAGIC); _pack_front_end(front_end_ptr, buffer, protocol_version); nodes_packed++; } } else { error("pack_all_front_end: Unsupported slurm version %u", protocol_version); } tmp_offset = get_buf_offset (buffer); set_buf_offset(buffer, 0); pack32(nodes_packed, buffer); set_buf_offset(buffer, tmp_offset); *buffer_size = get_buf_offset(buffer); buffer_ptr[0] = xfer_buf_data(buffer); #else buffer_ptr[0] = NULL; *buffer_size = 0; buffer = init_buf(64); pack32(nodes_packed, buffer); pack_time(now, buffer); *buffer_size = get_buf_offset(buffer); buffer_ptr[0] = xfer_buf_data(buffer); #endif }
static void _state_write_buf(Buf buffer) { pack16(SLURM_PROTOCOL_VERSION, buffer); pack32(MIN_PORT, buffer); pack32(MAX_PORT, buffer); pthread_mutex_lock(&port_mutex); pack32(last_alloc_port, buffer); pack_bit_str(port_resv, buffer); pthread_mutex_unlock(&port_mutex); }
extern void spawn_resp_pack(spawn_resp_t *resp, Buf buf) { int i; pack32(resp->seq, buf); pack32((uint32_t)resp->rc, buf); packstr(resp->jobid, buf); pack32(resp->error_cnt, buf); for (i = 0; i < resp->error_cnt; i ++) { pack32((uint32_t)resp->error_codes[i], buf); } }
static void _pack_node_state_msg(dbd_node_state_msg_t *msg, uint16_t rpc_version, Buf buffer) { if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { packstr(msg->hostlist, buffer); packstr(msg->reason, buffer); pack32(msg->reason_uid, buffer); pack16(msg->new_state, buffer); pack_time(msg->event_time, buffer); pack32(msg->state, buffer); packstr(msg->tres_str, buffer); } }
ssh_string SshAgentSignEcdsaSha512(uint8_t* data, int dataSize, ssh_key key, uint32_t flags) { // Compute the hash. unsigned char hash[SHA384_DIGEST_LEN] = {0}; SHACTX ctx; ctx = sha512_init(); if (ctx == NULL) { return NULL; } sha512_update(ctx, data, dataSize); sha512_final(hash, ctx); // This release ctx. // Sign the hash. ECDSA_SIG* sig = NULL; sig = ECDSA_do_sign(hash, sizeof(hash), key->ecdsa); if (sig == NULL) { return NULL; } // Format the signature in a blob of the form: // blobLength[ typeNameLength[ typeName ] signatureLength[ rLength[ r ] sLength[ s ] ] ] int rMpiLength = BN_bn2mpi(sig->r, NULL); int sMpiLength = BN_bn2mpi(sig->s, NULL); int signatureLength = rMpiLength + sMpiLength; int typeNameLength = 19; int blobLength = 8 + typeNameLength + signatureLength; uint8_t* signatureBlob = malloc(4 + blobLength); if (signatureBlob == NULL) { return NULL; } pack32(signatureBlob, blobLength); int index = 4; pack32(signatureBlob + index, typeNameLength); index += 4; memcpy(signatureBlob + index, "ecdsa-sha2-nistp521", typeNameLength); index += typeNameLength; pack32(signatureBlob + 15, signatureLength); index += 4; BN_bn2mpi(sig->r, signatureBlob + index); index += rMpiLength; BN_bn2mpi(sig->s, signatureBlob + index); return (ssh_string)signatureBlob; }
static void job_option_info_pack (struct job_option_info *ji, Buf buf) { pack32 (ji->type, buf); packstr (ji->option, buf); packstr (ji->optarg, buf); /* packstr() handles NULL optarg */ return; }
/* pack a select job credential into a buffer in machine independent form * IN jobinfo - the select job credential to be saved * OUT buffer - buffer with select credential appended * RET - slurm error code */ extern int select_g_select_jobinfo_pack(dynamic_plugin_data_t *jobinfo, Buf buffer, uint16_t protocol_version) { void *data = NULL; uint32_t plugin_id; if (slurm_select_init(0) < 0) return SLURM_ERROR; if (jobinfo) { data = jobinfo->data; plugin_id = jobinfo->plugin_id; } else plugin_id = select_context_default; if (protocol_version >= SLURM_2_5_PROTOCOL_VERSION) { pack32(*(ops[plugin_id].plugin_id), buffer); } else { error("select_g_select_jobinfo_pack: protocol_version " "%hu not supported", protocol_version); } return (*(ops[plugin_id].jobinfo_pack))(data, buffer, protocol_version); }
int switch_p_pack_jobinfo(switch_jobinfo_t *switch_job, Buf buffer, uint16_t protocol_version) { sw_gen_step_info_t *gen_step_info = (sw_gen_step_info_t *) switch_job; sw_gen_node_t *node_ptr; sw_gen_ifa_t *ifa_ptr; int i, j; if (debug_flags & DEBUG_FLAG_SWITCH) info("switch_p_pack_jobinfo() starting"); xassert(gen_step_info); xassert(gen_step_info->magic == SW_GEN_STEP_INFO_MAGIC); pack32(gen_step_info->node_cnt, buffer); for (i = 0; i < gen_step_info->node_cnt; i++) { node_ptr = gen_step_info->node_array[i]; packstr(node_ptr->node_name, buffer); pack16(node_ptr->ifa_cnt, buffer); for (j = 0; j < node_ptr->ifa_cnt; j++) { ifa_ptr = node_ptr->ifa_array[j]; if (debug_flags & DEBUG_FLAG_SWITCH) { info("node=%s name=%s family=%s addr=%s", node_ptr->node_name, ifa_ptr->ifa_name, ifa_ptr->ifa_family, ifa_ptr->ifa_addr); } packstr(ifa_ptr->ifa_addr, buffer); packstr(ifa_ptr->ifa_family, buffer); packstr(ifa_ptr->ifa_name, buffer); } } return SLURM_SUCCESS; }