From: E. Scott Daniels Date: Fri, 11 Sep 2020 13:51:52 +0000 (-0400) Subject: Fix core dump in rmr_probe when -r option given X-Git-Tag: 4.2.2^0 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F4693%2F1;p=ric-plt%2Flib%2Frmr.git Fix core dump in rmr_probe when -r option given When the '-r' option was given on the rmr_probe command line the process would core dump. This change corrects the argument parsing code that was the source of the problem. Issue-ID: RIC-644 Signed-off-by: E. Scott Daniels Change-Id: I02b5b0ba211de1ec0458e8c83d2f2ccf97523825 --- diff --git a/CHANGES_CORE.txt b/CHANGES_CORE.txt index 4df9b24..20fb7cc 100644 --- a/CHANGES_CORE.txt +++ b/CHANGES_CORE.txt @@ -5,6 +5,10 @@ # API and build change and fix summaries. Doc correctsions # and/or changes are not mentioned here; see the commit messages. +2020 August 4; Version 4.2.2 + Correct bug in the rmr_probe support utility when -r option is used + on the command line (RIC-644) + 2020 August 4; Version 4.2.1 Add additional environment variable dump if RMR_LOG_VLEVEL set to 4 at start. diff --git a/CMakeLists.txt b/CMakeLists.txt index 2479654..cef3e5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ cmake_minimum_required( VERSION 3.5 ) set( major_version "4" ) # should be automatically populated from git tag later, but until CI process sets a tag we use this set( minor_version "2" ) -set( patch_level "1" ) +set( patch_level "2" ) set( install_root "${CMAKE_INSTALL_PREFIX}" ) set( install_inc "include/rmr" ) diff --git a/docs/rel-notes.rst b/docs/rel-notes.rst index 3399fe4..b38175f 100644 --- a/docs/rel-notes.rst +++ b/docs/rel-notes.rst @@ -22,6 +22,14 @@ the need to leap frog versions ceased, and beginning with version 4.0.0, the RMR versions should no longer skip. +2020 August 4; Version 4.2.2 +---------------------------- + +Correct bug in the rmr_probe support utility when -r option +is used on the command line (RIC-644) + + + 2020 August 4; Version 4.2.1 ---------------------------- diff --git a/src/support/rmr_probe.c b/src/support/rmr_probe.c index b6df5eb..f3d5858 100644 --- a/src/support/rmr_probe.c +++ b/src/support/rmr_probe.c @@ -21,16 +21,16 @@ /* Mnemonic: rmr_probe.c Abstract: This sends probe messages to the indicated applications. The only - use currently is to send health check messages and wait for a + use currently is to send health check messages and wait for a response. It might be extended later and would cause a bit of a redesign, but from the outside the switch to the name rmr_probe - makes sense. + makes sense. Original abstract which stands until the probe does more: This is a generic, and very simplistic, health check application which will send n RMR messages to an application (localhost:4560 by default) and expect to receive n responses. Messages are sent - with the message type RIC_HEALTH_CHECK_REQ and responses are + with the message type RIC_HEALTH_CHECK_REQ and responses are expected to have a message type RIC_HEALTH_CHECK_RESP (defined in the RIC message type header file). @@ -41,7 +41,7 @@ to indicate the state of the response. The ERR token may optionally be followed with a text string; when present it will be written on - standard error as an aide to problem determination if needed. + standard error as an aide to problem determination if needed. The programme exit code will be 0 on success (all received messages had the OK token), or 1 to indicate failure. A failure reason will @@ -114,11 +114,12 @@ static int elapsed( struct timespec* start_ts, struct timespec* end_ts ) { } static void usage( char* arg0 ) { - + fprintf( stderr, "version 1.0.0\n" - "usage: %s [-h host:port] [-n msg-count] [-r] [-t seconds] [-v]\n" + "usage: %s [-h host:port] [-n msg-count] [-p port | -r] [-t seconds] [-v]\n" "\thost:port may be ip-address:port or name:port of the application\n" "\tmsg-count is the number of health check requests sent; default is 1\n" + "\t-p uses the given port instead of assigning a random port (-r ignored if given)\n" "\t-r causes a random listen port NOT to be used; 43086 is used instead\n" "\t-v enables some amount of extra verbose output to stderr\n", arg0 ); } @@ -127,7 +128,7 @@ int main( int argc, char** argv ) { int ai = 1; // arg index int i; - void* mrc; // msg router context + void* mrc; // msg router context rmr_mbuf_t* mbuf; // message buffer char* payload; // direct reference to msg payload long expiry; // point at which we give up (expire) @@ -169,7 +170,7 @@ int main( int argc, char** argv ) { case 'r': // generate random listen port rand_port = 0; - ;; + break; case 't': // timeout ai++; @@ -195,7 +196,7 @@ int main( int argc, char** argv ) { } } - + if( listen_port == NULL ) { if( rand_port ) { // generate a somewhat random listen port (RMR needs) srand( time( NULL ) );