{
ip4_fib_mtrie_leaf_t old_leaf, del_leaf;
i32 n_dst_bits_next_plies;
- uword i, n_dst_bits_this_ply, old_leaf_is_terminal;
+ i32 i, n_dst_bits_this_ply, old_leaf_is_terminal;
u8 dst_byte;
ASSERT (a->dst_address_length > 0 && a->dst_address_length <= 32);
/* check for MTU or prefix options or .. */
u8 * opt_hdr = (u8 *)(h0 + 1);
- while( options_len0 > 0)
+ while( options_len0 > 0 &&
+ opt_hdr < p0->data + p0->current_data)
{
icmp6_neighbor_discovery_option_header_t *o0 = ( icmp6_neighbor_discovery_option_header_t *)opt_hdr;
int opt_len = o0->n_data_u64s << 3;
a->min_delay_between_radv = MIN_DELAY_BETWEEN_RAS;
a->max_delay_between_radv = MAX_DELAY_BETWEEN_RAS;
a->max_rtr_default_lifetime = MAX_DEF_RTR_LIFETIME;
- a->seed = random_default_seed();
+ a->seed = (u32) (clib_cpu_time_now() & 0xFFFFFFFF);
/* for generating random interface ids */
- a->randomizer = 0x1119194911191949;
- a->randomizer = random_u64 ((u32 *)&a->randomizer);
+ a->randomizer = random_u64 (&a->seed);
a->initial_adverts_count = MAX_INITIAL_RTR_ADVERTISEMENTS ;
a->initial_adverts_sent = a->initial_adverts_count-1;
}
else
{
- ASSERT (0); // We had a port from that, so it is udp or tcp or ICMP
+ /* To shut up Coverity */
+ os_panic();
}
//FIXME: Security check with the port found in the inner packet
(hdr_ip0->payload_length);
}
tr->next_index = next_index;
- memcpy (tr->sr, hdr_sr0, sizeof (tr->sr));
+ if (hdr_sr0)
+ memcpy (tr->sr, hdr_sr0, sizeof (tr->sr));
}
}
clib_unix_warning ("TUNSETPERSIST");
close(tm->dev_tap_fd);
if (tm->dev_net_tun_fd >= 0)
- close(tm->dev_net_tun_fd);
- close (sfd);
+ close(tm->dev_net_tun_fd);
+ if (sfd >= 0)
+ close (sfd);
return 0;
}
if (ioctl (sockfd, SIOCSIFADDR, &ifr6) < 0)
clib_unix_warning ("set address");
- close (sockfd);
+ if (sockfd >= 0)
+ close (sockfd);
}
else
{
vlib_combined_counter_main_t *cm;
static vnet_main_t **my_vnet_mains;
int i, j, n_counters;
-
int rv = 0;
+ if (mp->sw_if_index != ~0)
+ VALIDATE_SW_IF_INDEX(mp);
+
vec_reset_length (my_vnet_mains);
for (i = 0; i < vec_len (vnet_mains); i++)
}
}
+ BAD_SW_IF_INDEX_LABEL;
+
REPLY_MACRO (VL_API_SW_INTERFACE_CLEAR_STATS_REPLY);
}
vl_api_ipfix_details_t *rmp;
q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (!q)
+ return;
rmp = vl_msg_api_alloc (sizeof (*rmp));
memset (rmp, 0, sizeof (*rmp));
}
// Validate mask_length
- if (mask_length < 0 ||
- (is_ipv6 && mask_length > 128) || (!is_ipv6 && mask_length > 32))
+ if ((is_ipv6 && mask_length > 128) || (!is_ipv6 && mask_length > 32))
{
rv = VNET_API_ERROR_ADDRESS_LENGTH_MISMATCH;
goto reply;
test_macros \
test_md5 \
test_mheap \
- test_pfhash \
- test_phash \
test_pool_iterate \
test_ptclosure \
- test_qhash \
test_random \
test_random_isaac \
test_serialize \
test_macros_SOURCES = vppinfra/test_macros.c
test_md5_SOURCES = vppinfra/test_md5.c
test_mheap_SOURCES = vppinfra/test_mheap.c
-test_pfhash_SOURCES = vppinfra/test_pfhash.c
-test_phash_SOURCES = vppinfra/test_phash.c
test_pool_iterate_SOURCES = vppinfra/test_pool_iterate.c
test_ptclosure_SOURCES = vppinfra/test_ptclosure.c
-test_qhash_SOURCES = vppinfra/test_qhash.c
test_random_SOURCES = vppinfra/test_random.c
test_random_isaac_SOURCES = vppinfra/test_random_isaac.c
test_serialize_SOURCES = vppinfra/test_serialize.c
test_macros_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
test_md5_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
test_mheap_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
-test_pfhash_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
-test_phash_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
test_pool_iterate_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
test_ptclosure_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
-test_qhash_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
test_random_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
test_random_isaac_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
test_socket_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
test_macros_LDADD = libvppinfra.la
test_md5_LDADD = libvppinfra.la
test_mheap_LDADD = libvppinfra.la
-test_pfhash_LDADD = libvppinfra.la
-test_phash_LDADD = libvppinfra.la
test_pool_iterate_LDADD = libvppinfra.la
test_ptclosure_LDADD = libvppinfra.la
-test_qhash_LDADD = libvppinfra.la
test_random_LDADD = libvppinfra.la
test_random_isaac_LDADD = libvppinfra.la
test_serialize_LDADD = libvppinfra.la
test_macros_LDFLAGS = -static
test_md5_LDFLAGS = -static
test_mheap_LDFLAGS = -static
-test_pfhash_LDFLAGS = -static
-test_phash_LDFLAGS = -static
test_pool_iterate_LDFLAGS = -static
test_ptclosure_LDFLAGS = -static
-test_qhash_LDFLAGS = -static
test_random_LDFLAGS = -static
test_random_isaac_LDFLAGS = -static
test_serialize_LDFLAGS = -static
vppinfra/mheap.h \
vppinfra/mheap_bootstrap.h \
vppinfra/os.h \
- vppinfra/pfhash.h \
- vppinfra/phash.h \
vppinfra/pipeline.h \
vppinfra/pool.h \
vppinfra/ptclosure.h \
- vppinfra/qhash.h \
vppinfra/random.h \
vppinfra/random_buffer.h \
vppinfra/random_isaac.h \
vppinfra/mheap.c \
vppinfra/md5.c \
vppinfra/mem_mheap.c \
- vppinfra/pfhash.c \
- vppinfra/phash.c \
vppinfra/ptclosure.c \
- vppinfra/qhash.c \
vppinfra/random.c \
vppinfra/random_buffer.c \
vppinfra/random_isaac.c \
s = format (s, "\nSegments: %d at file offset 0x%Lx-0x%Lx:\n",
fh->segment_header_count,
fh->segment_header_file_offset,
- fh->segment_header_file_offset + fh->segment_header_count * fh->segment_header_size);
+ (u64) fh->segment_header_file_offset + fh->segment_header_count * fh->segment_header_size);
s = format (s, "%U\n", format_elf_segment, 0);
vec_foreach (h, copy)
/* Finally write section headers. */
if (fseek (f, em->file_header.section_header_file_offset, SEEK_SET) < 0)
- return clib_error_return_unix (0, "fseek 0x%Lx", em->file_header.section_header_file_offset);
-
+ {
+ fclose(f);
+ return clib_error_return_unix
+ (0, "fseek 0x%Lx", em->file_header.section_header_file_offset);
+ }
+
vec_foreach (s, em->sections)
{
elf64_section_header_t h;
else
{
log2_bytes = 1 + hash_pair_log2_bytes (h);
- q = clib_mem_alloc (1 << log2_bytes);
+ q = clib_mem_alloc (1ULL << log2_bytes);
}
clib_memcpy (q, &p->direct, hash_pair_bytes (h));
log2_bytes = indirect_pair_get_log2_bytes (pi);
new_len = len + 1;
- if (new_len * hash_pair_bytes (h) > (1 << log2_bytes))
+ if (new_len * hash_pair_bytes (h) > (1ULL << log2_bytes))
{
pi->pairs = clib_mem_realloc (pi->pairs,
1 << (log2_bytes + 1),
/* Size of hash is power of 2 >= ELTS and larger than
number of bits in is_user bitmap elements. */
elts = clib_max (elts, BITS (h->is_user[0]));
- elts = 1 << max_log2 (elts);
+ elts = 1ULL << max_log2 (elts);
log2_pair_size = 1;
if (h_user)
always_inline void * _heap_new (u32 len, u32 n_elt_bytes)
{
- void * v = _vec_resize (0, len, len*n_elt_bytes,
+ void * v = _vec_resize (0, len, (uword) len*n_elt_bytes,
sizeof (heap_header_t),
HEAP_DATA_ALIGN);
heap_header (v)->elt_bytes = n_elt_bytes;
unserialize_integer (m, &l, sizeof (l));
if (l > max_length)
serialize_error (&m->header, clib_error_create ("bad vector length %d", l));
- p = v = _vec_resize (0, l, l*elt_bytes, header_bytes, /* align */ align);
+ p = v = _vec_resize (0, l, (uword) l*elt_bytes, header_bytes,
+ /* align */ align);
while (l != 0)
{
return 0;
}
- v = _vec_resize (0, l, l*elt_bytes, sizeof (p[0]), align);
+ v = _vec_resize (0, l, (uword) l*elt_bytes, sizeof (p[0]), align);
p = pool_header (v);
vec_unserialize (m, &p->free_indices, unserialize_vec_32);
for (i = 0; i < vec_len (head_elt->n.nexts); i++)
{
- s = format (s, "level %d: %d elts\n", i, sl->occupancy[i]);
+ s = format (s, "level %d: %d elts\n", i,
+ sl->occupancy ? sl->occupancy[i] : 0);
if (verbose && head_elt->n.nexts[i] != (u32)~0)
{
/* Initialize time_resolution before first call to timer_interrupt */
time_resolution = 0.75 / (f64) HZ;
+ memset (&sa, 0, sizeof (sa));
sa.sa_handler = timer_interrupt;
- sa.sa_flags = 0;
if (sigaction (TIMER_SIGNAL, &sa, 0) < 0)
clib_panic ("sigaction");