From Ryan Kelly (ryan@rfk.id.au):

From Ryan Kelly (ryan@rfk.id.au):

I was just pawing through the Enchant sources for details on how PWLs
are handled, and I noticed that the patches I submitted for relocatable
binary support on windows inadvertently reintroduced another bug I'd
filed:  Bug #9233:  Should PWL filenames be normalized?

git-svn-id: 18bf4e4f0ca11a3471e5785d6da82074410339c6@21098 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6

--- src/enchant.c
+++ src/enchant.c
@@ -1121,25 +1121,21 @@
 {
 	EnchantSession *session;
 	EnchantDict *dict = NULL;
-	char * normalized_pwl;

 	g_return_val_if_fail (broker, NULL);
 	g_return_val_if_fail (pwl && strlen(pwl), NULL);

 	enchant_broker_clear_error (broker);

-	normalized_pwl = enchant_normalize_dictionary_tag (pwl);
-	dict = (EnchantDict*)g_hash_table_lookup (broker->dict_map, (gpointer) normalized_pwl);
+	dict = (EnchantDict*)g_hash_table_lookup (broker->dict_map, (gpointer) pwl);
 	if (dict) {
-		g_free (normalized_pwl);
 		return dict;
 	}

 	session = enchant_session_new_with_pwl (NULL, pwl, "Personal WordList", TRUE);
 	if (!session)
 		{
-			broker->error = g_strdup_printf ("Couldn't open personal wordlist '%s'", normalized_pwl);
-			g_free (normalized_pwl);
+			broker->error = g_strdup_printf ("Couldn't open personal wordlist '%s'", pwl);
 			return NULL;
 		}

@@ -1148,7 +1144,7 @@
 	dict = g_new0 (EnchantDict, 1);
 	dict->enchant_private_data = (void *)session;

-	g_hash_table_insert (broker->dict_map, (gpointer)g_strdup (normalized_pwl), dict);
+	g_hash_table_insert (broker->dict_map, (gpointer)g_strdup (pwl), dict);

 	return dict;
 }


Don't crash when resolving types.

Don't crash when resolving types.

--- parse/infer.c
+++ parse/infer.c
@@ -231,6 +231,8 @@
     if (t->resolved)
         return;
     t->resolved = 1;
+    if (t->type == Tygeneric)
+        t = tyspecialize(st, t);
     tybind(st, t);
     /* if this is a generic type, bind the params. */
     /* Walk through aggregate type members */
@@ -541,11 +543,6 @@
         a = b;
         b = t;
     }
-
-    if (a->type == Tygeneric)
-        a = tyspecialize(st, a);
-    if (b->type == Tygeneric)
-        b = tyspecialize(st, b);

     r = NULL;
     if (a->type == Tyvar) {
@@ -1012,8 +1009,7 @@
     Type *t;

     t = tf(st, decltype(n));
-    if (t->type == Tygeneric) {
-        t = tyspecialize(st, t);
+    if (decltype(n)->type == Tygeneric) {
         unifyparams(st, n, t, decltype(n));
     }
     settype(st, n, t);


Use RDO to check for transform skip mode

--- src/encoder.c
+++ src/encoder.c
@@ -1936,12 +1936,20 @@

       // Test for transform skip
       transformskip(block,pre_quant_coeff,width);
-      quant(encoder, pre_quant_coeff, temp_coeff, 4, 4, &ac_sum, 0, scan_idx_luma, cur_cu->type);
+      if (encoder->rdoq_enable) {
+        rdoq(encoder, pre_quant_coeff, temp_coeff, 4, 4, &ac_sum, 0, scan_idx_luma, cur_cu->type,0);
+      } else {
+        quant(encoder, pre_quant_coeff, temp_coeff, 4, 4, &ac_sum, 0, scan_idx_luma, cur_cu->type);
+      }
       dequant(encoder, temp_coeff, pre_quant_coeff, 4, 4, 0, cur_cu->type);
       itransformskip(temp_block,pre_quant_coeff,width);

       transform2d(block,pre_quant_coeff,width,0);
-      quant(encoder, pre_quant_coeff, temp_coeff2, 4, 4, &ac_sum, 0, scan_idx_luma, cur_cu->type);
+      if (encoder->rdoq_enable) {
+        rdoq(encoder, pre_quant_coeff, temp_coeff2, 4, 4, &ac_sum, 0, scan_idx_luma, cur_cu->type,0);
+      } else {
+        quant(encoder, pre_quant_coeff, temp_coeff2, 4, 4, &ac_sum, 0, scan_idx_luma, cur_cu->type);
+      }
       dequant(encoder, temp_coeff2, pre_quant_coeff, 4, 4, 0, cur_cu->type);
       itransform2d(temp_block2,pre_quant_coeff,width,0);

@@ -1949,14 +1957,21 @@
       for (i = 0; i < 16; i++) {
         int diff = temp_block[i]-block[i];
         cost += diff*diff;
-        coeffcost += abs((int)temp_coeff[i]);
+        //coeffcost += abs((int)temp_coeff[i]);

         diff = temp_block2[i] - block[i];
         cost2 += diff*diff;
-        coeffcost2 += abs((int)temp_coeff2[i]);
-      }
-      cost += (1 + coeffcost + (coeffcost>>1))*((int)g_cur_lambda_cost+0.5);
-      cost2 += (coeffcost2 + (coeffcost2>>1))*((int)g_cur_lambda_cost+0.5);
+        //coeffcost2 += abs((int)temp_coeff2[i]);
+      }
+      // TODO: add an option to use estimated RD-calculation
+      //cost += (1 + coeffcost + (coeffcost>>1))*((int)g_cur_lambda_cost+0.5);
+      //cost2 += (coeffcost2 + (coeffcost2>>1))*((int)g_cur_lambda_cost+0.5);
+
+      coeffcost = get_coeff_cost(encoder, temp_coeff, 4, 0);
+      coeffcost2 = get_coeff_cost(encoder, temp_coeff2, 4, 0);
+
+      cost  += coeffcost*((int)g_cur_lambda_cost+0.5);
+      cost2 += coeffcost2*((int)g_cur_lambda_cost+0.5);

       cur_cu->intra[PU_INDEX(x_pu, y_pu)].tr_skip = (cost < cost2);
     }


Improve error messages sligthly.

Improve error messages sligthly.

--- parse/infer.c
+++ parse/infer.c
@@ -1271,8 +1271,8 @@
             break;
         case Nmatchstmt:
             infernode(st, n->matchstmt.val, NULL, sawret);
-	    if (tybase(type(st, n->matchstmt.val))->type == Tyvoid)
-		fatal(n->line, "Can't match against a void type near %s", ctxstr(st, n->matchstmt.val));
+            if (tybase(type(st, n->matchstmt.val))->type == Tyvoid)
+                fatal(n->line, "Can't match against a void type near %s", ctxstr(st, n->matchstmt.val));
             for (i = 0; i < n->matchstmt.nmatches; i++) {
                 infernode(st, n->matchstmt.matches[i], ret, sawret);
                 unify(st, n, type(st, n->matchstmt.val), type(st, n->matchstmt.matches[i]->match.pat));
@@ -1310,9 +1310,10 @@

 /* returns the final type for t, after all unifications
  * and default constraint selections */
-static Type *tyfix(Inferstate *st, Node *ctx, Type *t)
+static Type *tyfix(Inferstate *st, Node *ctx, Type *orig)
 {
     static Type *tyint, *tyflt;
+    Type *t, *delayed;
     size_t i;
     char buf[1024];

@@ -1321,9 +1322,15 @@
     if (!tyflt)
         tyflt = mktype(-1, Tyfloat64);

-    t = tysearch(st, t);
-    if (hthas(st->delayed, t))
-        t = htget(st->delayed, t);
+    t = tysearch(st, orig);
+    printf("Orig: %s, t: %s\n", tystr(orig), tystr(t));
+    if (orig->type == Tyvar && hthas(st->delayed, orig)) {
+        delayed = htget(st->delayed, orig);
+        if (t->type == Tyvar)
+            t = delayed;
+        else if (tybase(t)->type != delayed->type)
+            fatal(ctx->line, "Type %s not compatible with %s near %s\n", tystr(t), tystr(delayed), ctxstr(st, ctx));
+    }
     if (t->type == Tyvar) {
         if (hascstr(t, cstrtab[Tcint]) && cstrcheck(t, tyint))
             return tyint;


Fix warning and limit intra qp offset to -3

--- src/encoder.c
+++ src/encoder.c
@@ -246,7 +246,8 @@
   }

   if( encoder->cfg.intra_qp_offset_auto ) {
-      encoder->cfg.intra_qp_offset = encoder->cfg.gop_len > 1 ? -kvz_math_ceil_log2( encoder->cfg.gop_len ) + 1 : 0;
+    // Limit offset to -3 since HM/VTM seems to use it even for 32 frame gop
+    encoder->cfg.intra_qp_offset = encoder->cfg.gop_len > 1 ? MAX(-(int8_t)kvz_math_ceil_log2( encoder->cfg.gop_len ) + 1, -3) : 0;
   }

   // Disable GOP and QP offset for all-intra coding


Add more details to comment about EC PARAMETERS parsing

--- stuffer/s2n_stuffer_pem.c
+++ stuffer/s2n_stuffer_pem.c
@@ -116,7 +116,11 @@
     s2n_stuffer_reread(pem);
     s2n_stuffer_reread(asn1);

-    /* Try EC private key, skipping EC PARAMETERS if it exists. For now, only support standard curves. */
+    /* By default, OpenSSL tools always generate both "EC PARAMETERS" and "EC PRIVATE
+     * KEY" PEM objects in the keyfile. Skip the first "EC PARAMETERS" object so that we're
+     * compatible with OpenSSL's default output, and since "EC PARAMETERS" is
+     * only needed for non-standard curves that aren't currently supported.
+     */
     rc = s2n_stuffer_data_from_pem(pem, asn1, S2N_PEM_EC_PARAMETERS);
     if (rc < 0) {
         s2n_stuffer_reread(pem);


logging: log_core: Clarify message when log_strdup failed allocation

Don't say that pool is empty, say that allocation failed, because
that's what happened (because the pool is full apparently).

Partially addresses #11007.

Signed-off-by: Paul Sokolovsky <35cb557f011771c94f127d6fef99f804b62203f5@linaro.org>

--- subsys/logging/log_core.c
+++ subsys/logging/log_core.c
@@ -26,7 +26,7 @@
 #define LOG_STRDUP_POOL_BUFFER_SIZE \
 	(sizeof(struct log_strdup_buf) * CONFIG_LOG_STRDUP_BUF_COUNT)

-static const char *log_strdup_fail_msg = "log_strdup pool empty!";
+static const char *log_strdup_fail_msg = "<log_strdup alloc failed>";
 struct k_mem_slab log_strdup_pool;
 static u8_t __noinit __aligned(sizeof(u32_t))
 		log_strdup_pool_buf[LOG_STRDUP_POOL_BUFFER_SIZE];


(svn_wc__entries_recurse): document.

(svn_wc__entries_recurse): document.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@837687 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_wc/wc.h
+++ subversion/libsvn_wc/wc.h
@@ -401,6 +401,70 @@
                                                     svn_string_t *basename,
                                                     void *baton);

+/* Recurse on the versioned parts of a working copy tree, starting at
+ * PATH.
+ *
+ * Each time a directory is entered, ENTER_DIR is called with the
+ * directory's path and the BATON as arguments.
+ *
+ * Each time a directory is left, LEAVE_DIR is called with the
+ * directory's path and the BATON as arguments.
+ *
+ * Each time a file is seen, HANDLE_FILE is called with the parent
+ * directory, the file's basename, and the BATON as arguments.
+ *
+ * If NAMED_TARGETS is non-null, then those functions are only invoked
+ * on directories and files whose names are included (perhaps
+ * implicitly) in NAMED_TARGETS:
+ *
+ * Each key in NAMED_TARGETS is a path to a file or directory, and the
+ * value is the (svn_string_t *) corresponding to that path (this is
+ * done for convenience).  The goal of NAMED_TARGETS is to reflect the
+ * behavior of svn on the command line.  For example, if you invoke
+ *
+ *    svn commit foo bar/baz/blim.c blah.c
+ *
+ * the commit should
+ *
+ *    1. descend into foo (which is a directory), calling ENTER_DIR
+ *       and LEAVE_DIR on foo itself, and calling those two and
+ *       HANDLE_FILE appropriately depending on what it finds
+ *       underneath foo,
+ *
+ *    2. call ENTER_DIR and LEAVE_DIR on every intermediate dir
+ *       leading up to blim.c, and call HANDLE_FILE on blim.c itself,
+ *
+ *    3. call handle_file on blah.c
+ *
+ * In order for that to happen with depth-firstness observed and no
+ * redundant entering or leaving of directories, the NAMED_TARGETS
+ * hash undergoes the following treatment:
+ *
+ * Every path P in NAMED_TARGETS is checked to make sure that a parent
+ * path of P is not also in NAMED_TARGETS.  If P does have a parent, P
+ * is removed from NAMED_TARGETS, because recursion on the parent will
+ * be sufficient to reach P anyway.
+ *
+ * After this, there will be no two paths with a parent/descendant
+ * relationship in P -- all relationships will be sibling or cousin.
+ *
+ * Once NAMED_TARGETS is free of redundancies, recursion happens on
+ * each path P in NAMED_TARGETS like so:
+ *
+ *    ENTER_DIR is called on the first component of P
+ *      [ENTER_DIR is called on the first/second component of P]
+ *        [ENTER_DIR is called on the first/second/third component of P]
+ *          [...]
+ *            [If P's last component is a file, then HANDLE_FILE is
+ *            invoked on that file only.  Else if P's last component
+ *            is a directory, then we recurse on every entry in that
+ *            directory, calling HANDLE_FILE and/or {ENTER,LEAVE}_DIR
+ *            as appropriate.]
+ *          [...]
+ *        [LEAVE_DIR is called on the first/second/third component of P]
+ *      [LEAVE_DIR is called on the first/second component of P]
+ *    LEAVE_DIR is called on the first component of P
+ */
 svn_error_t *
 svn_wc__entries_recurse (svn_string_t *path,
                          apr_hash_t *named_targets,


* subversion/svnsync/main.c (normalize_string): Stricter check.
    Do an SVN_ERR_ASSERT() instead of ignoring a NULL pointer.

Suggested by: pburba

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@878020 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svnsync/main.c
+++ subversion/svnsync/main.c
@@ -530,8 +530,10 @@
 {
   *was_normalized = FALSE;

-  if (*str == NULL || (*str)->data == NULL)
+  if (*str == NULL)
     return SVN_NO_ERROR;
+
+  SVN_ERR_ASSERT((*str)->data != NULL);

   /* Detect inconsistent line ending style simply by looking
      for carriage return (\r) characters. */


In svnsync, set the svn:log property on commit if it's available. This saves
one revprop change request.

* subversion/svnsync/main.c
  (filter_exclude_date_author_log_sync): Renamed to ...
  (filter_exclude_date_author_sync): ... this, don't filter out svn:log.
  (filter_include_date_author_log_sync): Renamed to ...
  (filter_include_date_author_sync)... this, don't include svn:log.
  (replay_rev_started): If the svn:log property is set on source, copy it in
   the commit to the target.
  (replay_rev_finished): No need to copy the svn:log property, if it's there it
   was already set during commit.

--- subversion/svnsync/main.c
+++ subversion/svnsync/main.c
@@ -1166,7 +1166,7 @@
 }

 /* Filter out svn:date and svn:author properties. */
-static svn_boolean_t filter_exclude_date_author_log_sync(const char *key)
+static svn_boolean_t filter_exclude_date_author_sync(const char *key)
 {
   if (strncmp(key, SVN_PROP_REVISION_AUTHOR,
               sizeof(SVN_PROP_REVISION_AUTHOR) - 1) == 0)
@@ -1174,9 +1174,6 @@
   else if (strncmp(key, SVN_PROP_REVISION_DATE,
                    sizeof(SVN_PROP_REVISION_DATE) - 1) == 0)
     return TRUE;
-  else if (strncmp(key, SVN_PROP_REVISION_LOG,
-                   sizeof(SVN_PROP_REVISION_LOG) - 1) == 0)
-    return TRUE;
   else if (strncmp(key, SVNSYNC_PROP_PREFIX,
                    sizeof(SVNSYNC_PROP_PREFIX) - 1) == 0)
     return TRUE;
@@ -1185,9 +1182,9 @@
 }

 /* Filter out all properties except svn:date and svn:author */
-static svn_boolean_t filter_include_date_author_log_sync(const char *key)
-{
-  return ! filter_exclude_date_author_log_sync(key);
+static svn_boolean_t filter_include_date_author_sync(const char *key)
+{
+  return ! filter_exclude_date_author_sync(key);
 }

 /* Callback function for svn_ra_replay_range, invoked when starting to parse
@@ -1228,18 +1225,19 @@

   /* The actual copy is just a replay hooked up to a commit.
      Include all the revision properties from the source repositories, except
-     svn:author and svn:date, those are not guaranteed to get through the
+     'svn:author' and 'svn:date', those are not guaranteed to get through the
      editor anyway.
    */
   filtered = filter_props(&filtered_count, rev_props,
-                          filter_exclude_date_author_log_sync,
+                          filter_exclude_date_author_sync,
                           pool);
   /* svn_ra_get_commit_editor3 requires the log message to be set. It's possible
      that we didn't receive 'svn:log' here, so we have to set it to at least
      the empty string. If there's a svn:log property on this revision, we will
      write the actual value in the replay_rev_finished callback. */
-  apr_hash_set(filtered, SVN_PROP_REVISION_LOG, APR_HASH_KEY_STRING,
-               svn_string_create("", pool));
+  if (! apr_hash_get(filtered, SVN_PROP_REVISION_LOG, APR_HASH_KEY_STRING))
+    apr_hash_set(filtered, SVN_PROP_REVISION_LOG, APR_HASH_KEY_STRING,
+                 svn_string_create("", pool));

   SVN_ERR(svn_ra_get_commit_editor3(rb->to_session, &commit_editor,
                                     &commit_baton,
@@ -1298,7 +1296,7 @@
   /* Ok, we're done with the data, now we just need to copy the remaining
      'svn:date' and 'svn:author' revprops and we're all set. */
   filtered = filter_props(&filtered_count, rev_props,
-                          filter_include_date_author_log_sync,
+                          filter_include_date_author_sync,
                           subpool);
   SVN_ERR(write_revprops(&filtered_count, rb->to_session, revision, filtered,
                          subpool));


aarch64: Fix async_fibre_swapcontext() on clang BTI builds

Reverting to using swapcontext() when compiling with clang on BTI-enabled
builds fixes the BTI setjmp() failure seen when running asynctest.

The issue with setjmp/longjmp is a known clang bug: see
https://github.com/llvm/llvm-project/issues/48888

Change-Id: I6eeaaa2e15f402789f1b3e742038f84bef846e29

Reviewed-by: Matt Caswell <1fa2ef4755a9226cb9a0a4840bd89b158ac71391@openssl.org>
Reviewed-by: Paul Dale <ddec78389666b4f7c9b4d110380c848489a3e4aa@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17698)

--- crypto/async/arch/async_posix.h
+++ crypto/async/arch/async_posix.h
@@ -33,6 +33,18 @@
  * well as normal stack.
  * On IA64 the register stack engine is not saved across setjmp/longjmp. Here
  * swapcontext() performs correctly.
+ */
+#   define USE_SWAPCONTEXT
+#  endif
+#  if defined(__aarch64__) && defined(__clang__) \
+    && defined(__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1
+/*
+ * setjmp/longjmp don't currently work with BTI on all libc implementations
+ * when compiled by clang. This is because clang doesn't put a BTI after the
+ * call to setjmp where it returns the second time. This then fails on libc
+ * implementations - notably glibc - which use an indirect jump to there.
+ * So use the swapcontext implementation, which does work.
+ * See https://github.com/llvm/llvm-project/issues/48888.
  */
 #   define USE_SWAPCONTEXT
 #  endif


don't unlock pidfile after write pid

don't unlock pidfile after write pid

--- skynet-src/skynet_daemon.c
+++ skynet-src/skynet_daemon.c
@@ -60,19 +60,13 @@
 	}
 	fflush(f);

-	if (flock(fd, LOCK_UN) == -1) {
-		fprintf(stderr, "Can't unlock pidfile %s.\n", pidfile);
-		close(fd);
-		return 0;
-	}
-	close(fd);
-
 	return pid;
 }

 int
 daemon_init(const char *pidfile) {
 	int pid = check_pid(pidfile);
+
 	if (pid) {
 		fprintf(stderr, "Skynet is already running, pid = %d.\n", pid);
 		return 1;
@@ -93,5 +87,5 @@

 int
 daemon_exit(const char *pidfile) {
-	return unlink (pidfile);
+	return unlink(pidfile);
 }


id reserve bugfix

id reserve bugfix

--- skynet-src/socket_server.c
+++ skynet-src/socket_server.c
@@ -123,7 +123,7 @@
 	for (i=0;i<MAX_SOCKET;i++) {
 		int id = __sync_add_and_fetch(&(ss->alloc_id), 1);
 		if (id < 0) {
-			id = __sync_fetch_and_and(&(ss->alloc_id), 0x7fffffff);
+			id = __sync_and_and_fetch(&(ss->alloc_id), 0x7fffffff);
 		}
 		struct socket *s = &ss->slot[id % MAX_SOCKET];
 		if (s->type == SOCKET_TYPE_INVALID) {


Make function's definition follow its declared visibility. Found by: CScout

--- usr.bin/mail/aux.c
+++ usr.bin/mail/aux.c
@@ -70,7 +70,7 @@
 /*
  * Make a copy of new argument incorporating old one.
  */
-char *
+static char *
 save2str(str, old)
 	char *str, *old;
 {


VarParseLong: Create new else block for haveModifier. Move the call
to VarExpand down into the branches of the if as well as cleanup code.
Eliminate code that is now obviously dead.

Patch:		7.83

Submitted by:	Max Okumoto <okumoto@ucsd.edu>

--- usr.bin/make/var.c
+++ usr.bin/make/var.c
@@ -1085,9 +1085,6 @@

 	Buf_Destroy(buf, TRUE);

-	rw_str = VarExpand(v, ctxt, err);
-	*freePtr = TRUE;
-
 	/*
 	 * Now we need to apply any modifiers the user wants applied.
 	 * These are:
@@ -1114,6 +1111,9 @@
 	if (haveModifier) {
 	    char	*cp;

+	    rw_str = VarExpand(v, ctxt, err);
+	    *freePtr = TRUE;
+
 	    tstr++;
 	    while (*tstr != endc) {
 		char	*newStr;    /* New value to return */
@@ -1633,49 +1633,61 @@
 		}
 		tstr = cp;
 	    }
-	}
-
-	if (v->flags & VAR_FROM_ENV) {
-	    if (rw_str == (char *)Buf_GetAll(v->val, (size_t *)NULL)) {
+
+	    if (v->flags & VAR_FROM_ENV) {
+		if (rw_str == (char *)Buf_GetAll(v->val, (size_t *)NULL)) {
+		    /*
+		     * Returning the value unmodified, so tell the caller to free
+		     * the thing.
+		     */
+		    *freePtr = TRUE;
+		    *lengthPtr = tstr - input + 1;
+		    VarDestroy(v, FALSE);
+		    return (rw_str);
+		} else {
+		    *lengthPtr = tstr - input + 1;
+		    VarDestroy(v, TRUE);
+		    return (rw_str);
+		}
+	    } else if (v->flags & VAR_JUNK) {
 		/*
-		 * Returning the value unmodified, so tell the caller to free
-		 * the thing.
+		 * Perform any free'ing needed and set *freePtr to FALSE so the caller
+		 * doesn't try to free a static pointer.
 		 */
+		if (*freePtr) {
+		    free(rw_str);
+		}
+		if (dynamic) {
+		    *freePtr = FALSE;
+		    *lengthPtr = tstr - input + 1;
+		    VarDestroy(v, TRUE);
+		    rw_str = emalloc(*lengthPtr + 1);
+		    strncpy(rw_str, input, *lengthPtr);
+		    rw_str[*lengthPtr] = '\0';
+		    *freePtr = TRUE;
+		    return (rw_str);
+		} else {
+		    *freePtr = FALSE;
+		    *lengthPtr = tstr - input + 1;
+		    VarDestroy(v, TRUE);
+		    return (err ? var_Error : varNoError);
+		}
+	    } else {
+		*lengthPtr = tstr - input + 1;
+		return (rw_str);
+	    }
+	} else {
+		char	*result;
+
+		result = VarExpand(v, ctxt, err);
+
+		if (v->flags & VAR_FROM_ENV) {
+			VarDestroy(v, TRUE);
+		}
+
 		*freePtr = TRUE;
 		*lengthPtr = tstr - input + 1;
-		VarDestroy(v, FALSE);
-		return (rw_str);
-	    } else {
-		*lengthPtr = tstr - input + 1;
-		VarDestroy(v, TRUE);
-		return (rw_str);
-	    }
-	} else if (v->flags & VAR_JUNK) {
-	    /*
-	     * Perform any free'ing needed and set *freePtr to FALSE so the caller
-	     * doesn't try to free a static pointer.
-	     */
-	    if (*freePtr) {
-		free(rw_str);
-	    }
-	    if (dynamic) {
-		*freePtr = FALSE;
-		*lengthPtr = tstr - input + 1;
-		VarDestroy(v, TRUE);
-		rw_str = emalloc(*lengthPtr + 1);
-		strncpy(rw_str, input, *lengthPtr);
-		rw_str[*lengthPtr] = '\0';
-		*freePtr = TRUE;
-		return (rw_str);
-	    } else {
-		*freePtr = FALSE;
-		*lengthPtr = tstr - input + 1;
-		VarDestroy(v, TRUE);
-		return (err ? var_Error : varNoError);
-	    }
-	} else {
-	    *lengthPtr = tstr - input + 1;
-	    return (rw_str);
+		return (result);
 	}
 }


Unbreak this file after the last drive-by committing. We have to
#include route.h before iso88025.h, and we have to dereference
the trld_route array correctly. (NOTE: I'm not altogether sure
that this is really the correct way to traverse this array. This
just eliminates the build warning/error. It may not work right at
runtime, and I have no way to test it since I lack the necessary
hardware.)

Broken by: kbyanc, who gets to wear the pointy hat

--- usr.sbin/arp/arp.c
+++ usr.sbin/arp/arp.c
@@ -64,8 +64,8 @@
 #include <net/if.h>
 #include <net/if_dl.h>
 #include <net/if_types.h>
+#include <net/route.h>
 #include <net/iso88025.h>
-#include <net/route.h>

 #include <netinet/in.h>
 #include <netinet/if_ether.h>
@@ -537,7 +537,7 @@
 			for (seg = 0;
 			     seg < ((TR_RCF_RIFLEN(trld->trld_rcf) - 2 ) / 2);
 			     seg++)
-				printf(":%x", ntohs(trld->trld_route[seg]));
+				printf(":%x", ntohs(*(trld->trld_route[seg])));
 		}
                 break;
             case IFT_FDDI:


If we receive an IPCP protocol reject, bring it down.

--- usr.sbin/ppp/fsm.c
+++ usr.sbin/ppp/fsm.c
@@ -17,7 +17,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * $Id: fsm.c,v 1.44 1999/05/14 09:36:04 brian Exp $
+ * $Id: fsm.c,v 1.45 1999/06/02 15:58:57 brian Exp $
  *
  *  TODO:
  */
@@ -863,6 +863,13 @@
       /* (*fp->parent->LayerFinish)(fp->parent->object, fp); */
     }
     break;
+  case PROTO_IPCP:
+    if (fp->proto == PROTO_LCP) {
+      log_Printf(LogPHASE, "%s: IPCP protocol reject closes IPCP !\n",
+                fp->link->name);
+      fsm_Close(&fp->bundle->ncp.ipcp.fsm);
+    }
+    break;
   case PROTO_MP:
     if (fp->proto == PROTO_LCP) {
       struct lcp *lcp = fsm2lcp(fp);


TUNSIFINFO now requires uid 0 to change the interface MTU.

Reviewed by:	Mark Knight <markk@knigma.org>

--- usr.sbin/ppp/tun.c
+++ usr.sbin/ppp/tun.c
@@ -43,15 +43,16 @@
 #if defined(__OpenBSD__) || defined(__NetBSD__)
 #include <sys/ioctl.h>
 #endif
+#include <stdio.h>
 #include <termios.h>
 #ifdef __NetBSD__
-#include <stdio.h>
 #include <unistd.h>
 #endif

 #include "layer.h"
 #include "mbuf.h"
 #include "log.h"
+#include "id.h"
 #include "timer.h"
 #include "lqr.h"
 #include "hdlc.h"
@@ -105,7 +106,7 @@
 #ifdef __OpenBSD__
   info.flags = IFF_UP|IFF_POINTOPOINT;
 #endif
-  if (ioctl(bundle->dev.fd, TUNSIFINFO, &info) < 0)
+  if (ID0ioctl(bundle->dev.fd, TUNSIFINFO, &info) < 0)
     log_Printf(LogERROR, "tun_configure: ioctl(TUNSIFINFO): %s\n",
 	      strerror(errno));
 #endif


Applied Simon's MSI-X Patch manually

Applied Simon's MSI-X Patch manually

--- usr/pci/pci_msix.c
+++ usr/pci/pci_msix.c
@@ -33,10 +33,12 @@
 static struct pci_msix_context *get_context(struct pci_address *addr,
                                             bool alloc)
 {
-    struct pci_msix_context *ctx = contexts;
-    while (ctx != NULL) {
-        if (!memcmp(addr, &ctx->addr, sizeof(*addr)))
+    struct pci_msix_context *ctx;
+
+    for(ctx = contexts; ctx != NULL; ctx = ctx->next) {
+        if (!memcmp(addr, &ctx->addr, sizeof(*addr))) {
             return ctx;
+        }
     }

     if (alloc) {
@@ -153,7 +155,6 @@
         table = ctx->table;
     }

-
     // Make sure all interrupts are masked
     for (i = 0; i < *count; i++) {
         table[4*i + 3] |= 1;


For STAC9221 Macs, create master volume and mute controls by binding
the DAC volumes.

Tested by otto@, ajacoutot@, merdeley@ and Darrin Chandler.

--- dev/pci/azalia_codec.c
+++ dev/pci/azalia_codec.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: azalia_codec.c,v 1.33 2007/09/10 22:37:08 deanna Exp $	*/
+/*	$OpenBSD: azalia_codec.c,v 1.34 2007/09/11 05:14:42 deanna Exp $	*/
 /*	$NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $	*/

 /*-
@@ -107,6 +107,8 @@
 int	azalia_stac9200_unsol_event(codec_t *, int);
 int	azalia_stac9221_apple_mixer_init(codec_t *);
 int	azalia_stac9221_apple_init_dacgroup(codec_t *);
+int	azalia_stac9221_apple_set_port(codec_t *, mixer_ctrl_t *);
+int	azalia_stac9221_apple_get_port(codec_t *, mixer_ctrl_t *);
 int	azalia_stac9221_apple_unsol_event(codec_t *, int);
 int	azalia_stac9221_gpio_unmute(codec_t *, int);
 int	azalia_stac7661_init_dacgroup(codec_t *);
@@ -176,6 +178,8 @@
 			    azalia_stac9221_apple_init_dacgroup;
 			this->mixer_init =
 			    azalia_stac9221_apple_mixer_init;
+			this->set_port = azalia_stac9221_apple_set_port;
+			this->get_port = azalia_stac9221_apple_get_port;
 			this->unsol_event = azalia_stac9221_apple_unsol_event;
 		}
 		break;
@@ -2493,6 +2497,11 @@
 	{{AZ_CLASS_INPUT, {AudioCinputs}, AUDIO_MIXER_CLASS, AZ_CLASS_INPUT, 0, 0}, 0},
 	{{AZ_CLASS_OUTPUT, {AudioCoutputs}, AUDIO_MIXER_CLASS, AZ_CLASS_OUTPUT, 0, 0}, 0},
 	{{AZ_CLASS_RECORD, {AudioCrecord}, AUDIO_MIXER_CLASS, AZ_CLASS_RECORD, 0, 0}, 0},
+#define APPLE_TARGET_MASTER -1
+	{{0, {AudioNmaster}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
+	  4, 0, .un.v={{""}, 2, MIXER_DELTA(127)}}, 0x02, APPLE_TARGET_MASTER},
+	{{0, {AudioNmute}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
+	  0, 3, ENUM_OFFON}, 0x02, APPLE_TARGET_MASTER},

 	{{0, {AudioNheadphone}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
 	  0, 0, .un.v={{""}, 2, MIXER_DELTA(15)}}, 0x02, MI_TARGET_OUTAMP},
@@ -2513,9 +2522,6 @@
           0, 0, .un.v={{""}, 2, MIXER_DELTA(15)}}, 0x05, MI_TARGET_OUTAMP},
         {{0, {"line2.mute"}, AUDIO_MIXER_ENUM, AZ_CLASS_OUTPUT,
           0, 0, ENUM_OFFON}, 0x05, MI_TARGET_OUTAMP},
-
-	{{0, {AudioNmaster}, AUDIO_MIXER_VALUE, AZ_CLASS_OUTPUT,
-	  0, 0, .un.v={{""}, 1, MIXER_DELTA(15)}}, 0x16, MI_TARGET_VOLUME},
 };

 int
@@ -2578,6 +2584,50 @@
         azalia_stac9221_apple_unsol_event(this, APPLE_EVENT_HP);

 	return 0;
+}
+
+int
+azalia_stac9221_apple_set_port(codec_t *this, mixer_ctrl_t *mc)
+{
+	const mixer_item_t *m;
+	int err;
+
+	if (mc->dev >= this->nmixers)
+		return ENXIO;
+	m = &this->mixers[mc->dev];
+	if (mc->type != m->devinfo.type)
+		return EINVAL;
+	if (mc->type == AUDIO_MIXER_CLASS)
+		return 0;
+	if (m->target == APPLE_TARGET_MASTER) {
+		err = azalia_generic_mixer_set(this, 0x02,
+		    MI_TARGET_OUTAMP, mc);
+		err = azalia_generic_mixer_set(this, 0x03,
+		    MI_TARGET_OUTAMP, mc);
+		err = azalia_generic_mixer_set(this, 0x04,
+		    MI_TARGET_OUTAMP, mc);
+		err = azalia_generic_mixer_set(this, 0x05,
+		    MI_TARGET_OUTAMP, mc);
+		return err;
+	}
+	return azalia_generic_mixer_set(this, m->nid, m->target, mc);
+}
+
+int
+azalia_stac9221_apple_get_port(codec_t *this, mixer_ctrl_t *mc)
+{
+	const mixer_item_t *m;
+
+	if (mc->dev >= this->nmixers)
+		return ENXIO;
+	m = &this->mixers[mc->dev];
+	mc->type = m->devinfo.type;
+	if (mc->type == AUDIO_MIXER_CLASS)
+		return 0;
+	if (m->target == APPLE_TARGET_MASTER)
+		return azalia_generic_mixer_get(this, m->nid,
+		    MI_TARGET_OUTAMP, mc);
+	return azalia_generic_mixer_get(this, m->nid, m->target, mc);
 }

 int


x/carriage/extruder: tweak a mount

x/carriage/extruder: tweak a mount

--- x-carriage.h
+++ x-carriage.h
@@ -128,7 +128,7 @@
 extruder_a_base_h=extruder_a_bearing[2]-extruder_a_bearing_offset_y.y+1*mm;

 extruder_b_bearing = bearing_MR105;
-extruder_b_mount_dia = 11*mm;
+extruder_b_mount_dia = 9*mm;

 // from E3D V6 heatsink drawing
 // http://wiki.e3d-online.com/wiki/File:DRAWING-V6-175-SINK.png
@@ -197,7 +197,7 @@
 extruder_motor_holedist = lookup(NemaDistanceBetweenMountingHoles, extruder_motor);

 extruder_a_mount_offsets = [for(x=[-1,1]) for(z=[-1,1])
-[x*(extruder_motor_holedist/2+2*mm),0,z*extruder_motor_holedist/2]+[x*5,0,z<0?-5.2*mm:z*4]
+[x*(extruder_motor_holedist/2+4*mm),0,z*extruder_motor_holedist/2]+[x*5,0,z<0?-5.2*mm:z*4]
 ];

 extruder_gear_big_offset=[-extruder_motor_offset_x,0,extruder_motor_offset_z];


no cn_bell yet; bad mickey, try #2

no cn_bell yet; bad mickey, try #2

--- dev/wscons/wsdisplay.c
+++ dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.5 2000/08/01 16:35:34 mickey Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.6 2000/08/01 16:44:33 mickey Exp $ */
 /* $NetBSD: wsdisplay.c,v 1.37.4.1 2000/06/30 16:27:53 simonb Exp $ */

 /*
@@ -205,7 +205,7 @@

 static struct consdev wsdisplay_cons = {
 	NULL, NULL, wsdisplay_getc_dummy, wsdisplay_cnputc,
-	wsdisplay_pollc, NULL, NODEV, CN_NORMAL
+	wsdisplay_pollc, /*NULL,*/ NODEV, CN_NORMAL
 };

 #ifndef WSDISPLAY_DEFAULTSCREENS


_plan: [Python] python bridge. Input param clob now working, still working on output param clob.

--- src/panaedra/mxroot/mxpython/c_source/panaedra_pythonbridge.c
+++ src/panaedra/mxroot/mxpython/c_source/panaedra_pythonbridge.c
@@ -36,10 +36,13 @@

 	iMaxModules = iMaxModulesIP;
 	cErrorOP[0] = 0;
-
-#if QXPYDEBUG
+	cErrorOP[1] = 0; // For Utf-8 data
+	cErrorOP[2] = 0;
+	cErrorOP[3] = 0; // For Utf-16 data
+
+  #if QXPYDEBUG
 	fprintf(stdout, "Initialize iMaxModulesIP: \"%i\"\n", iMaxModulesIP);
-#endif
+  #endif

 	pModules = (void**)malloc(sizeof(void*) * iMaxModulesIP);
 	if (pModules == 0)
@@ -78,6 +81,7 @@

 } // QxPy_InitializeInterpreter

+
 void QxPyH_TransferPyErrorToString(char *cErrorOP)
 {
 	// Transfer the python error to a string (concat), and reset the python error status
@@ -129,15 +133,16 @@

 } // QxPyH_TransferPyErrorToString

+
 PyMODINIT_FUNC
 	QxPy_SetCompiledPyCode(int iPyObjectIP, char *cPyIdIP, char *cPyCodeIP, char *cErrorOP)
 {
 	void *oPyObject = 0;

 	cErrorOP[0] = 0;
-	cErrorOP[1] = 0;
+	cErrorOP[1] = 0; // For Utf-8 data
 	cErrorOP[2] = 0;
-	cErrorOP[3] = 0;
+	cErrorOP[3] = 0; // For Utf-16 data

 	oPyObject = (PyCodeObject*)Py_CompileString(cPyCodeIP, cPyIdIP, Py_file_input);
 	if (oPyObject == 0)
@@ -162,38 +167,76 @@

 PyMODINIT_FUNC
-	QxPy_RunCompiledPyCode(int iModuleIP, char *cErrorOP)
+	QxPy_RunCompiledPyCode(int iModuleIP, char *cDataIP, char *cDataOP, long long iDataOpLengthIP, char *cErrorOP)
 {
 	cErrorOP[0] = 0;
-	cErrorOP[1] = 0;
+	cErrorOP[1] = 0; // For Utf-8 data
+	cErrorOP[2] = 0;
+	cErrorOP[3] = 0; // For Utf-16 data
+
+	cDataOP[0] = 0;
+	cDataOP[1] = 0; // For Utf-8 data
+	cDataOP[2] = 0;
+	cDataOP[3] = 0; // For Utf-16 data

 	if (pModules[iModuleIP] != 0)
 	{
-		PyObject* local_dict = 0;
+		PyObject* oLocalDict = 0;
 		PyObject* pRet = 0;
-
+		PyObject* pPyUnicodeDataIP = 0;
+
+    #if QXPYDEBUG
 		PyObject* pStrong = 0;
-
-		//fprintf(stdout, "QxPy_RunCompiledPyCode\"%i\"\n", iModuleIP);
-		//fprintf(stdout, "Run py object pointer: \"%p\" \"%p\"\n", pModules[0], pModules[1]);
+    #endif
+
+    #if QXPYDEBUG
+		fprintf(stdout, "QxPy_RunCompiledPyCode\"%i\"\n", iModuleIP);
+		fprintf(stdout, "Run py object pointer: \"%p\" \"%p\"\n", pModules[0], pModules[1]);
+    #endif

 		if (oMainModule == 0) oMainModule = PyImport_AddModule("__main__");
 		if (oGlobalDict == 0) oGlobalDict = PyModule_GetDict(oMainModule);

-		//fprintf(stdout, "Run py object main module: \"%p\"\n", oMainModule);
-		local_dict = PyDict_New();
-
-		pRet = PyEval_EvalCode((PyCodeObject*)pModules[iModuleIP], oGlobalDict, local_dict);
-		//fprintf(stdout, "pRet object pointer: \"%p\"\n", ((void *)pRet));
-		if (pRet != 0)
-		{
+    #if QXPYDEBUG
+		fprintf(stdout, "Run py object main module: \"%p\"\n", oMainModule);
+    #endif
+		oLocalDict = PyDict_New();
+
+		pPyUnicodeDataIP = PyUnicode_FromString(cDataIP);
+
+    #if QXPYDEBUG
+		fprintf(stdout, "cDataIP: \"%s\"\n", cDataIP);
+		fprintf(stdout, "pPyUnicodeDataIP: \"%p\"\n", pPyUnicodeDataIP);
+    #endif
+
+		PyDict_SetItemString(oLocalDict, "cDataIP", pPyUnicodeDataIP);
+
+		pRet = PyEval_EvalCode((PyCodeObject*)pModules[iModuleIP], oGlobalDict, oLocalDict);
+
+    #if QXPYDEBUG
+		fprintf(stdout, "pRet object pointer: \"%p\"\n", ((void *)pRet));
+    #endif
+
+		if (pRet == 0)
+		{
+			char* cErr = "Runtime error, invalid python code.\t";
+			strncat(cErrorOP, cErr, strnlen(cErr,MAXERRORLEN - strlen(cErrorOP) - 1));
+			cErr = ":\t";
+			strncat(cErrorOP, cErr, strnlen(cErr,MAXERRORLEN - strlen(cErrorOP) - 1));
+			QxPyH_TransferPyErrorToString(cErrorOP);
+		}
+		else
+		{
+      #if QXPYDEBUG
 			pStrong = PyObject_Str((PyObject*)pRet);
-			//PyObject_Print(pStrong, stdout, 0); // Should be 'None'
-			//fprintf(stdout, "\n");
+			PyObject_Print(pStrong, stdout, 0); // Should be 'None'
+			fprintf(stdout, "\n");
 			if (pStrong != 0) Py_DECREF(pStrong);
+      #endif
 			Py_DECREF(pRet);
 		}
-		Py_DECREF(local_dict);
+		Py_DECREF(oLocalDict);
+		Py_DECREF(pPyUnicodeDataIP);
 	}

 } // QxPy_RunCompiledPyCode
@@ -243,12 +286,13 @@
 		Py_DECREF(oGlobalDict);
 	}

-	// Note: Py_DECREF(oMainModule) gave a Mem Violation in OE10.2B batch session. We don't create it ourselves, so it's probably not meant to be decreased anyway. Plus we only need one instance of the main module.
+	// Note: Py_DECREF(oMainModule) gave a Mem Violation in OE10.2B batch session.
+  //       We don't create it ourselves, so it's probably not meant to be decreased anyway.
+  //       Plus we only need one instance of the main module.

 	Py_Finalize();

 } // QxPy_FinalizeInterpreter

-
-
+// EOF


PDC_kbhit() was redundant.

PDC_kbhit() was redundant.

--- x11/pdckbd.c
+++ x11/pdckbd.c
@@ -17,18 +17,36 @@

 #include "pdcx11.h"

-RCSID("$Id: pdckbd.c,v 1.40 2006/09/11 19:45:17 wmcbrine Exp $");
+RCSID("$Id: pdckbd.c,v 1.41 2006/10/09 14:30:47 wmcbrine Exp $");

 #define TRAPPED_MOUSE_X_POS	  (pdc_mouse_status.x)
 #define TRAPPED_MOUSE_Y_POS	  (pdc_mouse_status.y)
 #define TRAPPED_BUTTON_STATUS(x)  (pdc_mouse_status.button[(x) - 1])

-static bool PDC_kbhit(void)
+/*man-start**************************************************************
+
+  PDC_check_bios_key()	- Check BIOS key data area for input
+
+  PDCurses Description:
+	This is a private PDCurses routine.
+
+	This routine will check the BIOS for any indication that
+	keystrokes are pending.
+
+  PDCurses Return Value:
+	Returns 1 if a keyboard character is available, 0 otherwise.
+
+  Portability:
+	PDCurses  bool PDC_check_bios_key(void);
+
+**man-end****************************************************************/
+
+bool PDC_check_bios_key(void)
 {
 	struct timeval socket_timeout = {0};
 	int s;

-	XC_LOG(("PDC_kbhit() - called\n"));
+	XC_LOG(("PDC_check_bios_key() - called\n"));

 	/* Is something ready to be read on the socket ? Must be a key. */

@@ -37,10 +55,10 @@

 	if ((s = select(FD_SETSIZE, (FD_SET_CAST)&xc_readfds, NULL,
 	    NULL, &socket_timeout)) < 0)
-		XCursesExitCursesProcess(3,
-			"child - exiting from PDC_kbhit select failed");
-
-	PDC_LOG(("%s:PDC_kbhit() - returning %s\n", XCLOGMSG,
+		XCursesExitCursesProcess(3, "child - exiting from "
+			"PDC_check_bios_key select failed");
+
+	PDC_LOG(("%s:PDC_check_bios_key() - returning %s\n", XCLOGMSG,
 		(s == 0) ? "FALSE" : "TRUE"));

 	if (s == 0)
@@ -135,31 +153,6 @@

 /*man-start**************************************************************

-  PDC_check_bios_key()	- Check BIOS key data area for input
-
-  PDCurses Description:
-	This is a private PDCurses routine.
-
-	This routine will check the BIOS for any indication that
-	keystrokes are pending.
-
-  PDCurses Return Value:
-	Returns 1 if a keyboard character is available, 0 otherwise.
-
-  Portability:
-	PDCurses  bool PDC_check_bios_key(void);
-
-**man-end****************************************************************/
-
-bool PDC_check_bios_key(void)
-{
-	PDC_LOG(("PDC_check_bios_key() - called\n"));
-
-	return PDC_kbhit();
-}
-
-/*man-start**************************************************************
-
   PDC_get_ctrl_break()	- return OS control break state

   PDCurses Description:
@@ -268,6 +261,6 @@
 {
 	PDC_LOG(("PDC_flushinp() - called\n"));

-	while (PDC_kbhit())
+	while (PDC_check_bios_key())
 		PDC_get_bios_key();
 }


fsvideoanyrate: Apply filter caps

fsvideoanyrate: Apply filter caps

--- gst/fsvideoanyrate/videoanyrate.c
+++ gst/fsvideoanyrate/videoanyrate.c
@@ -135,6 +135,13 @@
     if (gst_structure_has_field (s, "framerate"))
       gst_structure_set (s,
           "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
+  }
+
+  if (filter)
+  {
+    GstCaps *intersected = gst_caps_intersect (mycaps, filter);
+    gst_caps_unref (mycaps);
+    mycaps = intersected;
   }

   return mycaps;


rewrite local peer discovery

rewrite local peer discovery

--- src/ext-lpd.c
+++ src/ext-lpd.c
@@ -29,47 +29,50 @@
 enum { PACKET_LIMIT_MAX =  20 }; /* Packets per minute to be handled */
 static int g_packet_limit = 0;
 static IP g_lpd_addr = {0};
+static socklen_t g_lpd_addrlen = 0;
 static int g_mcast_registered = 0; /* Indicates if the multicast addresses has been registered */
 static time_t g_mcast_time = 0; /* Next time to perform a multicast ping */
-static int g_sock_recv = -1;
-static int g_sock_send = -1;

 /*
 * Join/leave a multicast group (ba mulitcast address) on the given interface.
 * The interface may be null.
 */
-int mcast_set_group( int sock, IP *addr, const char ifce[], int join ) {
+int mcast_set_group( int sock, IP *mcast_addr, const char ifname[], int join ) {
 #if defined(MCAST_JOIN_GROUP) && !defined(__APPLE__)
 	struct group_req req;
-
-	if( ifce ) {
-		if( (req.gr_interface = if_nametoindex( ifce )) == 0 ) {
-			log_err( "LPD: Cannot find interface '%s' for multicast: %s", ifce, strerror( errno ) );
+	int level, optname;
+
+	if( ifname ) {
+		if( (req.gr_interface = if_nametoindex( ifname )) == 0 ) {
+			log_warn( "LPD: Cannot find interface '%s' for multicast: %s", ifname, strerror( errno ) );
 			return -1;
 		}
 	} else {
 		req.gr_interface = 0;
 	}

-	memcpy( &req.gr_group, addr, addr_len( addr ) );
-
-	if( setsockopt( sock, IPPROTO_IP, join ? MCAST_JOIN_GROUP : MCAST_LEAVE_GROUP, &req, sizeof(req) ) < 0 ) {
-		log_warn( "LPD: Failed to %s multicast group on %s: %s", join ? "join" : "leave", ifce ? ifce : "<any>", strerror( errno ) );
+	memcpy( &req.gr_group, mcast_addr, addr_len( mcast_addr ) );
+
+	level=  (mcast_addr->ss_family == AF_INET) ? IPPROTO_IP : IPPROTO_IPV6;
+	optname = (join == 0) ? MCAST_LEAVE_GROUP : MCAST_JOIN_GROUP;
+
+	if( setsockopt( sock, level, optname, &req, sizeof(req) ) < 0 ) {
+		log_warn( "LPD: Failed to %s multicast group on %s: %s", join ? "join" : "leave", ifname ? ifname : "<any>", strerror( errno ) );
 		return -1;
 	}

 	return 0;
 #else
-	switch( addr->ss_family ) {
+	switch( mcast_addr->ss_family ) {
 		case AF_INET: {
 			struct ip_mreqn mreq;

-			memcpy( &mreq.imr_multiaddr, &((IP4*) addr)->sin_addr, 4 );
-
-			if( ifce ) {
+			memcpy( &mreq.imr_multiaddr, &((IP4*) mcast_addr)->sin_addr, 4 );
+
+			if( ifname ) {
 				mreq.imr_address.s_addr = htonl( INADDR_ANY );
-				if( (mreq.imr_ifindex = if_nametoindex( ifce )) == 0 ) {
-					log_err( "LPD: Cannot find interface '%s' for multicast: %s", ifce, strerror( errno ) );
+				if( (mreq.imr_ifindex = if_nametoindex( ifname )) == 0 ) {
+					log_warn( "LPD: Cannot find interface '%s' for multicast: %s", ifname, strerror( errno ) );
 					return -1;
 				}
 			} else {
@@ -78,7 +81,7 @@
 			}

 			if( setsockopt(sock, IPPROTO_IP, join ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) < 0 ) {
-				log_warn( "LPD: Failed to %s IPv4 multicast group on %s: %s", join ? "join" : "leave", ifce ? ifce : "<any>", strerror( errno ) );
+				log_warn( "LPD: Failed to %s IPv4 multicast group on %s: %s", join ? "join" : "leave", ifname ? ifname : "<any>", strerror( errno ) );
 				return -1;
 			}
 			return 0;
@@ -86,11 +89,11 @@
 		case AF_INET6: {
 			struct ipv6_mreq	mreq6;

-			memcpy( &mreq6.ipv6mr_multiaddr, &((IP6*) addr)->sin6_addr, 16 );
-
-			if( ifce ) {
-				if( (mreq6.ipv6mr_interface = if_nametoindex( ifce )) == 0 ) {
-					log_err( "LPD: Cannot find interface '%s' for multicast: %s", ifce, strerror( errno ) );
+			memcpy( &mreq6.ipv6mr_multiaddr, &((IP6*) mcast_addr)->sin6_addr, 16 );
+
+			if( ifname ) {
+				if( (mreq6.ipv6mr_interface = if_nametoindex( ifname )) == 0 ) {
+					log_warn( "LPD: Cannot find interface '%s' for multicast: %s", ifname, strerror( errno ) );
 					return -1;
 				}
 			} else {
@@ -98,7 +101,7 @@
 			}

 			if( setsockopt(sock, IPPROTO_IPV6, join ? IPV6_JOIN_GROUP : IPV6_LEAVE_GROUP, &mreq6, sizeof(mreq6)) < 0 ) {
-				log_warn( "LPD: Failed to %s IPv6 multicast group on %s: %s", join ? "join" : "leave", ifce ? ifce : "<any>", strerror( errno ) );
+				log_warn( "LPD: Failed to %s IPv6 multicast group on %s: %s", join ? "join" : "leave", ifname ? ifname : "<any>", strerror( errno ) );
 				return -1;
 			}
 			return 0;
@@ -109,95 +112,66 @@
 #endif
 }

-int multicast_set_if( int sock, IP* addr, const char *ifce ) {
-
-	switch( addr->ss_family ) {
-		case AF_INET: {
-			struct ip_mreqn mreq;
-
-			memcpy( &mreq.imr_multiaddr, &((IP4*) addr)->sin_addr, 4 );
-
-			if( ifce ) {
-				mreq.imr_address.s_addr = htonl( INADDR_ANY );
-				if( (mreq.imr_ifindex = if_nametoindex( ifce )) == 0 ) {
-					log_err( "LPD: Cannot find interface '%s' for IP_MULTICAST_IF: %s", ifce, strerror( errno ) );
-					return -1;
-				}
-			} else {
-				mreq.imr_address.s_addr = htonl( INADDR_ANY );
-				mreq.imr_ifindex = 0;
-			}
-
-			return setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, &mreq, sizeof(mreq));
-		}
-		case AF_INET6: {
-			struct ipv6_mreq	mreq6;
-
-			memcpy( &mreq6.ipv6mr_multiaddr, &((IP6*) addr)->sin6_addr, 16 );
-
-			if( ifce ) {
-				if( (mreq6.ipv6mr_interface = if_nametoindex( ifce )) == 0 ) {
-					log_err( "LPD: Cannot find interface '%s' for IPV6_MULTICAST_IF: %s", ifce, strerror( errno ) );
-					return -1;
-				}
-			} else {
-				mreq6.ipv6mr_interface = 0;
-			}
-
-			return setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_IF, &mreq6, sizeof(mreq6));
-		}
-		default:
-			errno = EAFNOSUPPORT;
-			return -1;
-	}
-}
-
-int multicast_send_packet( int sock_send, const char *ifce, const char *msg ) {
-	int rc;
-
-	if( multicast_set_if( sock_send, &g_lpd_addr, ifce ) < 0 ) {
-		log_err( "LPD: Failed to set IP_MULTICAST_IF for sending socket: %s", strerror( errno ));
-		return -1;
-	}
-
-	rc = sendto( sock_send, msg, strlen( msg ), 0, (struct sockaddr*) &g_lpd_addr, addr_len( &g_lpd_addr ) );
-
-	if( rc < 0 ) {
-		log_warn( "LPD: Cannot send multicast message on %s: %s", ifce ? ifce : "<any>", strerror( errno ) );
-	}
-
-	return rc;
-}
-
 /* Send packet to all specified interfaces */
-int multicast_send_packets( int sock_send, const char *msg ) {
+int multicast_send_packets( const char *msg ) {
+	const struct ifaddrs const *cur;
 	struct ifaddrs *addrs;
-	const struct ifaddrs *cur;
-
-	/* Use one specific interface */
-	if( gconf->dht_ifce ) {
-		multicast_send_packet( sock_send, gconf->dht_ifce, msg );
-		return 0;
-	}

 	if( getifaddrs( &addrs ) < 0 ) {
 		log_err( "LPD: Cannot get interface list." );
 		return -1;
 	}

-	/* Use all available interfaces */
+	char addrbuf[FULL_ADDSTRLEN+1];
+	int sock;
+
+	/* Iterate all interfaces */
 	cur = addrs;
-	while ( cur != NULL ) {
-		if ( cur->ifa_addr->sa_family == gconf->af
+	while( cur != NULL ) {
+		if( cur->ifa_addr && (cur->ifa_addr->sa_family == gconf->af)
 			&& !(cur->ifa_flags & IFF_LOOPBACK)
 			&& !(cur->ifa_flags & IFF_POINTOPOINT)
-			&& (cur->ifa_flags & IFF_MULTICAST) ) {
-			multicast_send_packet( sock_send, cur->ifa_name, msg );
-		}
+			&& (cur->ifa_flags & IFF_MULTICAST)
+			&& !(gconf->dht_ifce && strcmp( cur->ifa_name, gconf->dht_ifce ) == 0) ) {
+
+			/* For IPv6, only send from link local addresses */
+			if(cur->ifa_addr->sa_family == AF_INET6) {
+				unsigned char* addr = &((IP6*) cur->ifa_addr)->sin6_addr.s6_addr[0];
+				if( !(addr[0] == 0xFE && addr[1] == 0x80) ) {
+					break;
+				}
+			}
+
+			if( (sock = socket( gconf->af, SOCK_DGRAM, IPPROTO_UDP )) < 0 ) {
+				log_warn( "LPD: Cannot create send socket: %s", strerror( errno ) );
+				goto skip;
+			}
+
+			const int optval = 1;
+			if( setsockopt( sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval) ) < 0 ) {
+				log_warn( "LPD: Unable to set SO_REUSEADDR: %s", strerror( errno ) );
+				goto skip;
+			}
+
+			if( bind( sock, cur->ifa_addr, addr_len( (IP*)cur->ifa_addr ) ) < 0 ) {
+				log_warn( "LPD: Cannot bind send socket: %s", strerror( errno ) );
+				goto skip;
+			}
+
+			if( sendto( sock, msg, strlen( msg ), 0, (struct sockaddr*) &g_lpd_addr, g_lpd_addrlen ) < 0 ) {
+				log_warn( "LPD: Cannot send message from '%s': %s", str_addr( (const IP*)cur->ifa_addr, addrbuf ), strerror( errno ) );
+				goto skip;
+			}
+
+			skip:
+			close(sock);
+		}
+
 		cur = cur->ifa_next;
 	}

 	freeifaddrs( addrs );
+
 	return 0;
 }

@@ -263,7 +237,7 @@
 				/* Create message */
 				snprintf( buf, sizeof(buf), msg_fmt, atoi( gconf->dht_port ) );

-				multicast_send_packets( g_sock_send, buf );
+				multicast_send_packets( buf );
 			}
 		}

@@ -330,45 +304,6 @@
 	}
 }

-int multicast_set_ttl( int sock, int af, int val ) {
-
-	switch( af ) {
-		case AF_INET: {
-			unsigned char scope = val;
-			return setsockopt( sock, IPPROTO_IP, IP_MULTICAST_TTL, &scope, sizeof(scope) );
-		}
-		case AF_INET6: {
-			int scope = val;
-			return setsockopt( sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &scope, sizeof(scope) );
-		}
-		default:
-			errno = EAFNOSUPPORT;
-			return -1;
-	}
-}
-
-int create_send_socket( void ) {
-	int sock_send;
-
-	sock_send = net_socket( "LPD", gconf->dht_ifce, IPPROTO_UDP, gconf->af );
-
-	if( multicast_set_ttl( sock_send, gconf->af, 1 ) < 0 ) {
-		log_err( "LPD: Failed to set IP_MULTICAST_TTL for sending socket: %s", strerror( errno ));
-		goto fail;
-	}
-
-	if( multicast_set_loop( sock_send, gconf->af, 0 ) < 0 ) {
-		log_warn( "LPD: Failed to set IP_MULTICAST_LOOP: %s", strerror( errno ) );
-		goto fail;
-	}
-
-	return sock_send;
-
-fail:
-	close( sock_send );
-	return -1;
-}
-
 int create_receive_socket( void ) {
 	int sock_recv;

@@ -393,22 +328,16 @@
 	if( addr_parse( &g_lpd_addr, gconf->lpd_addr, DHT_PORT_MCAST, gconf->af ) != 0 ) {
 		log_err( "BOOT: Failed to parse IP address for '%s'.", gconf->lpd_addr );
 	}
+	g_lpd_addrlen = addr_len( &g_lpd_addr );

 	if( gconf->lpd_disable ) {
 		return;
 	}

-	/*
-	* Use different sockets for sending and receiving because
-	* MacOSX does not seem to allow it to be the same.
-	*/
-	g_sock_send = create_send_socket();
-	g_sock_recv = create_receive_socket();
-
-	net_add_handler( g_sock_recv, &bootstrap_handle_mcast );
+	int sock_recv = create_receive_socket();
+	net_add_handler( sock_recv, &bootstrap_handle_mcast );
 }

 void lpd_free( void ) {
-	close( g_sock_send );
-	close( g_sock_recv );
-}
+	/* Nothing to do here */
+}


Added more test cases for REPLACE_ROWS request

--- tests/test_webpa_replace.c
+++ tests/test_webpa_replace.c
@@ -73,6 +73,11 @@
 void deleteRowTable(char *object, money_trace_spans *timeSpan, WDMP_STATUS *retStatus)
 {
     UNUSED(object); UNUSED(timeSpan); UNUSED(retStatus);
+    (*timeSpan).count = 1;
+    (*timeSpan).spans = (money_trace_span *)malloc(sizeof(money_trace_span));
+    (*timeSpan).spans[0].name = strdup("component name");
+    (*timeSpan).spans[0].duration = 23;
+    *retStatus = get_global_status();
     function_called();
 }

@@ -103,7 +108,7 @@
     list[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
     list[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
     list[0]->dbusPath = strdup(RDKB_WIFI_DBUS_PATH);
-
+
     componentStruct_t **list1 = (componentStruct_t **) malloc(sizeof(componentStruct_t *)*count);
     list1[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
     list1[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
@@ -261,6 +266,530 @@
     cJSON_Delete(response);
 }

+void test_replaceRow_failure_in_delete_tableData()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceName\":\"Device1\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.AccessPoint.10001.X_CISCO_COM_MacFilterTable.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    int count = 1, paramCount = 6, i = 0;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+    componentStruct_t **list = (componentStruct_t **) malloc(sizeof(componentStruct_t *)*count);
+    list[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
+    list[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
+    list[0]->dbusPath = strdup(RDKB_WIFI_DBUS_PATH);
+
+    componentStruct_t **list1 = (componentStruct_t **) malloc(sizeof(componentStruct_t *)*count);
+    list1[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
+    list1[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
+    list1[0]->dbusPath = strdup(RDKB_WIFI_DBUS_PATH);
+
+    char *names[MAX_PARAMETER_LEN] = {"Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.7.DeviceName", "Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.7.MacAddress", "Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.8.DeviceName", "Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.8.MacAddress","Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.9.DeviceName", "Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.9.MacAddress"};
+    char *values[MAX_PARAMETER_LEN] = {"Device7","12:2:3:5:77", "Device8","12:2:3:5:88", "Device9","12:2:3:5:99"};
+    parameterValStruct_t **valueList = (parameterValStruct_t **) malloc(sizeof(parameterValStruct_t*)*paramCount);
+    for(i = 0; i<paramCount; i++)
+    {
+        valueList[i] = (parameterValStruct_t *) malloc(sizeof(parameterValStruct_t));
+        valueList[i][0].parameterName = strdup(names[i]);
+        valueList[i][0].parameterValue = strdup(values[i]);
+        valueList[i][0].type = ccsp_string;
+    }
+
+    parameterInfoStruct_t **info = (parameterInfoStruct_t **)malloc(sizeof(parameterInfoStruct_t *)*paramCount);
+    for(i = 0; i<paramCount; i++)
+    {
+        info[i] = (parameterInfoStruct_t *) malloc(sizeof(parameterInfoStruct_t));
+        info[i][0].parameterName = strdup(names[i]);
+        info[i][0].writable = 1;
+    }
+
+    will_return(get_global_components, list);
+    will_return(get_global_component_size, count);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_SUCCESS);
+    will_return(get_global_values, valueList);
+    will_return(get_global_parameters_count, paramCount);
+    expect_function_call(CcspBaseIf_getParameterValues);
+    will_return(CcspBaseIf_getParameterValues, CCSP_SUCCESS);
+    expect_value(CcspBaseIf_getParameterValues, size, 1);
+    will_return(get_global_components, list1);
+    will_return(get_global_component_size, count);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_SUCCESS);
+    expect_function_call(CcspBaseIf_getParameterNames);
+    will_return(CcspBaseIf_getParameterNames, CCSP_SUCCESS);
+    will_return(get_global_parameters_count, paramCount);
+    will_return(get_global_parameterInfo, info);
+    expect_function_call(free_componentStruct_t);
+    expect_function_call(free_parameterInfoStruct_t);
+    expect_function_call(free_componentStruct_t);
+    expect_function_call(free_parameterValStruct_t);
+    expect_function_call(deleteRow);
+    will_return(deleteRow, CCSP_SUCCESS);
+    expect_function_call(deleteRow);
+    will_return(deleteRow, CCSP_SUCCESS);
+    expect_function_call(deleteRow);
+    will_return(deleteRow, CCSP_FAILURE);
+    expect_function_call(addRowTable);
+    will_return(get_global_new_row, strdup("Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.2."));
+    will_return(get_global_status, WDMP_SUCCESS);
+    expect_function_call(addRowTable);
+    will_return(get_global_new_row, strdup("Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.3."));
+    will_return(get_global_status, WDMP_SUCCESS);
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_string_equal("Success", cJSON_GetObjectItem(response, "message")->valuestring);
+    assert_int_equal(200, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
+void err_replaceRow_failure_in_addNewRow()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceName\":\"Device1\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.AccessPoint.10001.X_CISCO_COM_MacFilterTable.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    int count = 1, paramCount = 2, i = 0;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+    componentStruct_t **list = (componentStruct_t **) malloc(sizeof(componentStruct_t *)*count);
+    list[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
+    list[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
+    list[0]->dbusPath = strdup(RDKB_WIFI_DBUS_PATH);
+
+    componentStruct_t **list1 = (componentStruct_t **) malloc(sizeof(componentStruct_t *)*count);
+    list1[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
+    list1[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
+    list1[0]->dbusPath = strdup(RDKB_WIFI_DBUS_PATH);
+
+    char *names[MAX_PARAMETER_LEN] = {"Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.1.DeviceName", "Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.1.MacAddress"};
+    char *values[MAX_PARAMETER_LEN] = {"Device1","12:2:3:5:11"};
+    parameterValStruct_t **valueList = (parameterValStruct_t **) malloc(sizeof(parameterValStruct_t*)*paramCount);
+    for(i = 0; i<paramCount; i++)
+    {
+        valueList[i] = (parameterValStruct_t *) malloc(sizeof(parameterValStruct_t));
+        valueList[i][0].parameterName = strdup(names[i]);
+        valueList[i][0].parameterValue = strdup(values[i]);
+        valueList[i][0].type = ccsp_string;
+    }
+
+    parameterInfoStruct_t **info = (parameterInfoStruct_t **)malloc(sizeof(parameterInfoStruct_t *)*paramCount);
+    for(i = 0; i<paramCount; i++)
+    {
+        info[i] = (parameterInfoStruct_t *) malloc(sizeof(parameterInfoStruct_t));
+        info[i][0].parameterName = strdup(names[i]);
+        info[i][0].writable = 1;
+    }
+
+    will_return(get_global_components, list);
+    will_return(get_global_component_size, count);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_SUCCESS);
+    will_return(get_global_values, valueList);
+    will_return(get_global_parameters_count, paramCount);
+    expect_function_call(CcspBaseIf_getParameterValues);
+    will_return(CcspBaseIf_getParameterValues, CCSP_SUCCESS);
+    expect_value(CcspBaseIf_getParameterValues, size, 1);
+    will_return(get_global_components, list1);
+    will_return(get_global_component_size, count);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_SUCCESS);
+    expect_function_call(CcspBaseIf_getParameterNames);
+    will_return(CcspBaseIf_getParameterNames, CCSP_SUCCESS);
+    will_return(get_global_parameters_count, paramCount);
+    will_return(get_global_parameterInfo, info);
+    expect_function_call(free_componentStruct_t);
+    expect_function_call(free_parameterInfoStruct_t);
+    expect_function_call(free_componentStruct_t);
+    expect_function_call(free_parameterValStruct_t);
+    expect_function_call(deleteRow);
+    will_return(deleteRow, CCSP_SUCCESS);
+    expect_function_call(addRowTable);
+    will_return(get_global_new_row, strdup("Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.2."));
+    will_return(get_global_status, WDMP_SUCCESS);
+    expect_function_call(addRowTable);
+    will_return(get_global_new_row, NULL);
+    will_return(get_global_status, WDMP_FAILURE);
+    expect_function_call(deleteRowTable);
+    will_return(get_global_status, WDMP_SUCCESS);
+    expect_function_call(addRowTable);
+    will_return(get_global_new_row, strdup("Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.6."));
+    will_return(get_global_status, WDMP_SUCCESS);
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_int_equal(520, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
+void err_replaceRow_failure_in_addCachedRow()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceName\":\"Device1\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.AccessPoint.10001.X_CISCO_COM_MacFilterTable.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    int count = 1, paramCount = 2, i = 0;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+    componentStruct_t **list = (componentStruct_t **) malloc(sizeof(componentStruct_t *)*count);
+    list[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
+    list[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
+    list[0]->dbusPath = strdup(RDKB_WIFI_DBUS_PATH);
+
+    componentStruct_t **list1 = (componentStruct_t **) malloc(sizeof(componentStruct_t *)*count);
+    list1[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
+    list1[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
+    list1[0]->dbusPath = strdup(RDKB_WIFI_DBUS_PATH);
+
+    char *names[MAX_PARAMETER_LEN] = {"Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.1.DeviceName", "Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.1.MacAddress"};
+    char *values[MAX_PARAMETER_LEN] = {"Device1","12:2:3:5:11"};
+    parameterValStruct_t **valueList = (parameterValStruct_t **) malloc(sizeof(parameterValStruct_t*)*paramCount);
+    for(i = 0; i<paramCount; i++)
+    {
+        valueList[i] = (parameterValStruct_t *) malloc(sizeof(parameterValStruct_t));
+        valueList[i][0].parameterName = strdup(names[i]);
+        valueList[i][0].parameterValue = strdup(values[i]);
+        valueList[i][0].type = ccsp_string;
+    }
+
+    parameterInfoStruct_t **info = (parameterInfoStruct_t **)malloc(sizeof(parameterInfoStruct_t *)*paramCount);
+    for(i = 0; i<paramCount; i++)
+    {
+        info[i] = (parameterInfoStruct_t *) malloc(sizeof(parameterInfoStruct_t));
+        info[i][0].parameterName = strdup(names[i]);
+        info[i][0].writable = 1;
+    }
+
+    will_return(get_global_components, list);
+    will_return(get_global_component_size, count);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_SUCCESS);
+    will_return(get_global_values, valueList);
+    will_return(get_global_parameters_count, paramCount);
+    expect_function_call(CcspBaseIf_getParameterValues);
+    will_return(CcspBaseIf_getParameterValues, CCSP_SUCCESS);
+    expect_value(CcspBaseIf_getParameterValues, size, 1);
+    will_return(get_global_components, list1);
+    will_return(get_global_component_size, count);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_SUCCESS);
+    expect_function_call(CcspBaseIf_getParameterNames);
+    will_return(CcspBaseIf_getParameterNames, CCSP_SUCCESS);
+    will_return(get_global_parameters_count, paramCount);
+    will_return(get_global_parameterInfo, info);
+    expect_function_call(free_componentStruct_t);
+    expect_function_call(free_parameterInfoStruct_t);
+    expect_function_call(free_componentStruct_t);
+    expect_function_call(free_parameterValStruct_t);
+    expect_function_call(deleteRow);
+    will_return(deleteRow, CCSP_SUCCESS);
+    expect_function_call(addRowTable);
+    will_return(get_global_new_row, strdup("Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.2."));
+    will_return(get_global_status, WDMP_SUCCESS);
+    expect_function_call(addRowTable);
+    will_return(get_global_new_row, NULL);
+    will_return(get_global_status, WDMP_FAILURE);
+    expect_function_call(deleteRowTable);
+    will_return(get_global_status, WDMP_FAILURE);
+    expect_function_call(addRowTable);
+    will_return(get_global_new_row, NULL);
+    will_return(get_global_status, WDMP_FAILURE);
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_int_equal(520, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
+void err_replaceRow_with_invalid_table()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceName\":\"Device1\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.AccessPoint.10001.X_CISCO_COM_MacFilterTab.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+
+    will_return(get_global_components, NULL);
+    will_return(get_global_component_size, 0);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_CR_ERR_UNSUPPORTED_NAMESPACE);
+    expect_function_call(free_componentStruct_t);
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_int_equal(520, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
+void err_replaceRow_failure_in_getValues()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceName\":\"Device1\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.AccessPoint.10001.X_CISCO_COM_MacFilterTable.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    int count = 1, paramCount = 2, i = 0;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+    componentStruct_t **list = (componentStruct_t **) malloc(sizeof(componentStruct_t *)*count);
+    list[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
+    list[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
+    list[0]->dbusPath = strdup(RDKB_WIFI_DBUS_PATH);
+
+    will_return(get_global_components, list);
+    will_return(get_global_component_size, count);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_SUCCESS);
+    will_return(get_global_values, NULL);
+    will_return(get_global_parameters_count, 0);
+    expect_function_call(CcspBaseIf_getParameterValues);
+    will_return(CcspBaseIf_getParameterValues, CCSP_CR_ERR_INVALID_PARAM);
+    expect_value(CcspBaseIf_getParameterValues, size, 1);
+    expect_function_call(free_componentStruct_t);
+    expect_function_call(free_parameterValStruct_t);
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_int_equal(520, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
+void err_replaceRow_failure_in_construct_rollbackData()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceName\":\"Device1\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.AccessPoint.10001.X_CISCO_COM_MacFilterTable.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    int count = 1, paramCount = 2, i = 0;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+    componentStruct_t **list = (componentStruct_t **) malloc(sizeof(componentStruct_t *)*count);
+    list[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
+    list[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
+    list[0]->dbusPath = strdup(RDKB_WIFI_DBUS_PATH);
+
+    char *names[MAX_PARAMETER_LEN] = {"Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.1.DeviceName", "Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.1.MacAddress"};
+    char *values[MAX_PARAMETER_LEN] = {"Device1","12:2:3:5:11"};
+    parameterValStruct_t **valueList = (parameterValStruct_t **) malloc(sizeof(parameterValStruct_t*)*paramCount);
+    for(i = 0; i<paramCount; i++)
+    {
+        valueList[i] = (parameterValStruct_t *) malloc(sizeof(parameterValStruct_t));
+        valueList[i][0].parameterName = strdup(names[i]);
+        valueList[i][0].parameterValue = strdup(values[i]);
+        valueList[i][0].type = ccsp_string;
+    }
+
+    will_return(get_global_components, list);
+    will_return(get_global_component_size, count);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_SUCCESS);
+    will_return(get_global_values, valueList);
+    will_return(get_global_parameters_count, paramCount);
+    expect_function_call(CcspBaseIf_getParameterValues);
+    will_return(CcspBaseIf_getParameterValues, CCSP_SUCCESS);
+    expect_value(CcspBaseIf_getParameterValues, size, 1);
+    will_return(get_global_components, NULL);
+    will_return(get_global_component_size, 0);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_FAILURE);
+    expect_function_call(free_componentStruct_t);
+    expect_function_call(free_componentStruct_t);
+    expect_function_call(free_parameterValStruct_t);
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_int_equal(520, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
+void err_replaceRow_failure_in_get_writable_params()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceName\":\"Device1\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.AccessPoint.10001.X_CISCO_COM_MacFilterTable.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    int count = 1, paramCount = 2, i = 0;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+    componentStruct_t **list = (componentStruct_t **) malloc(sizeof(componentStruct_t *)*count);
+    list[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
+    list[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
+    list[0]->dbusPath = strdup(RDKB_WIFI_DBUS_PATH);
+
+    componentStruct_t **list1 = (componentStruct_t **) malloc(sizeof(componentStruct_t *)*count);
+    list1[0] = (componentStruct_t *) malloc(sizeof(componentStruct_t));
+    list1[0]->componentName = strdup(RDKB_WIFI_FULL_COMPONENT_NAME);
+    list1[0]->dbusPath = strdup(RDKB_WIFI_DBUS_PATH);
+
+    char *names[MAX_PARAMETER_LEN] = {"Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.1.DeviceName", "Device.WiFi.AccessPoint.1.X_CISCO_COM_MacFilterTable.1.MacAddress"};
+    char *values[MAX_PARAMETER_LEN] = {"Device1","12:2:3:5:11"};
+    parameterValStruct_t **valueList = (parameterValStruct_t **) malloc(sizeof(parameterValStruct_t*)*paramCount);
+    for(i = 0; i<paramCount; i++)
+    {
+        valueList[i] = (parameterValStruct_t *) malloc(sizeof(parameterValStruct_t));
+        valueList[i][0].parameterName = strdup(names[i]);
+        valueList[i][0].parameterValue = strdup(values[i]);
+        valueList[i][0].type = ccsp_string;
+    }
+
+    will_return(get_global_components, list);
+    will_return(get_global_component_size, count);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_SUCCESS);
+    will_return(get_global_values, valueList);
+    will_return(get_global_parameters_count, paramCount);
+    expect_function_call(CcspBaseIf_getParameterValues);
+    will_return(CcspBaseIf_getParameterValues, CCSP_SUCCESS);
+    expect_value(CcspBaseIf_getParameterValues, size, 1);
+    will_return(get_global_components, list1);
+    will_return(get_global_component_size, count);
+    expect_function_call(CcspBaseIf_discComponentSupportingNamespace);
+    will_return(CcspBaseIf_discComponentSupportingNamespace, CCSP_SUCCESS);
+    expect_function_call(CcspBaseIf_getParameterNames);
+    will_return(CcspBaseIf_getParameterNames, CCSP_FAILURE);
+    will_return(get_global_parameters_count, 0);
+    will_return(get_global_parameterInfo, NULL);
+    expect_function_call(free_componentStruct_t);
+    expect_function_call(free_parameterInfoStruct_t);
+    expect_function_call(free_componentStruct_t);
+    expect_function_call(free_parameterValStruct_t);
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_int_equal(520, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
+void err_replaceRow_with_invalid_wifi_index()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceName\":\"Device1\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.AccessPoint.10021.X_CISCO_COM_MacFilterTab.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_int_equal(520, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
+void err_replaceRow_with_invalid_radio_index()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceName\":\"Device1\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.Radio.10021.X_CISCO_COM_MacFilterTab.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_int_equal(520, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
+void err_replaceRow_with_invalid_table_length()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceName\":\"Device1\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.Radio.10021.X_CISCO_COM_MacFilterTabDevice1DeviceNamesfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdferfddfffddfgffdddff.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_int_equal(520, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
+void err_replaceRow_with_invalid_parameter_name_length()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceNamefdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdferfddfffddfgffdddff\":\"Device1\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.Radio.10021.X_CISCO_COM_MacFilterTab.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_int_equal(520, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
+void err_replaceRow_with_invalid_parameter_value_length()
+{
+    char *reqPayload = "{\"rows\":{\"0\":{\"DeviceName\":\"Device1fdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGsfdgfgherejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdfosFYQWPIYRSDAWIEUFTGJVHEDFKWJESDFWEGFWEGFGAQWWEGYTEHERHAEGTWERHTBQR4WYTRejrehigeiruwegwegwiegfuwgfegfwegfwefegaugdferfddfffddfgffdddff\",\"MacAddress\":\"12:2:3:5:11\"},\"1\":{\"DeviceName\":\"Device2\",\"MacAddress\":\"2:1:3:5:7\"} },\"table\" : \"Device.WiFi.Radio.10021.X_CISCO_COM_MacFilterTab.\",\"command\":\"REPLACE_ROWS\"}";
+    char *transactionId = "aasfsdfgeh";
+    char *resPayload = NULL;
+    cJSON *response = NULL;
+    money_trace_spans timeSpan;
+    memset(&timeSpan, 0, sizeof(money_trace_spans));
+
+    processRequest(reqPayload, transactionId, true, &resPayload, &timeSpan);
+    WalInfo("resPayload : %s\n",resPayload);
+    assert_true(timeSpan.count > 0);
+    assert_non_null(timeSpan.spans);
+    assert_non_null(resPayload);
+    response = cJSON_Parse(resPayload);
+    assert_int_equal(520, cJSON_GetObjectItem(response, "statusCode")->valueint);
+    assert_non_null(response);
+    cJSON_Delete(response);
+}
+
 /*----------------------------------------------------------------------------*/
 /*                             External Functions                             */
 /*----------------------------------------------------------------------------*/
@@ -271,6 +800,18 @@
         cmocka_unit_test(test_replaceRow),
         cmocka_unit_test(test_replaceRow_empty_table),
         cmocka_unit_test(test_replaceRow_to_empty_table),
+        cmocka_unit_test(test_replaceRow_failure_in_delete_tableData),
+        cmocka_unit_test(err_replaceRow_failure_in_addNewRow),
+        cmocka_unit_test(err_replaceRow_failure_in_addCachedRow),
+        cmocka_unit_test(err_replaceRow_with_invalid_table),
+        cmocka_unit_test(err_replaceRow_failure_in_getValues),
+        cmocka_unit_test(err_replaceRow_failure_in_construct_rollbackData),
+        cmocka_unit_test(err_replaceRow_failure_in_get_writable_params),
+        cmocka_unit_test(err_replaceRow_with_invalid_wifi_index),
+        cmocka_unit_test(err_replaceRow_with_invalid_radio_index),
+        cmocka_unit_test(err_replaceRow_with_invalid_table_length),
+        cmocka_unit_test(err_replaceRow_with_invalid_parameter_name_length),
+        cmocka_unit_test(err_replaceRow_with_invalid_parameter_value_length)
     };

     return cmocka_run_group_tests(tests, NULL, NULL);


app/flow-perf: use more generic wrapper to get cycles

rdtsc() is x86 related, while this might fail for other archs,
so it's better to use more generic API for cycles measurement.

Signed-off-by: Wisam Jaddo <cbdf453c8bf861f460ccde953a2ad4b2bcf4ed16@nvidia.com>
Acked-by: Alexander Kozyrev <a103889f73a7af0066377584f3d0eb32f9983c2e@nvidia.com>

--- app/test-flow-perf/main.c
+++ app/test-flow-perf/main.c
@@ -966,7 +966,7 @@
 	end_counter = (core_id + 1) * rules_count_per_core;

 	cpu_time_used = 0;
-	start_batch = rte_rdtsc();
+	start_batch = rte_get_timer_cycles();
 	for (counter = start_counter; counter < end_counter; counter++) {
 		if (ops == METER_CREATE)
 			create_meter_rule(port_id, counter);
@@ -981,10 +981,10 @@
 		if (!((counter + 1) % rules_batch)) {
 			rules_batch_idx = ((counter + 1) / rules_batch) - 1;
 			cpu_time_per_batch[rules_batch_idx] =
-				((double)(rte_rdtsc() - start_batch))
-				/ rte_get_tsc_hz();
+				((double)(rte_get_timer_cycles() - start_batch))
+				/ rte_get_timer_hz();
 			cpu_time_used += cpu_time_per_batch[rules_batch_idx];
-			start_batch = rte_rdtsc();
+			start_batch = rte_get_timer_cycles();
 		}
 	}

@@ -1086,7 +1086,7 @@
 	if (flow_group > 0 && core_id == 0)
 		rules_count_per_core++;

-	start_batch = rte_rdtsc();
+	start_batch = rte_get_timer_cycles();
 	for (i = 0; i < (uint32_t) rules_count_per_core; i++) {
 		if (flows_list[i] == 0)
 			break;
@@ -1104,12 +1104,12 @@
 		 * for this batch.
 		 */
 		if (!((i + 1) % rules_batch)) {
-			end_batch = rte_rdtsc();
+			end_batch = rte_get_timer_cycles();
 			delta = (double) (end_batch - start_batch);
 			rules_batch_idx = ((i + 1) / rules_batch) - 1;
-			cpu_time_per_batch[rules_batch_idx] = delta / rte_get_tsc_hz();
+			cpu_time_per_batch[rules_batch_idx] = delta / rte_get_timer_hz();
 			cpu_time_used += cpu_time_per_batch[rules_batch_idx];
-			start_batch = rte_rdtsc();
+			start_batch = rte_get_timer_cycles();
 		}
 	}

@@ -1182,7 +1182,7 @@
 		flows_list[flow_index++] = flow;
 	}

-	start_batch = rte_rdtsc();
+	start_batch = rte_get_timer_cycles();
 	for (counter = start_counter; counter < end_counter; counter++) {
 		flow = generate_flow(port_id, flow_group,
 			flow_attrs, flow_items, flow_actions,
@@ -1208,12 +1208,12 @@
 		 * for this batch.
 		 */
 		if (!((counter + 1) % rules_batch)) {
-			end_batch = rte_rdtsc();
+			end_batch = rte_get_timer_cycles();
 			delta = (double) (end_batch - start_batch);
 			rules_batch_idx = ((counter + 1) / rules_batch) - 1;
-			cpu_time_per_batch[rules_batch_idx] = delta / rte_get_tsc_hz();
+			cpu_time_per_batch[rules_batch_idx] = delta / rte_get_timer_hz();
 			cpu_time_used += cpu_time_per_batch[rules_batch_idx];
-			start_batch = rte_rdtsc();
+			start_batch = rte_get_timer_cycles();
 		}
 	}


include stdarg.h for va_list

include stdarg.h for va_list

--- sbin/ggate/shared/ggate.h
+++ sbin/ggate/shared/ggate.h
@@ -30,6 +30,7 @@
 #define	_GGATE_H_

 #include <sys/endian.h>
+#include <stdarg.h>

 #define	G_GATE_BUFSIZE_START	65536
 #define	G_GATE_PORT		3080


Fixed a debug string

Fixed a debug string

--- src/filters.h
+++ src/filters.h
@@ -241,8 +241,7 @@
 	       const predicate_t& predicate,
 	       scope_t&           _context)
     : item_handler<post_t>(handler), pred(predicate), context(_context) {
-    TRACE_CTOR(filter_posts,
-	       "post_handler_ptr, const predicate_t&, scope_t&");
+    TRACE_CTOR(filter_posts, "post_handler_ptr, predicate_t, scope_t&");
   }
   virtual ~filter_posts() {
     TRACE_DTOR(filter_posts);


Added variable scoping around more expr.

--- src/fin_mod.c
+++ src/fin_mod.c
@@ -569,7 +569,9 @@
             uint8_t* lbl_else = cmp->code.top;
             fin_mod_code_emit_uint16(ctx, &cmp->code, 0);
             FIN_LOG("\tbr_if_n     lbl_%d\n", (int32_t)(lbl_else - cmp->code.begin));
+            fin_mod_scope_begin(cmp);
             fin_mod_compile_stmt(ctx, cmp, if_stmt->true_stmt);
+            fin_mod_scope_end(cmp);
             if (if_stmt->false_stmt) {
                 fin_mod_code_emit_uint8(ctx, &cmp->code, fin_op_branch);
                 uint8_t* lbl_end = cmp->code.top;
@@ -579,7 +581,9 @@
                 uint16_t offset = cmp->code.top - lbl_else - 2;
                 *lbl_else++ = offset & 0xFF;
                 *lbl_else++ = (offset >> 8) & 0xFF;
+                fin_mod_scope_begin(cmp);
                 fin_mod_compile_stmt(ctx, cmp, if_stmt->false_stmt);
+                fin_mod_scope_end(cmp);
                 FIN_LOG("lbl_%d:\n", (int32_t)(lbl_end - cmp->code.begin));
                 offset = cmp->code.top - lbl_end - 2;
                 *lbl_end++ = offset & 0xFF;
@@ -595,6 +599,7 @@
         }
         case fin_ast_stmt_type_while: {
             fin_ast_while_stmt_t* while_stmt = (fin_ast_while_stmt_t*)stmt;
+            fin_mod_scope_begin(cmp);
             uint8_t* lbl_loop = cmp->code.top;
             FIN_LOG("lbl_%d:\n", (int32_t)(lbl_loop - cmp->code.begin));
             fin_mod_compile_expr(ctx, cmp, while_stmt->cond);
@@ -602,7 +607,9 @@
             uint8_t* lbl_end = cmp->code.top;
             fin_mod_code_emit_uint16(ctx, &cmp->code, 0);
             FIN_LOG("\tbr_if_n     lbl_%d\n", (int32_t)(lbl_end - cmp->code.begin));
+            fin_mod_scope_begin(cmp);
             fin_mod_compile_stmt(ctx, cmp, while_stmt->stmt);
+            fin_mod_scope_end(cmp);
             uint16_t offset = lbl_loop - cmp->code.top - 3;
             fin_mod_code_emit_uint8(ctx, &cmp->code, fin_op_branch);
             fin_mod_code_emit_uint16(ctx, &cmp->code, offset);
@@ -611,13 +618,16 @@
             offset = cmp->code.top - lbl_end - 2;
             *lbl_end++ = offset & 0xFF;
             *lbl_end++ = (offset >> 8) & 0xFF;
+            fin_mod_scope_end(cmp);
             break;
         }
         case fin_ast_stmt_type_do: {
             fin_ast_do_stmt_t* do_stmt = (fin_ast_do_stmt_t*)stmt;
             uint8_t* lbl_loop = cmp->code.top;
             FIN_LOG("lbl_%d:\n", (int32_t)(lbl_loop - cmp->code.begin));
+            fin_mod_scope_begin(cmp);
             fin_mod_compile_stmt(ctx, cmp, do_stmt->stmt);
+            fin_mod_scope_end(cmp);
             fin_mod_compile_expr(ctx, cmp, do_stmt->cond);
             fin_mod_code_emit_uint8(ctx, &cmp->code, fin_op_branch_if);
             FIN_LOG("\tbr_if       lbl_%d\n", (int32_t)(lbl_loop - cmp->code.begin));


(STRDUP_LOWER): Don't ignore the tailing spaces.


constify args

constify args

git-svn-id: 935794000d934034fad4bb4152be248a7507e5ff@216 0c474577-fa26-0410-a966-bdb198e94e9e

--- src/fw-ipfw.c
+++ src/fw-ipfw.c
@@ -29,7 +29,7 @@
 };

 static void
-fr_to_ipfw_device(char *device, char *name, short *unit)
+fr_to_ipfw_device(const char *device, char *name, short *unit)
 {
 	char *p;


Build ds_sds_session when querying DataStream for info

--- utils/oscap-info.c
+++ utils/oscap-info.c
@@ -44,6 +44,7 @@
 #include <oval_system_characteristics.h>
 #include <oval_directives.h>
 #include <scap_ds.h>
+#include <ds_sds_session.h>

 #include "oscap-tool.h"

@@ -228,10 +229,16 @@
 	case OSCAP_DOCUMENT_SDS: {
 		printf("Document type: Source Data Stream\n");
 		print_time(action->file);
+		struct ds_sds_session *session = ds_sds_session_new_from_source(source);
+		if (session == NULL) {
+			goto cleanup;
+		}
 		/* get collection */
 		struct ds_sds_index *sds = ds_sds_index_import(action->file);
-		if (!sds)
-			goto cleanup;
+		if (!sds) {
+			ds_sds_session_free(session);
+			goto cleanup;
+		}
 		/* iterate over streams */
 		struct ds_stream_index_iterator* sds_it = ds_sds_index_get_streams(sds);
 		while (ds_stream_index_iterator_has_more(sds_it)) {
@@ -255,6 +262,7 @@
 					ds_sds_index_free(sds);
 					oscap_string_iterator_free(checklist_it);
 					ds_stream_index_iterator_free(sds_it);
+					ds_sds_session_free(session);
 					goto cleanup;
 				}

@@ -272,6 +280,7 @@
 					oscap_string_iterator_free(checklist_it);
 					oscap_acquire_cleanup_dir_bundled(&temp_dir);
 					ds_stream_index_iterator_free(sds_it);
+					ds_sds_session_free(session);
 					goto cleanup;
 				}

@@ -344,6 +353,7 @@
 		}
 		ds_stream_index_iterator_free(sds_it);
 		ds_sds_index_free(sds);
+		ds_sds_session_free(session);
 	}
 	break;
 	case OSCAP_DOCUMENT_ARF: {


Added GCoords.h, GColor.h

Added GCoords.h, GColor.h

--- src/gamelib.h
+++ src/gamelib.h
@@ -9,10 +9,11 @@
 #ifndef GAMELIB_HEADERS
 #define GAMELIB_HEADERS

-#include "GColor.h"
 #include "SDLInput.h"
 #include "OSXFs.h"
 //#include "SDLApp.h"
+#include "GCoords.h"
+#include "GColor.h"
 #include "gfx.h"
 #include "font.h"
 #include "SDLBitmapFont.h"