close (ssvm_fd);
return SSVM_API_ERROR_SET_SIZE;
}
-
+
if (write (ssvm_fd, &junk, 1) != 1)
{
clib_unix_warning ("set ssvm size");
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;
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);
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;
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;
}
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
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);
+ }
}
}
}
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))
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;
}
if (rv < 0)
{
clib_unix_warning ("FIONBIO");
- close(sockfd);
+ close (sockfd);
return ~0;
}
rv = listen (sockfd, 5);
if (rv < 0)
{
- close(sockfd);
+ close (sockfd);
return clib_error_return_unix (0, "listen");
}
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));
{
#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;
-
- 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;
-
- 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;
- }
+
+ 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;
+
+ 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;
+
+ 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);
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
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 */
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;
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;
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, ({
{
/* 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;
}
} 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)
}
/* Power Management Registers */
+/* *INDENT-OFF* */
typedef CLIB_PACKED (struct
{
pci_capability_regs_t header; u16 capabilities;
#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;
#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;
#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;
#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;
#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)
}
/* PCI Express capability registers */
+/* *INDENT-OFF* */
typedef CLIB_PACKED (struct
{
pci_capability_regs_t header; u16 pcie_capabilities;
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
} 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;
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
{
rv = pthread_setname_np (thread, name);
if (rv)
- clib_warning ("pthread_setname_np returned %d", rv);
+ clib_warning ("pthread_setname_np returned %d", rv);
}
}
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);
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");
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;
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
*
{
u8 *s;
int fd;
- clib_error_t * error = 0;
+ clib_error_t *error = 0;
fd = open (file_name, O_WRONLY);
if (fd < 0)
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);
}
{
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",
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 "
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
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);
}
}
}
}
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;
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
#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))
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 */
/* 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 */
&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
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];
}
else
{
- /* To shut up Coverity */
- os_panic();
+ /* To shut up Coverity */
+ os_panic ();
}
//FIXME: Security check with the port found in the inner packet
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
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;
/* 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;
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)
{
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);
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 */
(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));
}
}
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);
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);
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
{
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;
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
{
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;
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
{
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;
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))
{
/* 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,
CLIB_ERROR_FATAL,
"cannot fetch username %s", s);
vec_free (s);
- vec_free (buf);
+ vec_free (buf);
return e;
}
if (pw == NULL)
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);
{
/* 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,
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
}
static void *vl_api_lisp_enable_disable_t_print
- (vl_api_lisp_enable_disable_t * mp, void * handle)
+ (vl_api_lisp_enable_disable_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_enable_disable %s",
- mp->is_en ? "enable" : "disable");
+ mp->is_en ? "enable" : "disable");
FINISH;
}
static void *vl_api_lisp_gpe_add_del_iface_t_print
- (vl_api_lisp_gpe_add_del_iface_t * mp, void * handle)
+ (vl_api_lisp_gpe_add_del_iface_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_gpe_add_del_iface ");
}
static void *vl_api_lisp_pitr_set_locator_set_t_print
- (vl_api_lisp_pitr_set_locator_set_t * mp, void * handle)
+ (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
FINISH;
}
-static u8 * format_lisp_flat_eid (u8 * s, va_list * args)
+static u8 *
+format_lisp_flat_eid (u8 * s, va_list * args)
{
u32 type = va_arg (*args, u32);
- u8 * eid = va_arg (*args, u8 *);
+ u8 *eid = va_arg (*args, u8 *);
u32 eid_len = va_arg (*args, u32);
switch (type)
return 0;
}
-static u8 * format_lisp_eid_vat (u8 * s, va_list * args)
+static u8 *
+format_lisp_eid_vat (u8 * s, va_list * args)
{
u32 type = va_arg (*args, u32);
- u8 * eid = va_arg (*args, u8 *);
+ u8 *eid = va_arg (*args, u8 *);
u32 eid_len = va_arg (*args, u32);
- u8 * seid = va_arg (*args, u8 *);
+ u8 *seid = va_arg (*args, u8 *);
u32 seid_len = va_arg (*args, u32);
u32 is_src_dst = va_arg (*args, u32);
}
/** Used for transferring locators via VPP API */
-typedef CLIB_PACKED(struct
-{
- u8 is_ip4; /**< is locator an IPv4 address */
- u8 priority; /**< locator priority */
- u8 weight; /**< locator weight */
- u8 addr[16]; /**< IPv4/IPv6 address */
-}) rloc_t;
+typedef CLIB_PACKED (struct
+ {
+ u8 is_ip4;
+ /**< is locator an IPv4 address */
+ u8 priority;
+ /**< locator priority */
+ u8 weight;
+ /**< locator weight */
+ u8 addr[16];
+ /**< IPv4/IPv6 address */
+ }) rloc_t;
-static u8 * format_rloc (u8 * s, va_list * args)
+static u8 *
+format_rloc (u8 * s, va_list * args)
{
- rloc_t * rloc = va_arg (*args, rloc_t *);
+ rloc_t *rloc = va_arg (*args, rloc_t *);
if (rloc->is_ip4)
s = format (s, "%U ", format_ip4_address, rloc->addr);
}
static void *vl_api_lisp_add_del_remote_mapping_t_print
- (vl_api_lisp_add_del_remote_mapping_t * mp, void * handle)
+ (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
u32 i, rloc_num = 0;
s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
s = format (s, "deid %U ", format_lisp_eid_vat,
- mp->eid_type, mp->eid, mp->eid_len, mp->seid, mp->seid_len,
- mp->is_src_dst);
+ mp->eid_type, mp->eid, mp->eid_len, mp->seid, mp->seid_len,
+ mp->is_src_dst);
rloc_num = mp->rloc_num;
s = format (s, "action %d", mp->action);
else
{
- rloc_t * rloc = (rloc_t *) mp->rlocs;
+ rloc_t *rloc = (rloc_t *) mp->rlocs;
for (i = 0; i < rloc_num; i++)
- s = format (s, "%U ", format_rloc, &rloc[i]);
+ s = format (s, "%U ", format_rloc, &rloc[i]);
}
FINISH;
}
static void *vl_api_lisp_add_del_adjacency_t_print
- (vl_api_lisp_add_del_adjacency_t * mp, void * handle)
+ (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_add_del_adjacency ");
s = format (s, "%s ", mp->is_add ? "add" : "del");
s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
s = format (s, "deid %U seid %U ",
- format_lisp_flat_eid, mp->eid_type, mp->deid, mp->deid_len,
- format_lisp_flat_eid, mp->eid_type, mp->seid, mp->seid_len);
+ format_lisp_flat_eid, mp->eid_type, mp->deid, mp->deid_len,
+ format_lisp_flat_eid, mp->eid_type, mp->seid, mp->seid_len);
FINISH;
}
static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
- (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void * handle)
+ (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
}
static void *vl_api_lisp_eid_table_add_del_map_t_print
- (vl_api_lisp_eid_table_add_del_map_t * mp, void * handle)
+ (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
s = format (s, "%s %d ",
- mp->is_l2 ? "bd_index" : "vrf",
- clib_net_to_host_u32 (mp->dp_table));
+ mp->is_l2 ? "bd_index" : "vrf",
+ clib_net_to_host_u32 (mp->dp_table));
FINISH;
}
static void *vl_api_lisp_add_del_local_eid_t_print
- (vl_api_lisp_add_del_local_eid_t * mp, void * handle)
+ (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_add_del_local_eid ");
s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
- mp->prefix_len);
+ mp->prefix_len);
s = format (s, "locator-set %s ", mp->locator_set_name);
FINISH;
}
static void *vl_api_lisp_gpe_add_del_fwd_entry_t_print
- (vl_api_lisp_gpe_add_del_fwd_entry_t * mp, void * handle)
+ (vl_api_lisp_gpe_add_del_fwd_entry_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_gpe_add_del_fwd_entry TODO");
}
static void *vl_api_lisp_add_del_map_resolver_t_print
- (vl_api_lisp_add_del_map_resolver_t * mp, void * handle)
+ (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
}
static void *vl_api_lisp_gpe_enable_disable_t_print
- (vl_api_lisp_gpe_enable_disable_t * mp, void * handle)
+ (vl_api_lisp_gpe_enable_disable_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_gpe_enable_disable ");
FINISH;
}
-typedef CLIB_PACKED(struct
-{
- u32 sw_if_index; /**< locator sw_if_index */
- u8 priority; /**< locator priority */
- u8 weight; /**< locator weight */
-}) ls_locator_t;
+typedef CLIB_PACKED (struct
+ {
+ u32 sw_if_index;
+ /**< locator sw_if_index */
+ u8 priority;
+ /**< locator priority */
+ u8 weight;
+ /**< locator weight */
+ }) ls_locator_t;
static u8 *
format_locator (u8 * s, va_list * args)
{
- ls_locator_t * l = va_arg (*args, ls_locator_t *);
+ ls_locator_t *l = va_arg (*args, ls_locator_t *);
return format (s, "sw_if_index %d p %d w %d",
- l->sw_if_index, l->priority, l->weight);
+ l->sw_if_index, l->priority, l->weight);
}
static void *vl_api_lisp_add_del_locator_set_t_print
- (vl_api_lisp_add_del_locator_set_t * mp, void * handle)
+ (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
u32 loc_num = 0, i;
- ls_locator_t * locs;
+ ls_locator_t *locs;
s = format (0, "SCRIPT: lisp_add_del_locator_set ");
}
static void *vl_api_lisp_add_del_locator_t_print
- (vl_api_lisp_add_del_locator_t * mp, void * handle)
+ (vl_api_lisp_add_del_locator_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_add_del_locator ");
}
static void *vl_api_lisp_locator_set_dump_t_print
- (vl_api_lisp_locator_set_dump_t * mp, void * handle)
+ (vl_api_lisp_locator_set_dump_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_locator_set_dump ");
}
static void *vl_api_lisp_eid_table_dump_t_print
- (vl_api_lisp_eid_table_dump_t * mp, void * handle)
+ (vl_api_lisp_eid_table_dump_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_eid_table_dump ");
{
s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
- mp->eid, mp->prefix_length);
+ mp->eid, mp->prefix_length);
switch (mp->filter)
- {
- case 1:
- s = format (s, "local ");
- break;
- case 2:
- s = format (s, "remote ");
- break;
- }
+ {
+ case 1:
+ s = format (s, "local ");
+ break;
+ case 2:
+ s = format (s, "remote ");
+ break;
+ }
}
FINISH;
}
foreach_custom_print_no_arg_function
#undef _
-
#define foreach_custom_print_function \
_(CREATE_LOOPBACK, create_loopback) \
_(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
_(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump) \
_(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
_(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump)
-
-
-void
+ void
vl_msg_api_custom_dump_configure (api_main_t * am)
{
#define _(n,f) am->msg_print_handlers[VL_API_##n] \