Fix failure when in static only route table mode 46/3246/2 3.7.2
authorE. Scott Daniels <daniels@research.att.com>
Fri, 10 Apr 2020 16:11:30 +0000 (12:11 -0400)
committerE. Scott Daniels <daniels@research.att.com>
Fri, 10 Apr 2020 16:42:48 +0000 (12:42 -0400)
When the RMR_RTG_SVC environment variable is set to -1, RMR
should enter static route table only mode and not attempt to
listen for dynamic updates from the route manager. There was
a misinterpretation of the environment variable name when
checking for this value which was causing the initialisation
to fail.

Man pages were also updated to remove references to the
deprecated RMR_MAX_RCV_BYTES constant. The constant was
marked as being deprecated.

Issue-ID: RIC-331

Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Change-Id: I7b0b82397f3ad4f223682727213504d3fbdae518

CHANGES_CORE.txt
CMakeLists.txt
doc/src/man/rmr_call.3.xfm
doc/src/man/rmr_get_rcvfd.3.xfm
doc/src/man/rmr_mt_call.3.xfm
doc/src/man/rmr_wh_call.3.xfm
doc/src/man/rmr_wh_send_msg.3.xfm
src/rmr/common/include/rmr.h
src/rmr/si/src/rmr_si.c
src/rmr/si/src/sr_si_static.c

index e7c461a..3abf384 100644 (file)
@@ -5,6 +5,9 @@
 # API and build change  and fix summaries. Doc correctsions
 # and/or changes are not mentioned here; see the commit messages.
 
+2020 April 10; version 3.7.2
+       Fix bug related to static route table only mode (RIC-331)
+
 2020 April 9; version 3.7.1
        The max length restriction for receiving messages when using SI95 has
        been removed.  The length supplied during initialisation is used as
index 4aa5466..8fcc274 100644 (file)
@@ -40,7 +40,7 @@ cmake_minimum_required( VERSION 3.5 )
 
 set( major_version "3" )               # should be automatically populated from git tag later, but until CI process sets a tag we use this
 set( minor_version "7" )
-set( patch_level "1" )
+set( patch_level "2" )
 
 set( install_root "${CMAKE_INSTALL_PREFIX}" )
 set( install_inc "include/rmr" )
index dfd5e64..7d9ff0a 100644 (file)
@@ -119,10 +119,10 @@ how the transaction ID must be set.
     int retries_left = 5;               // max retries on dev not available
     int retry_delay = 50000;            // retry delay (usec)
     static rmr_mbuf_t*  mbuf = NULL;    // response msg
-    msg_t*  pm;                         // private message (payload)
+    msg_t*  pm;                         // application struct for payload
 
     // get a send buffer and reference the payload
-    mbuf = rmr_alloc_msg( mr, RMR_MAX_RCV_BYTES );
+    mbuf = rmr_alloc_msg( mr, sizeof( pm->req ) );
     pm = (msg_t*) mbuf->payload;
 
     // generate an xaction ID and fill in payload with data and msg type
index 5ad6f06..71b8d91 100644 (file)
@@ -85,8 +85,9 @@ int main() {
     rmr_mbuf_t* msg = NULL;
     int nready;
     int i;
+    int norm_msg_size = 1500;               // 95% messages are less than this
 
-    mrc = rmr_init( "43086", RMR_MAX_RCV_BYTES, RMRFL_NONE );
+    mrc = rmr_init( "43086", norm_msg_size, RMRFL_NONE );
     rcv_fd = rmr_get_rcvfd( mrc );
 
     ep_fd = epoll_create1( 0 );             // initialise epoll environment
index 0acd455..510349f 100644 (file)
@@ -147,10 +147,10 @@ how the transaction ID must be set.
 &ex_start
     int retries_left = 5;               // max retries on dev not available
     static rmr_mbuf_t*  mbuf = NULL;    // response msg
-    msg_t*  pm;                         // private message (payload)
+    msg_t*  pm;                         // appl message struct (payload)
 
     // get a send buffer and reference the payload
-    mbuf = rmr_alloc_msg( mr, RMR_MAX_RCV_BYTES );
+    mbuf = rmr_alloc_msg( mr, sizeof( pm->req ) );
     pm = (msg_t*) mbuf->payload;
 
     // generate an xaction ID and fill in payload with data and msg type
@@ -171,7 +171,7 @@ how the transaction ID must be set.
 
             usleep( retry_delay );
         }
+
         if( mbuf == NULL || mbuf->state != RMR_OK ) {
             rmr_free_msg( mbuf );        // safe if nil
             return NULL;
index cc3a82b..ed72218 100644 (file)
@@ -108,8 +108,9 @@ int main() {
         int i;
    rmr_mbuf_t*  sbuf;      // send buffer
    int     count = 0;
+   int     norm_msg_size = 1500;    // most messages fit in this size
 
-   mrc = rmr_init( "43086", RMR_MAX_RCV_BYTES, RMRFL_NONE );
+   mrc = rmr_init( "43086", norm_msg_size, RMRFL_NONE );
    if( mrc == NULL ) {
       fprintf( stderr, "[FAIL] unable to initialise RMR environment\n" );
       exit( 1 );
index 169c25d..b8c43b1 100644 (file)
@@ -141,8 +141,9 @@ int main() {
         int i;
    rmr_mbuf_t*  sbuf;      // send buffer
    int     count = 0;
+   int     norm_msg_size = 1500;  // most msg fit in this size
 
-   mrc = rmr_init( "43086", RMR_MAX_RCV_BYTES, RMRFL_NONE );
+   mrc = rmr_init( "43086", norm_msg_size, RMRFL_NONE );
    if( mrc == NULL ) {
       fprintf( stderr, "[FAIL] unable to initialise RMR environment\n" );
       exit( 1 );
index 3fc7677..478e08e 100644 (file)
@@ -39,7 +39,10 @@ extern "C" {
 #define RMR_MAX_MEID           32              // spece in header reserved for managed element id
 #define RMR_MAX_SRC                    64              // max length of hostname (which could be IPv6 addr with [...]:port so more than the 39 bytes of a plain addr
 #define RMR_MAX_SID                    32              // misc sender info/data (reserved)
-#define RMR_MAX_RCV_BYTES      (1024 * 64)             // max bytes we support in a receive message
+
+
+#define RMR_MAX_RCV_BYTES      1024 * 2        // DEPRECATED CONSTANT NAME as underlying transport no longer have a max receive size
+#define RMR_DEF_MSG_SIZE       1024    // default message size that applications might want to use
 
                                                                        // various flags for function calls
 #define RMRFL_NONE                     0x00    // no flags
index 78a90ff..7d7449f 100644 (file)
@@ -532,7 +532,7 @@ extern int rmr_set_rtimeout( void* vctx, int time ) {
                                that we know about. The _user_ should ensure that the supplied length also
                                includes the trace data length maximum as they are in control of that.
 */
-static void* init(  char* uproto_port, int max_msg_size, int flags ) {
+static void* init(  char* uproto_port, int def_msg_size, int flags ) {
        static  int announced = 0;
        uta_ctx_t*      ctx = NULL;
        char    bind_info[256];                         // bind info
@@ -581,7 +581,7 @@ static void* init(  char* uproto_port, int max_msg_size, int flags ) {
 
        ctx->send_retries = 1;                                                  // default is not to sleep at all; RMr will retry about 10K times before returning
        ctx->d1_len = 4;                                                                // data1 space in header -- 4 bytes for now
-       ctx->max_ibm = max_msg_size < 1024 ? 1024 : max_msg_size;                                       // larger than their request doesn't hurt
+       ctx->max_ibm = def_msg_size < 1024 ? 1024 : def_msg_size;                                       // larger than their request doesn't hurt
        ctx->max_ibm += sizeof( uta_mhdr_t ) + ctx->d1_len + ctx->d2_len + TP_HDR_LEN + 64;             // add in header size, transport hdr, and a bit of fudge
 
        ctx->mring = uta_mk_ring( 4096 );                               // message ring is always on for si
@@ -598,8 +598,8 @@ static void* init(  char* uproto_port, int max_msg_size, int flags ) {
 
 
        ctx->max_plen = RMR_MAX_RCV_BYTES;                              // max user payload lengh
-       if( max_msg_size > 0 ) {
-               ctx->max_plen = max_msg_size;
+       if( def_msg_size > 0 ) {
+               ctx->max_plen = def_msg_size;
        }
 
        // we're using a listener to get rtg updates, so we do NOT need this.
@@ -623,7 +623,7 @@ static void* init(  char* uproto_port, int max_msg_size, int flags ) {
                port = proto_port;                      // assume something like "1234" was passed
        }
 
-       if( (tok = getenv( "ENV_RTG_PORT" )) != NULL && atoi( tok ) < 1 ) {     // must check here -- if < 1 then we just start static file 'listener'
+       if( (tok = getenv( ENV_RTG_PORT )) != NULL && atoi( tok ) < 1 ) {       // must check here -- if < 1 then we just start static file 'listener'
                static_rtc = 1;
        }
 
@@ -699,10 +699,12 @@ static void* init(  char* uproto_port, int max_msg_size, int flags ) {
                ctx->rtable = rt_clone_space( NULL, NULL, 0 );          // creates an empty route table so that wormholes still can be used
        } else {
                if( static_rtc ) {
+                       rmr_vlog( RMR_VL_INFO, "rmr_init: file based route table only for context on port %s\n", uproto_port );
                        if( pthread_create( &ctx->rtc_th,  NULL, rtc_file, (void *) ctx ) ) {   // kick the rt collector thread as just file reader
                                rmr_vlog( RMR_VL_WARN, "rmr_init: unable to start static route table collector thread: %s", strerror( errno ) );
                        }
                } else {
+                       rmr_vlog( RMR_VL_INFO, "rmr_init: dynamic route table for context on port %s\n", uproto_port );
                        if( pthread_create( &ctx->rtc_th,  NULL, rtc, (void *) ctx ) ) {        // kick the real rt collector thread
                                rmr_vlog( RMR_VL_WARN, "rmr_init: unable to start dynamic route table collector thread: %s", strerror( errno ) );
                        }
@@ -733,8 +735,8 @@ static void* init(  char* uproto_port, int max_msg_size, int flags ) {
                without drastically changing anything. The user should invoke with RMRFL_NONE to
                avoid any misbehavour as there are internal flags which are suported
 */
-extern void* rmr_init( char* uproto_port, int max_msg_size, int flags ) {
-       return init( uproto_port, max_msg_size, flags & UFL_MASK  );            // ensure any internal flags are off
+extern void* rmr_init( char* uproto_port, int def_msg_size, int flags ) {
+       return init( uproto_port, def_msg_size, flags & UFL_MASK  );            // ensure any internal flags are off
 }
 
 /*
index 3919621..dac0cb5 100644 (file)
@@ -39,13 +39,13 @@ static void dump_n( char *p, char* label, int n ) {
 
 
        if( label ) {
-               fprintf( stderr, ">>>>> %s p=%p %d bytes\n", label, p, n );
+               fprintf( stderr, "[DUMP] %s p=%p %d bytes\n", label, p, n );
        }
 
        rows = (n/16) + ((n % 16) ? 1 : 0);
 
        for( j = 0; j < rows; j++ ) {
-               fprintf( stderr, "%04x: ", j * 16 );
+               fprintf( stderr, "[DUMP] %04x: ", j * 16 );
 
                for( i = 0; t < n && i < 16; i++, t++ ) {
                        fprintf( stderr, "%02x ", (unsigned char) *p );