[pim] test pim receive dump
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 7ccd5cd..23ad11f 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -3457,6 +3457,11 @@
   return CMD_SUCCESS;
 }
 
+static int hexval(uint8_t ch)
+{
+  return isdigit(ch) ? (ch - '0') : (10 + tolower(ch) - 'a');
+}
+
 DEFUN (test_pim_receive_dump,
        test_pim_receive_dump_cmd,
        "test pim receive dump INTERFACE A.B.C.D .LINE",
@@ -3516,19 +3521,40 @@
   pim_msg_size = 0;
 
   /* Scan LINE dump into buffer */
-  for (argi = 2; argi < argc; ++argi, ++pim_msg_size) {
-    const char *hex = argv[argi];
-    uint8_t octet = strtol(hex, 0, 16);
-    int left;
+  for (argi = 2; argi < argc; ++argi) {
+    const char *str = argv[argi];
+    int str_len = strlen(str);
+    int str_last = str_len - 1;
+    int i;
 
-    left = sizeof(buf) - ip_hlen - pim_msg_size;
-    if (left < 1) {
-      vty_out(vty, "%% Overflow buf_size=%d buf_left=%d at dump arg %d byte %d value %s=%02x%s",
-	      sizeof(buf), left, argi, argi - 2, hex, octet, VTY_NEWLINE);
+    if (str_len % 2) {
+      vty_out(vty, "%% Uneven hex array arg %d=%s%s",
+	      argi, str, VTY_NEWLINE);
       return CMD_WARNING;
     }
 
-    pim_msg[pim_msg_size] = octet;
+    for (i = 0; i < str_last; i += 2) {
+      uint8_t octet;
+      int left;
+      uint8_t h1 = str[i];
+      uint8_t h2 = str[i + 1];
+
+      if (!isxdigit(h1) || !isxdigit(h2)) {
+	vty_out(vty, "%% Non-hex octet %c%c at hex array arg %d=%s%s",
+		h1, h2, argi, str, VTY_NEWLINE);
+	return CMD_WARNING;
+      }
+      octet = (hexval(h1) << 4) + hexval(h2);
+
+      left = sizeof(buf) - ip_hlen - pim_msg_size;
+      if (left < 1) {
+	vty_out(vty, "%% Overflow buf_size=%d buf_left=%d at hex array arg %d=%s octet %02x%s",
+		sizeof(buf), left, argi, str, octet, VTY_NEWLINE);
+	return CMD_WARNING;
+      }
+      
+      pim_msg[pim_msg_size++] = octet;
+    }
   }
 
   ip_msg_len = ip_hlen + pim_msg_size;