Fix bug preventing table ID from being sent on ack

When RMR acks the receipt of a route table to Rt. Mgr. it
was failing to send the table ID.  This change fixes this
problem.

Issue-ID: RIC-232

Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Change-Id: I363df4d2b1ecc8432ed7767edfabbf78c575838d
diff --git a/CHANGES b/CHANGES
index 40dad93..eb98292 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
 API and build change  and fix summaries. Doc correctsions
 and/or changes are not mentioned here; see the commit messages.
 
+2020 February 28; Version 2.3.6
+	Fix bug in Rt. Mgr comm which prevented table ID from being
+	sent on ack message (RIC-232).
+
 2020 February 26; version 3.2.5
 	Fix source address bug in SI95 receive/send funcitons.
 	Fix threading issues involving session disconnection in SI95
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 03a441e..c0dc0ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,7 +38,7 @@
 
 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 "2" )
-set( patch_level "5" )
+set( patch_level "6" )
 
 set( install_root "${CMAKE_INSTALL_PREFIX}" )
 set( install_inc "include/rmr" )
diff --git a/src/rmr/common/include/rmr_agnostic.h b/src/rmr/common/include/rmr_agnostic.h
index c2139c3..c396097 100644
--- a/src/rmr/common/include/rmr_agnostic.h
+++ b/src/rmr/common/include/rmr_agnostic.h
@@ -317,7 +317,7 @@
 static endpoint_t* rt_ensure_ep( route_table_t* rt, char const* ep_name );
 
 // --------- route manager communications -----------------
-static void send_rt_ack( uta_ctx_t* ctx, int state, char* reason );
+static void send_rt_ack( uta_ctx_t* ctx, char* table_id, int state, char* reason );
 static int send_update_req( uta_ctx_t* pctx, uta_ctx_t* ctx );
 
 #endif
diff --git a/src/rmr/common/src/rt_generic_static.c b/src/rmr/common/src/rt_generic_static.c
index 16fddd1..ca45f4b 100644
--- a/src/rmr/common/src/rt_generic_static.c
+++ b/src/rmr/common/src/rt_generic_static.c
@@ -242,7 +242,7 @@
 	Context should be the PRIVATE context that we use for messages
 	to route manger and NOT the user's context.
 */
-static void send_rt_ack( uta_ctx_t* ctx, int state, char* reason ) {
+static void send_rt_ack( uta_ctx_t* ctx, char* table_id, int state, char* reason ) {
 	rmr_mbuf_t*	smsg;
 	
 	if( ctx == NULL || ctx->rtg_whid < 0 ) {
@@ -258,7 +258,7 @@
 		smsg->mtype = RMRRM_TABLE_STATE;
 		smsg->sub_id = 0;
 		snprintf( smsg->payload, 1024, "%s %s %s\n", state == RMR_OK ? "OK" : "ERR", 
-			ctx->table_id == NULL ? "<id-missing>" : ctx->table_id, reason == NULL ? "" : reason );
+			table_id == NULL ? "<id-missing>" : table_id, reason == NULL ? "" : reason );
 
 		smsg->len = strlen( smsg->payload ) + 1;
 	
@@ -723,7 +723,7 @@
 							rmr_vlog( RMR_VL_ERR, "rmr_rtc: RT update had wrong number of records: received %d expected %s\n",
 								ctx->new_rtable->updates, tokens[2] );
 							snprintf( wbuf, sizeof( wbuf ), "missing table records: expected %s got %d\n", tokens[2], ctx->new_rtable->updates );
-							send_rt_ack( pctx, RMR_OK, wbuf );
+							send_rt_ack( pctx, ctx->table_id, !RMR_OK, wbuf );
 							uta_rt_drop( ctx->new_rtable );
 							ctx->new_rtable = NULL;
 							break;
@@ -744,14 +744,14 @@
 							rt_stats( ctx->rtable );
 						}
 
-						send_rt_ack( pctx, RMR_OK, NULL );
+						send_rt_ack( pctx, ctx->table_id, RMR_OK, NULL );
 					} else {
 						if( DEBUG > 1 ) rmr_vlog_force( RMR_VL_DEBUG, "end of route table noticed, but one was not started!\n" );
 						ctx->new_rtable = NULL;
 					}
 				} else {															// start a new table.
 					if( ctx->new_rtable != NULL ) {									// one in progress?  this forces it out
-						send_rt_ack( pctx, !RMR_OK, "table not complete" );			// nack the one that was pending as end never made it
+						send_rt_ack( pctx, ctx->table_id, !RMR_OK, "table not complete" );			// nack the one that was pending as end never made it
 
 						if( DEBUG > 1 || (vlevel > 1) ) rmr_vlog_force( RMR_VL_DEBUG, "new table; dropping incomplete table\n" );
 						uta_rt_drop( ctx->new_rtable );
@@ -761,7 +761,7 @@
 						free( ctx->table_id );
 					}
 					if( ntoks >2 ) {
-						ctx->table_id = strdup( tokens[2] );
+						ctx->table_id = strdup( clip( tokens[2] ) );
 					} else {
 						ctx->table_id = NULL;
 					}
@@ -848,7 +848,7 @@
 						if( ctx->table_id != NULL ) {
 							free( ctx->table_id );
 						}
-						ctx->table_id = strdup( tokens[2] );
+						ctx->table_id = strdup( clip( tokens[2] ) );
 					}
 
 					ctx->new_rtable = uta_rt_clone_all( ctx->rtable );	// start with a clone of everything (endpts and entries)
diff --git a/test/unit_test.ksh b/test/unit_test.ksh
index 08811f6..35e3383 100755
--- a/test/unit_test.ksh
+++ b/test/unit_test.ksh
@@ -308,6 +308,7 @@
 if [[ -d ../build ]]
 then
 	export LD_LIBRARY_PATH=../build/lib:../build/lib64
+	export C_INCLUDE_PATH=../build/include
 else
 	if [[ -d ../.build ]]
 	then