VPP-237: indent fixes in prep for checkstyle
Ran indent *twice* Change-Id: If9c18b81983bb859cc8dc3b415c67cbf318fc618 Signed-off-by: Ed Warnicke <eaw@cisco.com>
This commit is contained in:
@ -49,7 +49,7 @@ ssvm_master_init (ssvm_private_t * ssvm, u32 master_index)
|
||||
close (ssvm_fd);
|
||||
return SSVM_API_ERROR_SET_SIZE;
|
||||
}
|
||||
|
||||
|
||||
if (write (ssvm_fd, &junk, 1) != 1)
|
||||
{
|
||||
clib_unix_warning ("set ssvm size");
|
||||
|
@ -49,8 +49,8 @@ typedef struct
|
||||
|
||||
svmdbtool_main_t svmdbtool_main;
|
||||
|
||||
static inline
|
||||
svmdb_map_args_t * map_arg_setup (char *chroot_path)
|
||||
static inline svmdb_map_args_t *
|
||||
map_arg_setup (char *chroot_path)
|
||||
{
|
||||
svmdbtool_main_t *sm = &svmdbtool_main;
|
||||
svmdb_map_args_t *ma = &sm->map_args;
|
||||
@ -351,8 +351,8 @@ main (int argc, char **argv)
|
||||
struct group _grp, *grp;
|
||||
char *s, buf[128];
|
||||
|
||||
svmdbtool_main.uid = geteuid();
|
||||
svmdbtool_main.gid = getegid();
|
||||
svmdbtool_main.uid = geteuid ();
|
||||
svmdbtool_main.gid = getegid ();
|
||||
|
||||
unformat_init_command_line (&input, argv);
|
||||
|
||||
@ -428,45 +428,45 @@ main (int argc, char **argv)
|
||||
parsed++;
|
||||
}
|
||||
else if (unformat (&input, "uid %d", &uid))
|
||||
svmdbtool_main.uid = uid;
|
||||
svmdbtool_main.uid = uid;
|
||||
else if (unformat (&input, "gid %d", &gid))
|
||||
svmdbtool_main.gid = gid;
|
||||
svmdbtool_main.gid = gid;
|
||||
else if (unformat (&input, "uid %s", &s))
|
||||
{
|
||||
/* lookup the username */
|
||||
pw = NULL;
|
||||
rv = getpwnam_r(s, &_pw, buf, sizeof(buf), &pw);
|
||||
if (rv < 0)
|
||||
{
|
||||
fformat (stderr, "cannot fetch username %s", s);
|
||||
exit (1);
|
||||
}
|
||||
if (pw == NULL)
|
||||
{
|
||||
fformat (stderr, "username %s does not exist", s);
|
||||
exit (1);
|
||||
}
|
||||
vec_free (s);
|
||||
svmdbtool_main.uid = pw->pw_uid;
|
||||
}
|
||||
{
|
||||
/* lookup the username */
|
||||
pw = NULL;
|
||||
rv = getpwnam_r (s, &_pw, buf, sizeof (buf), &pw);
|
||||
if (rv < 0)
|
||||
{
|
||||
fformat (stderr, "cannot fetch username %s", s);
|
||||
exit (1);
|
||||
}
|
||||
if (pw == NULL)
|
||||
{
|
||||
fformat (stderr, "username %s does not exist", s);
|
||||
exit (1);
|
||||
}
|
||||
vec_free (s);
|
||||
svmdbtool_main.uid = pw->pw_uid;
|
||||
}
|
||||
else if (unformat (&input, "gid %s", &s))
|
||||
{
|
||||
/* lookup the group name */
|
||||
grp = NULL;
|
||||
rv = getgrnam_r(s, &_grp, buf, sizeof(buf), &grp);
|
||||
if (rv != 0)
|
||||
{
|
||||
fformat (stderr, "cannot fetch group %s", s);
|
||||
exit (1);
|
||||
}
|
||||
if (grp == NULL)
|
||||
{
|
||||
fformat (stderr, "group %s does not exist", s);
|
||||
exit (1);
|
||||
}
|
||||
vec_free (s);
|
||||
svmdbtool_main.gid = grp->gr_gid;
|
||||
}
|
||||
{
|
||||
/* lookup the group name */
|
||||
grp = NULL;
|
||||
rv = getgrnam_r (s, &_grp, buf, sizeof (buf), &grp);
|
||||
if (rv != 0)
|
||||
{
|
||||
fformat (stderr, "cannot fetch group %s", s);
|
||||
exit (1);
|
||||
}
|
||||
if (grp == NULL)
|
||||
{
|
||||
fformat (stderr, "group %s does not exist", s);
|
||||
exit (1);
|
||||
}
|
||||
vec_free (s);
|
||||
svmdbtool_main.gid = grp->gr_gid;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
|
@ -781,7 +781,7 @@ vl_msg_api_process_file (vlib_main_t * vm, u8 * filename,
|
||||
if (!(statb.st_mode & S_IFREG) || (statb.st_size < sizeof (*hp)))
|
||||
{
|
||||
vlib_cli_output (vm, "File not plausible: %s\n", filename);
|
||||
close(fd);
|
||||
close (fd);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1084,17 +1084,19 @@ api_trace_command_fn (vlib_main_t * vm,
|
||||
rv = vl_msg_api_trace_save (am, which, fp);
|
||||
fclose (fp);
|
||||
if (rv == -1)
|
||||
vlib_cli_output (vm, "API Trace data not present\n");
|
||||
vlib_cli_output (vm, "API Trace data not present\n");
|
||||
else if (rv == -2)
|
||||
vlib_cli_output (vm, "File for writing is closed\n");
|
||||
vlib_cli_output (vm, "File for writing is closed\n");
|
||||
else if (rv == -10)
|
||||
vlib_cli_output (vm, "Error while writing header to file\n");
|
||||
vlib_cli_output (vm, "Error while writing header to file\n");
|
||||
else if (rv == -11)
|
||||
vlib_cli_output (vm, "Error while writing trace to file\n");
|
||||
vlib_cli_output (vm, "Error while writing trace to file\n");
|
||||
else if (rv == -12)
|
||||
vlib_cli_output (vm, "Error while writing end of buffer trace to file\n");
|
||||
vlib_cli_output (vm,
|
||||
"Error while writing end of buffer trace to file\n");
|
||||
else if (rv == -13)
|
||||
vlib_cli_output (vm, "Error while writing start of buffer trace to file\n");
|
||||
vlib_cli_output (vm,
|
||||
"Error while writing start of buffer trace to file\n");
|
||||
else if (rv < 0)
|
||||
vlib_cli_output (vm, "Unkown error while saving: %d", rv);
|
||||
else
|
||||
|
@ -356,10 +356,10 @@ test_node_serialize_command_fn (vlib_main_t * vm,
|
||||
for (k = 0; k < vec_len (node->next_nodes); k++)
|
||||
{
|
||||
if (node->next_nodes[k] != ~0)
|
||||
{
|
||||
next_node = nodes[node->next_nodes[k]];
|
||||
vlib_cli_output (vm, " [%d] %s", k, next_node->name);
|
||||
}
|
||||
{
|
||||
next_node = nodes[node->next_nodes[k]];
|
||||
vlib_cli_output (vm, " [%d] %s", k, next_node->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1043,11 +1043,11 @@ vl_api_trace_print_file_cmd (vlib_main_t * vm, u32 first, u32 last,
|
||||
msg_id = ntohs (msg_id);
|
||||
|
||||
if (fseek (fp, -2, SEEK_CUR) < 0)
|
||||
{
|
||||
vlib_cli_output (vm, "fseek failed, %s", strerror(errno));
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
{
|
||||
vlib_cli_output (vm, "fseek failed, %s", strerror (errno));
|
||||
fclose (fp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Mild sanity check */
|
||||
if (msg_id >= vec_len (am->msg_handlers))
|
||||
|
@ -107,7 +107,7 @@ sockclnt_open_index (char *client_name, char *hostname, int port)
|
||||
if (connect (sockfd, (const void *) &serv_addr, sizeof (serv_addr)) < 0)
|
||||
{
|
||||
clib_unix_warning ("Connect failure to (%s, %d)", hostname, port);
|
||||
close(sockfd);
|
||||
close (sockfd);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ sockclnt_open_index (char *client_name, char *hostname, int port)
|
||||
if (rv < 0)
|
||||
{
|
||||
clib_unix_warning ("FIONBIO");
|
||||
close(sockfd);
|
||||
close (sockfd);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
|
@ -611,7 +611,7 @@ socksvr_api_init (vlib_main_t * vm)
|
||||
rv = listen (sockfd, 5);
|
||||
if (rv < 0)
|
||||
{
|
||||
close(sockfd);
|
||||
close (sockfd);
|
||||
return clib_error_return_unix (0, "listen");
|
||||
}
|
||||
|
||||
|
@ -853,11 +853,11 @@ add_sub_command (vlib_cli_main_t * cm, uword parent_index, uword child_index)
|
||||
|
||||
q = hash_get_mem (cm->parse_rule_index_by_name, sub_name);
|
||||
if (!q)
|
||||
{
|
||||
clib_error ("reference to unknown rule `%%%v' in path `%v'",
|
||||
sub_name, c->path);
|
||||
return;
|
||||
}
|
||||
{
|
||||
clib_error ("reference to unknown rule `%%%v' in path `%v'",
|
||||
sub_name, c->path);
|
||||
return;
|
||||
}
|
||||
|
||||
hash_set_mem (p->sub_rule_index_by_name, sub_name,
|
||||
vec_len (p->sub_rules));
|
||||
|
@ -991,70 +991,70 @@ vlib_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs,
|
||||
{
|
||||
#if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 0)
|
||||
{
|
||||
uword this_pool_end;
|
||||
uword this_pool_start;
|
||||
uword this_pool_size;
|
||||
uword save_vpm_start, save_vpm_end, save_vpm_size;
|
||||
uword this_pool_end;
|
||||
uword this_pool_start;
|
||||
uword this_pool_size;
|
||||
uword save_vpm_start, save_vpm_end, save_vpm_size;
|
||||
struct rte_mempool_memhdr *memhdr;
|
||||
|
||||
this_pool_start = ~0ULL;
|
||||
this_pool_end = 0LL;
|
||||
|
||||
STAILQ_FOREACH (memhdr, &rmp->mem_list, next)
|
||||
{
|
||||
if (((uword)(memhdr->addr + memhdr->len)) > this_pool_end)
|
||||
this_pool_end = (uword)(memhdr->addr + memhdr->len);
|
||||
if (((uword)memhdr->addr) < this_pool_start)
|
||||
this_pool_start = (uword)(memhdr->addr);
|
||||
}
|
||||
ASSERT (this_pool_start < ~0ULL && this_pool_end > 0);
|
||||
this_pool_size = this_pool_end - this_pool_start;
|
||||
this_pool_start = ~0ULL;
|
||||
this_pool_end = 0LL;
|
||||
|
||||
if (CLIB_DEBUG > 1)
|
||||
{
|
||||
clib_warning ("%s: pool start %llx pool end %llx pool size %lld",
|
||||
pool_name, this_pool_start, this_pool_end,
|
||||
this_pool_size);
|
||||
clib_warning
|
||||
("before: virtual.start %llx virtual.end %llx virtual.size %lld",
|
||||
vpm->virtual.start, vpm->virtual.end, vpm->virtual.size);
|
||||
}
|
||||
|
||||
save_vpm_start = vpm->virtual.start;
|
||||
save_vpm_end = vpm->virtual.end;
|
||||
save_vpm_size = vpm->virtual.size;
|
||||
STAILQ_FOREACH (memhdr, &rmp->mem_list, next)
|
||||
{
|
||||
if (((uword) (memhdr->addr + memhdr->len)) > this_pool_end)
|
||||
this_pool_end = (uword) (memhdr->addr + memhdr->len);
|
||||
if (((uword) memhdr->addr) < this_pool_start)
|
||||
this_pool_start = (uword) (memhdr->addr);
|
||||
}
|
||||
ASSERT (this_pool_start < ~0ULL && this_pool_end > 0);
|
||||
this_pool_size = this_pool_end - this_pool_start;
|
||||
|
||||
if ((this_pool_start < vpm->virtual.start) || vpm->virtual.start == 0)
|
||||
vpm->virtual.start = this_pool_start;
|
||||
if (this_pool_end > vpm->virtual.end)
|
||||
vpm->virtual.end = this_pool_end;
|
||||
if (CLIB_DEBUG > 1)
|
||||
{
|
||||
clib_warning ("%s: pool start %llx pool end %llx pool size %lld",
|
||||
pool_name, this_pool_start, this_pool_end,
|
||||
this_pool_size);
|
||||
clib_warning
|
||||
("before: virtual.start %llx virtual.end %llx virtual.size %lld",
|
||||
vpm->virtual.start, vpm->virtual.end, vpm->virtual.size);
|
||||
}
|
||||
|
||||
vpm->virtual.size = vpm->virtual.end - vpm->virtual.start;
|
||||
|
||||
if (CLIB_DEBUG > 1)
|
||||
{
|
||||
clib_warning
|
||||
("after: virtual.start %llx virtual.end %llx virtual.size %lld",
|
||||
vpm->virtual.start, vpm->virtual.end, vpm->virtual.size);
|
||||
}
|
||||
save_vpm_start = vpm->virtual.start;
|
||||
save_vpm_end = vpm->virtual.end;
|
||||
save_vpm_size = vpm->virtual.size;
|
||||
|
||||
/* check if fits into buffer index range */
|
||||
if ((u64) vpm->virtual.size >
|
||||
((u64) 1 << (32 + CLIB_LOG2_CACHE_LINE_BYTES)))
|
||||
{
|
||||
clib_warning ("physmem: virtual size out of range!");
|
||||
vpm->virtual.start = save_vpm_start;
|
||||
vpm->virtual.end = save_vpm_end;
|
||||
vpm->virtual.size = save_vpm_size;
|
||||
rmp = 0;
|
||||
}
|
||||
if ((this_pool_start < vpm->virtual.start) || vpm->virtual.start == 0)
|
||||
vpm->virtual.start = this_pool_start;
|
||||
if (this_pool_end > vpm->virtual.end)
|
||||
vpm->virtual.end = this_pool_end;
|
||||
|
||||
vpm->virtual.size = vpm->virtual.end - vpm->virtual.start;
|
||||
|
||||
if (CLIB_DEBUG > 1)
|
||||
{
|
||||
clib_warning
|
||||
("after: virtual.start %llx virtual.end %llx virtual.size %lld",
|
||||
vpm->virtual.start, vpm->virtual.end, vpm->virtual.size);
|
||||
}
|
||||
|
||||
/* check if fits into buffer index range */
|
||||
if ((u64) vpm->virtual.size >
|
||||
((u64) 1 << (32 + CLIB_LOG2_CACHE_LINE_BYTES)))
|
||||
{
|
||||
clib_warning ("physmem: virtual size out of range!");
|
||||
vpm->virtual.start = save_vpm_start;
|
||||
vpm->virtual.end = save_vpm_end;
|
||||
vpm->virtual.size = save_vpm_size;
|
||||
rmp = 0;
|
||||
}
|
||||
}
|
||||
if (rmp)
|
||||
{
|
||||
bm->pktmbuf_pools[socket_id] = rmp;
|
||||
vec_free(pool_name);
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
bm->pktmbuf_pools[socket_id] = rmp;
|
||||
vec_free (pool_name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
new_start = pointer_to_uword (rmp);
|
||||
@ -1085,7 +1085,7 @@ vlib_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs,
|
||||
vpm->virtual.start = new_start;
|
||||
vpm->virtual.size = new_size;
|
||||
vpm->virtual.end = new_start + new_size;
|
||||
vec_free(pool_name);
|
||||
vec_free (pool_name);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -96,7 +96,7 @@ typedef enum
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
mc_peer_id_t peer_id; mc_relay_msg_type_t type:32;
|
||||
/* MC_MSG_TYPE_join_or_leave_request */
|
||||
/* MC_MSG_TYPE_join_or_leave_request */
|
||||
/* Stream to join or leave. */
|
||||
u32 stream_index;
|
||||
/* join = 1, leave = 0 */
|
||||
@ -117,7 +117,7 @@ mc_byte_swap_msg_join_or_leave_request (mc_msg_join_or_leave_request_t * r)
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
mc_peer_id_t peer_id; mc_relay_msg_type_t type:32;
|
||||
/* MC_MSG_TYPE_join_reply */
|
||||
/* MC_MSG_TYPE_join_reply */
|
||||
u32 stream_index;
|
||||
/* Peer ID to contact to catchup with this stream. */
|
||||
mc_peer_id_t catchup_peer_id;}) mc_msg_join_reply_t;
|
||||
@ -165,8 +165,7 @@ mc_byte_swap_msg_user_request (mc_msg_user_request_t * r)
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
mc_peer_id_t peer_id;
|
||||
u32 global_sequence;
|
||||
u32 stream_index;
|
||||
u32 global_sequence; u32 stream_index;
|
||||
u32 local_sequence;
|
||||
i32 seq_cmp_result;}) mc_msg_user_ack_t;
|
||||
|
||||
|
@ -486,11 +486,11 @@ vlib_node_main_init (vlib_main_t * vm)
|
||||
|
||||
sib = vlib_get_node_by_name (vm, (u8 *) n->sibling_of);
|
||||
if (!sib)
|
||||
{
|
||||
error = clib_error_create ("sibling `%s' not found for node `%v'",
|
||||
n->sibling_of, n->name);
|
||||
goto done;
|
||||
}
|
||||
{
|
||||
error = clib_error_create ("sibling `%s' not found for node `%v'",
|
||||
n->sibling_of, n->name);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
clib_bitmap_foreach (si, sib->sibling_bitmap, ({
|
||||
|
@ -149,7 +149,8 @@ vlib_pci_bind_to_uio (vlib_pci_device_t * d, char *uio_driver_name)
|
||||
{
|
||||
/* Some interfaces (eg "lo") don't support this ioctl */
|
||||
if ((errno != ENOTSUP) && (errno != ENODEV))
|
||||
clib_unix_warning ("ioctl fetch intf %s bus info error", e->d_name);
|
||||
clib_unix_warning ("ioctl fetch intf %s bus info error",
|
||||
e->d_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -404,10 +404,12 @@ typedef enum pci_capability_type
|
||||
} pci_capability_type_t;
|
||||
|
||||
/* Common header for capabilities. */
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
enum pci_capability_type type:8;
|
||||
u8 next_offset;}) pci_capability_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
always_inline void *
|
||||
pci_config_find_capability (pci_config_type0_regs_t * t, int cap_type)
|
||||
@ -433,6 +435,7 @@ pci_config_find_capability (pci_config_type0_regs_t * t, int cap_type)
|
||||
}
|
||||
|
||||
/* Power Management Registers */
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
pci_capability_regs_t header; u16 capabilities;
|
||||
@ -460,8 +463,10 @@ typedef CLIB_PACKED (struct
|
||||
#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */
|
||||
#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */
|
||||
u8 data;}) pci_power_management_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* AGP registers */
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
pci_capability_regs_t header; u8 version;
|
||||
@ -476,24 +481,30 @@ typedef CLIB_PACKED (struct
|
||||
#define PCI_AGP_RATE2 0x0002 /* 2x transfer rate supported */
|
||||
#define PCI_AGP_RATE1 0x0001 /* 1x transfer rate supported */
|
||||
}) pci_agp_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* Vital Product Data */
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
pci_capability_regs_t header; u16 address;
|
||||
#define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */
|
||||
#define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */
|
||||
u32 data;}) pci_vpd_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* Slot Identification */
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
pci_capability_regs_t header; u8 esr;
|
||||
#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */
|
||||
#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */
|
||||
u8 chassis;}) pci_sid_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* Message Signalled Interrupts registers */
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
pci_capability_regs_t header; u16 flags;
|
||||
@ -505,14 +516,18 @@ typedef CLIB_PACKED (struct
|
||||
#define PCI_MSI_FLAGS_64BIT (1 << 7) /* 64-bit addresses allowed */
|
||||
#define PCI_MSI_FLAGS_MASKBIT (1 << 8) /* 64-bit mask bits allowed */
|
||||
u32 address; u32 data; u32 mask_bits;}) pci_msi32_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
pci_capability_regs_t header; u16 flags;
|
||||
u32 address[2];
|
||||
u32 data; u32 mask_bits;}) pci_msi64_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* CompactPCI Hotswap Register */
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
pci_capability_regs_t header; u16 control_status;
|
||||
@ -524,8 +539,10 @@ typedef CLIB_PACKED (struct
|
||||
#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */
|
||||
#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */
|
||||
}) pci_chswp_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* PCIX registers */
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
pci_capability_regs_t header; u16 command;
|
||||
@ -549,6 +566,7 @@ typedef CLIB_PACKED (struct
|
||||
#define PCIX_STATUS_266MHZ 0x40000000 /* 266 MHz capable */
|
||||
#define PCIX_STATUS_533MHZ 0x80000000 /* 533 MHz capable */
|
||||
}) pcix_config_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static inline int
|
||||
pcie_size_to_code (int bytes)
|
||||
@ -567,6 +585,7 @@ pcie_code_to_size (int code)
|
||||
}
|
||||
|
||||
/* PCI Express capability registers */
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
pci_capability_regs_t header; u16 pcie_capabilities;
|
||||
@ -629,6 +648,7 @@ typedef CLIB_PACKED (struct
|
||||
u16 link_status2;
|
||||
u32 slot_capabilities2; u16 slot_control2;
|
||||
u16 slot_status2;}) pcie_config_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* PCI express extended capabilities. */
|
||||
typedef enum pcie_capability_type
|
||||
@ -640,11 +660,14 @@ typedef enum pcie_capability_type
|
||||
} pcie_capability_type_t;
|
||||
|
||||
/* Common header for capabilities. */
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
enum pcie_capability_type type:16; u16 version: 4; u16 next_capability:12;})
|
||||
pcie_capability_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
pcie_capability_regs_t;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
typedef CLIB_PACKED (struct
|
||||
{
|
||||
pcie_capability_regs_t header; u32 uncorrectable_status;
|
||||
@ -674,6 +697,7 @@ typedef CLIB_PACKED (struct
|
||||
u32 root_command;
|
||||
u32 root_status; u16 correctable_error_source;
|
||||
u16 error_source;}) pcie_advanced_error_regs_t;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* Virtual Channel */
|
||||
#define PCI_VC_PORT_REG1 4
|
||||
|
@ -100,7 +100,7 @@ vlib_set_thread_name (char *name)
|
||||
{
|
||||
rv = pthread_setname_np (thread, name);
|
||||
if (rv)
|
||||
clib_warning ("pthread_setname_np returned %d", rv);
|
||||
clib_warning ("pthread_setname_np returned %d", rv);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ vlib_sysfs_list_to_bitmap (char *filename)
|
||||
unformat_init_string (&in, (char *) buffer,
|
||||
strlen ((char *) buffer));
|
||||
if (unformat (&in, "%U", unformat_bitmap_list, &r) != 1)
|
||||
clib_warning ("unformat_bitmap_list failed");
|
||||
clib_warning ("unformat_bitmap_list failed");
|
||||
unformat_free (&in);
|
||||
}
|
||||
vec_free (buffer);
|
||||
|
@ -2397,7 +2397,7 @@ unix_cli_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
if (isatty (UNIX_CLI_STDIN_FD) && um->cli_line_mode == 0)
|
||||
{
|
||||
/* Capture terminal resize events */
|
||||
memset (&sa, 0, sizeof(sa));
|
||||
memset (&sa, 0, sizeof (sa));
|
||||
sa.sa_handler = unix_cli_resize_interrupt;
|
||||
if (sigaction (SIGWINCH, &sa, 0) < 0)
|
||||
clib_panic ("sigaction");
|
||||
|
@ -223,8 +223,7 @@ vlib_plugin_early_init (vlib_main_t * vm)
|
||||
|
||||
static clib_error_t *
|
||||
vlib_plugins_show_cmd_fn (vlib_main_t * vm,
|
||||
unformat_input_t * input,
|
||||
vlib_cli_command_t * cmd)
|
||||
unformat_input_t * input, vlib_cli_command_t * cmd)
|
||||
{
|
||||
plugin_main_t *pm = &vlib_plugin_main;
|
||||
u8 *s = 0;
|
||||
@ -232,27 +231,26 @@ vlib_plugins_show_cmd_fn (vlib_main_t * vm,
|
||||
uword *value = 0;
|
||||
int index = 1;
|
||||
|
||||
s = format(s, " Plugin path is: %s\n",pm->plugin_path);
|
||||
s = format (s, " Plugin path is: %s\n", pm->plugin_path);
|
||||
if (vlib_plugin_name_filter)
|
||||
s = format(s," Plugin filter: %s\n",vlib_plugin_name_filter);
|
||||
s = format (s, " Plugin filter: %s\n", vlib_plugin_name_filter);
|
||||
|
||||
s = format(s, " Plugins loaded: \n");
|
||||
hash_foreach_mem (key, value, pm->plugin_by_name_hash, {
|
||||
if (key != 0)
|
||||
s = format(s, " %d.%s\n",index, key);
|
||||
index++;
|
||||
});
|
||||
s = format (s, " Plugins loaded: \n");
|
||||
hash_foreach_mem (key, value, pm->plugin_by_name_hash,
|
||||
{
|
||||
if (key != 0)
|
||||
s = format (s, " %d.%s\n", index, key); index++;}
|
||||
);
|
||||
|
||||
vlib_cli_output(vm, "%v", s);
|
||||
vec_free(s);
|
||||
vlib_cli_output (vm, "%v", s);
|
||||
vec_free (s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VLIB_CLI_COMMAND (plugins_show_cmd, static) = {
|
||||
.path = "show plugins",
|
||||
.short_help = "show loaded plugins",
|
||||
.function = vlib_plugins_show_cmd_fn,
|
||||
};
|
||||
VLIB_CLI_COMMAND (plugins_show_cmd, static) =
|
||||
{
|
||||
.path = "show plugins",.short_help = "show loaded plugins",.function =
|
||||
vlib_plugins_show_cmd_fn,};
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
*
|
||||
|
@ -103,7 +103,7 @@ vlib_sysfs_write (char *file_name, char *fmt, ...)
|
||||
{
|
||||
u8 *s;
|
||||
int fd;
|
||||
clib_error_t * error = 0;
|
||||
clib_error_t *error = 0;
|
||||
|
||||
fd = open (file_name, O_WRONLY);
|
||||
if (fd < 0)
|
||||
|
@ -240,10 +240,9 @@ always_inline uword
|
||||
|
||||
ASSERT (adj_index0 == ip4_fib_lookup_with_table (im, fib_index0,
|
||||
&ip0->
|
||||
src_address,
|
||||
0
|
||||
src_address, 0
|
||||
/* use dflt rt */
|
||||
));
|
||||
));
|
||||
adj0 = ip_get_adjacency (lm, adj_index0);
|
||||
}
|
||||
|
||||
|
@ -263,9 +263,8 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm,
|
||||
{
|
||||
data = vec_new (u8, 4);
|
||||
clib_memcpy (data, ip4.as_u8, 4);
|
||||
r =
|
||||
ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */
|
||||
0);
|
||||
r = ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */
|
||||
0);
|
||||
goto done;
|
||||
}
|
||||
else if (unformat (line_input, "set %U id remote %U 0x%U",
|
||||
@ -273,18 +272,16 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm,
|
||||
unformat_ikev2_id_type, &id_type,
|
||||
unformat_hex_string, &data))
|
||||
{
|
||||
r =
|
||||
ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */
|
||||
0);
|
||||
r = ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */
|
||||
0);
|
||||
goto done;
|
||||
}
|
||||
else if (unformat (line_input, "set %U id remote %U %v",
|
||||
unformat_token, valid_chars, &name,
|
||||
unformat_ikev2_id_type, &id_type, &data))
|
||||
{
|
||||
r =
|
||||
ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */
|
||||
0);
|
||||
r = ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */
|
||||
0);
|
||||
goto done;
|
||||
}
|
||||
else if (unformat (line_input, "set %U traffic-selector local "
|
||||
|
@ -220,19 +220,19 @@ ipsec_add_del_policy (vlib_main_t * vm, ipsec_policy_t * policy, int is_add)
|
||||
vec_add1 (spd->ipv6_inbound_protect_policy_indices,
|
||||
policy_index);
|
||||
clib_memcpy (vp, policy, sizeof (ipsec_policy_t));
|
||||
vec_sort_with_function (spd->
|
||||
ipv6_inbound_protect_policy_indices,
|
||||
ipsec_spd_entry_sort);
|
||||
vec_sort_with_function
|
||||
(spd->ipv6_inbound_protect_policy_indices,
|
||||
ipsec_spd_entry_sort);
|
||||
}
|
||||
else
|
||||
{
|
||||
vec_add1 (spd->
|
||||
ipv6_inbound_policy_discard_and_bypass_indices,
|
||||
policy_index);
|
||||
vec_add1
|
||||
(spd->ipv6_inbound_policy_discard_and_bypass_indices,
|
||||
policy_index);
|
||||
clib_memcpy (vp, policy, sizeof (ipsec_policy_t));
|
||||
vec_sort_with_function (spd->
|
||||
ipv6_inbound_policy_discard_and_bypass_indices,
|
||||
ipsec_spd_entry_sort);
|
||||
vec_sort_with_function
|
||||
(spd->ipv6_inbound_policy_discard_and_bypass_indices,
|
||||
ipsec_spd_entry_sort);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -242,19 +242,19 @@ ipsec_add_del_policy (vlib_main_t * vm, ipsec_policy_t * policy, int is_add)
|
||||
vec_add1 (spd->ipv4_inbound_protect_policy_indices,
|
||||
policy_index);
|
||||
clib_memcpy (vp, policy, sizeof (ipsec_policy_t));
|
||||
vec_sort_with_function (spd->
|
||||
ipv4_inbound_protect_policy_indices,
|
||||
ipsec_spd_entry_sort);
|
||||
vec_sort_with_function
|
||||
(spd->ipv4_inbound_protect_policy_indices,
|
||||
ipsec_spd_entry_sort);
|
||||
}
|
||||
else
|
||||
{
|
||||
vec_add1 (spd->
|
||||
ipv4_inbound_policy_discard_and_bypass_indices,
|
||||
policy_index);
|
||||
vec_add1
|
||||
(spd->ipv4_inbound_policy_discard_and_bypass_indices,
|
||||
policy_index);
|
||||
clib_memcpy (vp, policy, sizeof (ipsec_policy_t));
|
||||
vec_sort_with_function (spd->
|
||||
ipv4_inbound_policy_discard_and_bypass_indices,
|
||||
ipsec_spd_entry_sort);
|
||||
vec_sort_with_function
|
||||
(spd->ipv4_inbound_policy_discard_and_bypass_indices,
|
||||
ipsec_spd_entry_sort);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -283,9 +283,9 @@ ipsec_alloc_empty_buffers (vlib_main_t * vm, ipsec_main_t * im)
|
||||
}
|
||||
|
||||
n_alloc = vlib_buffer_alloc_from_free_list (vm,
|
||||
im->
|
||||
empty_buffers[cpu_index] +
|
||||
l, 2 * VLIB_FRAME_SIZE - l,
|
||||
im->empty_buffers[cpu_index]
|
||||
+ l,
|
||||
2 * VLIB_FRAME_SIZE - l,
|
||||
free_list_index);
|
||||
|
||||
_vec_len (im->empty_buffers[cpu_index]) = l + n_alloc;
|
||||
|
@ -271,10 +271,10 @@ ipsec_output_node_fn (vlib_main_t * vm,
|
||||
p0 = ipsec_output_ip6_policy_match (spd0,
|
||||
&ip6_0->src_address,
|
||||
&ip6_0->dst_address,
|
||||
clib_net_to_host_u16 (udp0->
|
||||
src_port),
|
||||
clib_net_to_host_u16 (udp0->
|
||||
dst_port),
|
||||
clib_net_to_host_u16
|
||||
(udp0->src_port),
|
||||
clib_net_to_host_u16
|
||||
(udp0->dst_port),
|
||||
ip6_0->protocol);
|
||||
}
|
||||
else
|
||||
@ -291,16 +291,14 @@ ipsec_output_node_fn (vlib_main_t * vm,
|
||||
#endif
|
||||
|
||||
p0 = ipsec_output_policy_match (spd0, ip0->protocol,
|
||||
clib_net_to_host_u32 (ip0->
|
||||
src_address.
|
||||
as_u32),
|
||||
clib_net_to_host_u32 (ip0->
|
||||
dst_address.
|
||||
as_u32),
|
||||
clib_net_to_host_u16 (udp0->
|
||||
src_port),
|
||||
clib_net_to_host_u16 (udp0->
|
||||
dst_port));
|
||||
clib_net_to_host_u32
|
||||
(ip0->src_address.as_u32),
|
||||
clib_net_to_host_u32
|
||||
(ip0->dst_address.as_u32),
|
||||
clib_net_to_host_u16
|
||||
(udp0->src_port),
|
||||
clib_net_to_host_u16
|
||||
(udp0->dst_port));
|
||||
}
|
||||
|
||||
if (PREDICT_TRUE (p0 != NULL))
|
||||
|
@ -320,12 +320,10 @@ ip4_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
|
||||
ip4_map_decrement_ttl (ip40, &error0);
|
||||
ip4_map_decrement_ttl (ip41, &error1);
|
||||
bool df0 =
|
||||
ip40->
|
||||
flags_and_fragment_offset &
|
||||
ip40->flags_and_fragment_offset &
|
||||
clib_host_to_net_u16 (IP4_HEADER_FLAG_DONT_FRAGMENT);
|
||||
bool df1 =
|
||||
ip41->
|
||||
flags_and_fragment_offset &
|
||||
ip41->flags_and_fragment_offset &
|
||||
clib_host_to_net_u16 (IP4_HEADER_FLAG_DONT_FRAGMENT);
|
||||
|
||||
/* MAP calc */
|
||||
@ -487,8 +485,7 @@ ip4_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
|
||||
/* Decrement IPv4 TTL */
|
||||
ip4_map_decrement_ttl (ip40, &error0);
|
||||
bool df0 =
|
||||
ip40->
|
||||
flags_and_fragment_offset &
|
||||
ip40->flags_and_fragment_offset &
|
||||
clib_host_to_net_u16 (IP4_HEADER_FLAG_DONT_FRAGMENT);
|
||||
|
||||
/* MAP calc */
|
||||
@ -613,11 +610,11 @@ ip4_map_reass (vlib_main_t * vm,
|
||||
&map_domain_index0);
|
||||
|
||||
map_ip4_reass_lock ();
|
||||
map_ip4_reass_t *r =
|
||||
map_ip4_reass_get (ip40->src_address.as_u32,
|
||||
ip40->dst_address.as_u32,
|
||||
ip40->fragment_id, ip40->protocol,
|
||||
&fragments_to_drop);
|
||||
map_ip4_reass_t *r = map_ip4_reass_get (ip40->src_address.as_u32,
|
||||
ip40->dst_address.as_u32,
|
||||
ip40->fragment_id,
|
||||
ip40->protocol,
|
||||
&fragments_to_drop);
|
||||
if (PREDICT_FALSE (!r))
|
||||
{
|
||||
// Could not create a caching entry
|
||||
@ -711,9 +708,8 @@ ip4_map_reass (vlib_main_t * vm,
|
||||
vlib_increment_combined_counter (cm + MAP_DOMAIN_COUNTER_TX,
|
||||
cpu_index, map_domain_index0,
|
||||
1,
|
||||
clib_net_to_host_u16 (ip60->
|
||||
payload_length)
|
||||
+ 40);
|
||||
clib_net_to_host_u16
|
||||
(ip60->payload_length) + 40);
|
||||
next0 =
|
||||
(error0 == MAP_ERROR_NONE) ? next0 : IP4_MAP_REASS_NEXT_DROP;
|
||||
p0->error = error_node->errors[error0];
|
||||
|
@ -376,8 +376,8 @@ _ip4_map_t_icmp (map_domain_t * d, vlib_buffer_t * p, u8 * error)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* To shut up Coverity */
|
||||
os_panic();
|
||||
/* To shut up Coverity */
|
||||
os_panic ();
|
||||
}
|
||||
|
||||
//FIXME: Security check with the port found in the inner packet
|
||||
|
@ -870,11 +870,11 @@ ip6_map_ip4_reass (vlib_main_t * vm,
|
||||
|
||||
map_ip4_reass_lock ();
|
||||
//This node only deals with fragmented ip4
|
||||
map_ip4_reass_t *r =
|
||||
map_ip4_reass_get (ip40->src_address.as_u32,
|
||||
ip40->dst_address.as_u32,
|
||||
ip40->fragment_id, ip40->protocol,
|
||||
&fragments_to_drop);
|
||||
map_ip4_reass_t *r = map_ip4_reass_get (ip40->src_address.as_u32,
|
||||
ip40->dst_address.as_u32,
|
||||
ip40->fragment_id,
|
||||
ip40->protocol,
|
||||
&fragments_to_drop);
|
||||
if (PREDICT_FALSE (!r))
|
||||
{
|
||||
// Could not create a caching entry
|
||||
@ -968,8 +968,8 @@ ip6_map_ip4_reass (vlib_main_t * vm,
|
||||
vlib_increment_combined_counter (cm + MAP_DOMAIN_COUNTER_RX,
|
||||
cpu_index, map_domain_index0,
|
||||
1,
|
||||
clib_net_to_host_u16 (ip40->
|
||||
length));
|
||||
clib_net_to_host_u16
|
||||
(ip40->length));
|
||||
next0 =
|
||||
(error0 ==
|
||||
MAP_ERROR_NONE) ? next0 : IP6_MAP_IP4_REASS_NEXT_DROP;
|
||||
@ -1113,8 +1113,7 @@ ip6_map_icmp_relay (vlib_main_t * vm,
|
||||
|
||||
/* Check DF flag */
|
||||
if (!
|
||||
(inner_ip40->
|
||||
flags_and_fragment_offset &
|
||||
(inner_ip40->flags_and_fragment_offset &
|
||||
clib_host_to_net_u16 (IP4_HEADER_FLAG_DONT_FRAGMENT)))
|
||||
{
|
||||
error0 = MAP_ERROR_ICMP_RELAY;
|
||||
|
@ -128,8 +128,9 @@ ip6_get_port (ip6_header_t * ip6, map_dir_e dir, u16 buffer_len)
|
||||
if (l4_protocol == IP_PROTOCOL_TCP || l4_protocol == IP_PROTOCOL_UDP)
|
||||
{
|
||||
return (dir ==
|
||||
MAP_SENDER) ? ((udp_header_t *) (l4))->
|
||||
src_port : ((udp_header_t *) (l4))->dst_port;
|
||||
MAP_SENDER) ? ((udp_header_t *) (l4))->src_port : ((udp_header_t
|
||||
*)
|
||||
(l4))->dst_port;
|
||||
}
|
||||
else if (l4_protocol == IP_PROTOCOL_ICMP6)
|
||||
{
|
||||
@ -230,8 +231,7 @@ map_create_domain (ip4_address_t * ip4_prefix,
|
||||
memset (&adj, 0, sizeof (adj));
|
||||
adj.explicit_fib_index = ~0;
|
||||
adj.lookup_next_index =
|
||||
(d->
|
||||
flags & MAP_DOMAIN_TRANSLATION) ? IP_LOOKUP_NEXT_MAP_T :
|
||||
(d->flags & MAP_DOMAIN_TRANSLATION) ? IP_LOOKUP_NEXT_MAP_T :
|
||||
IP_LOOKUP_NEXT_MAP;
|
||||
p = (uword *) & adj.rewrite_data[0];
|
||||
*p = (uword) (*map_domain_index);
|
||||
@ -339,8 +339,7 @@ map_delete_domain (u32 map_domain_index)
|
||||
memset (&adj, 0, sizeof (adj));
|
||||
adj.explicit_fib_index = ~0;
|
||||
adj.lookup_next_index =
|
||||
(d->
|
||||
flags & MAP_DOMAIN_TRANSLATION) ? IP_LOOKUP_NEXT_MAP_T :
|
||||
(d->flags & MAP_DOMAIN_TRANSLATION) ? IP_LOOKUP_NEXT_MAP_T :
|
||||
IP_LOOKUP_NEXT_MAP;
|
||||
|
||||
/* Delete ip4 adjacency */
|
||||
|
@ -357,8 +357,8 @@ sr_replicate_node_fn (vlib_main_t * vm,
|
||||
(hdr_ip0->payload_length);
|
||||
}
|
||||
tr->next_index = next_index;
|
||||
if (hdr_sr0)
|
||||
memcpy (tr->sr, hdr_sr0, sizeof (tr->sr));
|
||||
if (hdr_sr0)
|
||||
memcpy (tr->sr, hdr_sr0, sizeof (tr->sr));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2591,7 +2591,7 @@ vl_api_sw_interface_clear_stats_t_handler (vl_api_sw_interface_clear_stats_t *
|
||||
int rv = 0;
|
||||
|
||||
if (mp->sw_if_index != ~0)
|
||||
VALIDATE_SW_IF_INDEX(mp);
|
||||
VALIDATE_SW_IF_INDEX (mp);
|
||||
|
||||
vec_reset_length (my_vnet_mains);
|
||||
|
||||
@ -5668,16 +5668,16 @@ send_lisp_eid_table_details (mapping_t * mapit,
|
||||
|
||||
switch (filter)
|
||||
{
|
||||
case 0: /* all mappings */
|
||||
case 0: /* all mappings */
|
||||
break;
|
||||
|
||||
case 1: /* local only */
|
||||
case 1: /* local only */
|
||||
if (!mapit->local)
|
||||
return;
|
||||
return;
|
||||
break;
|
||||
case 2: /* remote only */
|
||||
case 2: /* remote only */
|
||||
if (mapit->local)
|
||||
return;
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
clib_warning ("Filter error, unknown filter: %d", filter);
|
||||
@ -5754,7 +5754,7 @@ vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp)
|
||||
|
||||
mapit = pool_elt_at_index (lcm->mapping_pool, mi);
|
||||
send_lisp_eid_table_details (mapit, q, mp->context,
|
||||
0 /* ignore filter */);
|
||||
0 /* ignore filter */ );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -7100,7 +7100,7 @@ send_mpls_gre_tunnel_entry (vpe_api_main_t * am,
|
||||
e = pool_elt_at_index (mm->encaps, gt->encap_index);
|
||||
nlabels = vec_len (e->labels);
|
||||
|
||||
mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof(u32));
|
||||
mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32));
|
||||
memset (mp, 0, sizeof (*mp));
|
||||
mp->_vl_msg_id = ntohs (VL_API_MPLS_GRE_TUNNEL_DETAILS);
|
||||
mp->context = context;
|
||||
@ -7143,11 +7143,11 @@ vl_api_mpls_gre_tunnel_dump_t_handler (vl_api_mpls_gre_tunnel_dump_t * mp)
|
||||
if (index != ~0)
|
||||
{
|
||||
if (!pool_is_free_index (mm->gre_tunnels, index))
|
||||
{
|
||||
gt = pool_elt_at_index (mm->gre_tunnels, index);
|
||||
send_mpls_gre_tunnel_entry (am, q, gt, gt - mm->gre_tunnels,
|
||||
mp->context);
|
||||
}
|
||||
{
|
||||
gt = pool_elt_at_index (mm->gre_tunnels, index);
|
||||
send_mpls_gre_tunnel_entry (am, q, gt, gt - mm->gre_tunnels,
|
||||
mp->context);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -7182,7 +7182,7 @@ send_mpls_eth_tunnel_entry (vpe_api_main_t * am,
|
||||
e = pool_elt_at_index (mm->encaps, et->encap_index);
|
||||
nlabels = vec_len (e->labels);
|
||||
|
||||
mp = vl_msg_api_alloc (sizeof (*mp) + nlabels*sizeof(u32));
|
||||
mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32));
|
||||
memset (mp, 0, sizeof (*mp));
|
||||
mp->_vl_msg_id = ntohs (VL_API_MPLS_ETH_TUNNEL_DETAILS);
|
||||
mp->context = context;
|
||||
@ -7223,12 +7223,12 @@ vl_api_mpls_eth_tunnel_dump_t_handler (vl_api_mpls_eth_tunnel_dump_t * mp)
|
||||
|
||||
if (index != ~0)
|
||||
{
|
||||
if (!pool_is_free_index(mm->eth_tunnels, index))
|
||||
{
|
||||
et = pool_elt_at_index (mm->eth_tunnels, index);
|
||||
send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels,
|
||||
mp->context);
|
||||
}
|
||||
if (!pool_is_free_index (mm->eth_tunnels, index))
|
||||
{
|
||||
et = pool_elt_at_index (mm->eth_tunnels, index);
|
||||
send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels,
|
||||
mp->context);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -7262,7 +7262,7 @@ send_mpls_fib_encap_details (vpe_api_main_t * am,
|
||||
e = pool_elt_at_index (mm->encaps, s->entry_index);
|
||||
nlabels = vec_len (e->labels);
|
||||
|
||||
mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof(u32));
|
||||
mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32));
|
||||
memset (mp, 0, sizeof (*mp));
|
||||
mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_ENCAP_DETAILS);
|
||||
mp->context = context;
|
||||
@ -8118,7 +8118,7 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
struct passwd _pw, *pw;
|
||||
struct group _grp, *grp;
|
||||
clib_error_t *e;
|
||||
buf = vec_new(char,128);
|
||||
buf = vec_new (char, 128);
|
||||
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
|
||||
{
|
||||
if (unformat (input, "prefix %s", &chroot_path))
|
||||
@ -8134,10 +8134,12 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
{
|
||||
/* lookup the username */
|
||||
pw = NULL;
|
||||
while (((rv = getpwnam_r (s, &_pw, buf, vec_len (buf), &pw)) == ERANGE) && ( vec_len(buf) <= max_buf_size ))
|
||||
{
|
||||
vec_resize(buf,vec_len(buf)*2);
|
||||
}
|
||||
while (((rv =
|
||||
getpwnam_r (s, &_pw, buf, vec_len (buf), &pw)) == ERANGE)
|
||||
&& (vec_len (buf) <= max_buf_size))
|
||||
{
|
||||
vec_resize (buf, vec_len (buf) * 2);
|
||||
}
|
||||
if (rv < 0)
|
||||
{
|
||||
e = clib_error_return_code (0, rv,
|
||||
@ -8145,7 +8147,7 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
CLIB_ERROR_FATAL,
|
||||
"cannot fetch username %s", s);
|
||||
vec_free (s);
|
||||
vec_free (buf);
|
||||
vec_free (buf);
|
||||
return e;
|
||||
}
|
||||
if (pw == NULL)
|
||||
@ -8153,7 +8155,7 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
e =
|
||||
clib_error_return_fatal (0, "username %s does not exist", s);
|
||||
vec_free (s);
|
||||
vec_free (buf);
|
||||
vec_free (buf);
|
||||
return e;
|
||||
}
|
||||
vec_free (s);
|
||||
@ -8163,10 +8165,12 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
{
|
||||
/* lookup the group name */
|
||||
grp = NULL;
|
||||
while ( ( (rv = getgrnam_r (s, &_grp, buf, vec_len(buf), &grp)) == ERANGE ) && ( vec_len(buf) <= max_buf_size ) )
|
||||
{
|
||||
vec_resize(buf,vec_len(buf)*2);
|
||||
}
|
||||
while (((rv =
|
||||
getgrnam_r (s, &_grp, buf, vec_len (buf), &grp)) == ERANGE)
|
||||
&& (vec_len (buf) <= max_buf_size))
|
||||
{
|
||||
vec_resize (buf, vec_len (buf) * 2);
|
||||
}
|
||||
if (rv != 0)
|
||||
{
|
||||
e = clib_error_return_code (0, rv,
|
||||
@ -8174,18 +8178,18 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
CLIB_ERROR_FATAL,
|
||||
"cannot fetch group %s", s);
|
||||
vec_free (s);
|
||||
vec_free (buf);
|
||||
vec_free (buf);
|
||||
return e;
|
||||
}
|
||||
if (grp == NULL)
|
||||
{
|
||||
e = clib_error_return_fatal (0, "group %s does not exist", s);
|
||||
vec_free (s);
|
||||
vec_free (buf);
|
||||
vec_free (buf);
|
||||
return e;
|
||||
}
|
||||
vec_free (s);
|
||||
vec_free (buf);
|
||||
vec_free (buf);
|
||||
vl_set_memory_gid (grp->gr_gid);
|
||||
}
|
||||
else
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user