]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4206b] Minor updates to the Pkt4::getLabel method.
authorMarcin Siodelski <marcin@isc.org>
Fri, 11 Dec 2015 15:11:26 +0000 (16:11 +0100)
committerMarcin Siodelski <marcin@isc.org>
Fri, 11 Dec 2015 15:11:26 +0000 (16:11 +0100)
The warning about malformed client-id is separated by a single
space character from the actual label. Also, used stream object
to concatenate label with suffix to be consistent with the
convention used in makeLabel.

src/lib/dhcp/pkt4.cc

index 309764220f7cdfd805ca29447746ff84ae5ecd77..71086e23ffa43260ad90955b9b5897c316c64d7e 100644 (file)
@@ -352,20 +352,22 @@ Pkt4::getLabel() const {
             client_id = ClientIdPtr(new ClientId(client_opt->getData()));
         } catch (...) {
             // ClientId may throw if the client-id is too short.
-            suffix = "(malformed client-id)";
+            suffix = " (malformed client-id)";
         }
     }
 
-    std::string txt;
+    std::ostringstream label;
     try {
-        txt = makeLabel(hwaddr_, client_id, transid_);
+        label << makeLabel(hwaddr_, client_id, transid_);
     } catch (...) {
         // This should not happen with the current code, but we may add extra
         // sanity checks in the future that would possibly throw if
         // the hwaddr lenght is 0.
-        txt = "(malformed hw address)";
+        label << " (malformed hw address)";
     }
-    return (txt + suffix);
+
+    label << suffix;
+    return (label.str());
 }
 
 std::string