summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2017-10-19 03:53:57 -0400
committerKeith Burns <alagalah@gmail.com>2017-10-19 14:28:37 +0000
commit7876d39f1453fc4db68cd3c43a2d7fe062e7f832 (patch)
tree008ea3a38d531d1fd9f316f384667fb9b77260ac
parent86b8e26b331bb6db4ce69aa9fa7c0ea1392b985d (diff)
VCL: cleanup misc. issues in vppcom
- Fix vppcom_select crash when n_bits == 0 - Enhance debug output - Remove port byte-swapping during accept Change-Id: I6ccd1040ceb82908d924220f558df803ab5eea30 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
-rw-r--r--src/uri/vppcom.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/uri/vppcom.c b/src/uri/vppcom.c
index 5d1373fb0ea..8d254cc4924 100644
--- a/src/uri/vppcom.c
+++ b/src/uri/vppcom.c
@@ -1014,7 +1014,7 @@ vl_api_accept_session_t_handler (vl_api_accept_session_t * mp)
session->state = STATE_ACCEPT;
session->is_cut_thru = 0;
session->is_server = 1;
- session->port = ntohs (mp->port);
+ session->port = mp->port;
session->peer_addr.is_ip4 = mp->is_ip4;
clib_memcpy (&session->peer_addr.ip46, mp->ip,
sizeof (session->peer_addr.ip46));
@@ -2198,9 +2198,10 @@ vppcom_session_connect (uint32_t session_index, vppcom_endpt_t * server_ep)
u8 *ip_str = format (0, "%U", format_ip46_address,
&session->peer_addr.ip46,
session->peer_addr.is_ip4);
- clib_warning ("[%d] connect sid %d to %s server port %d",
+ clib_warning ("[%d] connect sid %d to %s server port %d proto %s",
vcm->my_pid, session_index, ip_str,
- clib_net_to_host_u16 (session->port));
+ clib_net_to_host_u16 (session->port),
+ session->proto ? "UDP" : "TCP");
vec_free (ip_str);
}
@@ -2215,6 +2216,9 @@ vppcom_session_connect (uint32_t session_index, vppcom_endpt_t * server_ep)
vcm->my_pid, vppcom_retval_str (rv), rv);
return rv;
}
+ if (VPPCOM_DEBUG > 0)
+ clib_warning ("[%d] sid %d connected!", vcm->my_pid, session_index);
+
return VPPCOM_OK;
}
@@ -2487,19 +2491,19 @@ vppcom_select (unsigned long n_bits, unsigned long *read_map,
ASSERT (sizeof (clib_bitmap_t) == sizeof (long int));
- if (read_map)
+ if (n_bits && read_map)
{
clib_bitmap_validate (vcm->rd_bitmap, minbits);
clib_memcpy (vcm->rd_bitmap, read_map, vec_len (vcm->rd_bitmap));
memset (read_map, 0, vec_len (vcm->rd_bitmap));
}
- if (write_map)
+ if (n_bits && write_map)
{
clib_bitmap_validate (vcm->wr_bitmap, minbits);
clib_memcpy (vcm->wr_bitmap, write_map, vec_len (vcm->wr_bitmap));
memset (write_map, 0, vec_len (vcm->wr_bitmap));
}
- if (except_map)
+ if (n_bits && except_map)
{
clib_bitmap_validate (vcm->ex_bitmap, minbits);
clib_memcpy (vcm->ex_bitmap, except_map, vec_len (vcm->ex_bitmap));