]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/msg_types: entity_addrvec_t: allow only ',' as an addrvec separator
authorSage Weil <sage@redhat.com>
Thu, 10 Jan 2019 18:31:56 +0000 (12:31 -0600)
committerSage Weil <sage@redhat.com>
Wed, 16 Jan 2019 14:31:43 +0000 (08:31 -0600)
This will allow us to list addrvecs using [ ;] as separators.

Signed-off-by: Sage Weil <sage@redhat.com>
src/msg/msg_types.cc
src/test/test_addrs.cc

index c39e4e404fa6cd296e2e5a051c8d13d0f9e98ed5..37146ad2b75ac7f6111b67fd10927c162cee0e42 100644 (file)
@@ -244,11 +244,10 @@ bool entity_addrvec_t::parse(const char *s, const char **end)
     }
     v.push_back(a);
     s = *end;
-    while (*s == ',' ||
-          *s == ' ' ||
-          *s == ';') {
-      ++s;
+    if (*s != ',') {
+      break;
     }
+    ++s;
   }
   return !v.empty();
 }
index 76156779b5394041d018e6b47b6a84cc699c9c84..13be03cdcdc03cba262f78f17d3eb2f71cf33e05 100644 (file)
@@ -255,8 +255,8 @@ TEST(Msgr, TestAddrvecEncodeAddrDecode3)
 const char *addrvec_parse_checks[][3] = {
   { "127.0.0.1", "v2:127.0.0.1:0/0", "" },
   { "127.0.0.1 foo", "v2:127.0.0.1:0/0", " foo" },
-  { "127.0.0.1 1.2.3.4 foo", "[v2:127.0.0.1:0/0,v2:1.2.3.4:0/0]", " foo" },
-  { "127.0.0.1 :: - foo", "[v2:127.0.0.1:0/0,v2:[::]:0/0,-]", " foo" },
+  { "127.0.0.1,1.2.3.4 foo", "[v2:127.0.0.1:0/0,v2:1.2.3.4:0/0]", " foo" },
+  { "127.0.0.1,::,- foo", "[v2:127.0.0.1:0/0,v2:[::]:0/0,-]", " foo" },
   { NULL, NULL, NULL },
 };