aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/sock_test_server.c
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2017-12-14 21:36:31 -0500
committerDamjan Marion <dmarion.lists@gmail.com>2017-12-15 10:11:15 +0000
commit9c5161aedff8e271cc036faeab58b665a3c8105e (patch)
treeee17e5e00c9a6ba72318f8f1ec186df2ac10e789 /src/vcl/sock_test_server.c
parent6390df300e6795e557f824e55b138837dabcf74b (diff)
VCL-LDPRELOAD: Fix Coverity Warning CID 178776
- Fix broken unit test code. - Check for NULL ptr in vppcom_session_attr() VPPCOM_ATTR_GET_*_ADDR endpoint parameters. Change-Id: I01169edce098ee855a9cba08893c2b08c93ea6c3 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'src/vcl/sock_test_server.c')
-rw-r--r--src/vcl/sock_test_server.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/src/vcl/sock_test_server.c b/src/vcl/sock_test_server.c
index 23fd46df012..b30dcf949b2 100644
--- a/src/vcl/sock_test_server.c
+++ b/src/vcl/sock_test_server.c
@@ -450,15 +450,6 @@ main (int argc, char **argv)
if (vppcom_session_attr (ssm->listen_fd, VPPCOM_ATTR_GET_FLAGS,
buffer, &buflen) != VPPCOM_OK)
printf ("\nGET_FLAGS2:Oh no, Mr. Biiiiiiiiiiiilllllll ! ! ! !\n");
-
- buflen = BUFLEN;
- if (vppcom_session_attr (ssm->listen_fd, VPPCOM_ATTR_GET_PEER_ADDR,
- buffer, &buflen) != VPPCOM_OK)
- printf ("\nGET_PEER_ADDR: Oh no, Mr. Biiiiiiiiiiiilllllll ! ! ! !\n");
- buflen = BUFLEN;
- if (vppcom_session_attr (ssm->listen_fd, VPPCOM_ATTR_GET_LCL_ADDR,
- buffer, &buflen) != VPPCOM_OK)
- printf ("\nGET_LCL_ADDR: Oh no, Mr. Biiiiiiiiiiiilllllll ! ! ! !\n");
#endif
#else
rv =
@@ -612,20 +603,28 @@ main (int argc, char **argv)
{
#ifdef VCL_TEST
#if VPPCOM_SESSION_ATTR_UNIT_TEST
- buflen = BUFLEN;
- if (vppcom_session_attr (client_fd, VPPCOM_ATTR_GET_NREAD,
- buffer, &buflen) < VPPCOM_OK)
- printf ("\nNREAD: Oh no, Mr. Biiiiiiiiiiiilllllll ! ! ! !\n");
- if (vppcom_session_attr (client_fd,
- VPPCOM_ATTR_GET_PEER_ADDR,
- buffer, &buflen) != VPPCOM_OK)
- printf ("\nGET_PEER_ADDR: Oh no, Mr. "
- "Biiiiiiiiiiiilllllll ! ! ! !\n");
- buflen = BUFLEN;
- if (vppcom_session_attr (client_fd, VPPCOM_ATTR_GET_LCL_ADDR,
- buffer, &buflen) != VPPCOM_OK)
- printf ("\nGET_LCL_ADDR: Oh no, Mr. "
- "Biiiiiiiiiiiilllllll ! ! ! !\n");
+ {
+ vppcom_endpt_t ep;
+ uint8_t addr[16];
+
+ ep.ip = addr;
+ buflen = BUFLEN;
+ if (vppcom_session_attr (client_fd, VPPCOM_ATTR_GET_NREAD,
+ buffer, &buflen) < VPPCOM_OK)
+ printf ("\nNREAD: Oh no, Mr. "
+ "Biiiiiiiiiiiilllllll ! ! ! !\n");
+ buflen = sizeof (ep);
+ if (vppcom_session_attr (client_fd,
+ VPPCOM_ATTR_GET_PEER_ADDR,
+ &ep, &buflen) != VPPCOM_OK)
+ printf ("\nGET_PEER_ADDR: Oh no, Mr. "
+ "Biiiiiiiiiiiilllllll ! ! ! !\n");
+ buflen = sizeof (ep);
+ if (vppcom_session_attr (client_fd, VPPCOM_ATTR_GET_LCL_ADDR,
+ &ep, &buflen) != VPPCOM_OK)
+ printf ("\nGET_LCL_ADDR: Oh no, Mr. "
+ "Biiiiiiiiiiiilllllll ! ! ! !\n");
+ }
#endif
#endif
rx_bytes = sock_test_read (client_fd, conn->buf,