]> granicus.if.org Git - pdns/commitdiff
dnsdist: make getBind() retval printable
authorChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Thu, 26 Oct 2017 21:13:04 +0000 (23:13 +0200)
committerChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Thu, 26 Oct 2017 21:48:29 +0000 (23:48 +0200)
pdns/dnsdist-console.cc

index 3fec2cb1ba8cb2357a0e67aa279838908202b1e4..88ec89867df58b14c58bf2592bac3ed2acb5d686 100644 (file)
@@ -208,6 +208,7 @@ void doConsole()
             boost::variant<
               string, 
               shared_ptr<DownstreamState>,
+              ClientState*,
               std::unordered_map<string, double>
               >
             >
@@ -216,6 +217,9 @@ void doConsole()
           if (const auto dsValue = boost::get<shared_ptr<DownstreamState>>(&*ret)) {
             cout<<(*dsValue)->getName()<<endl;
           }
+          else if (const auto csValue = boost::get<ClientState*>(&*ret)) {
+            cout<<(*csValue)->local.toStringWithPort()<<endl;
+          }
           else if (const auto strValue = boost::get<string>(&*ret)) {
             cout<<*strValue<<endl;
           }
@@ -512,18 +516,22 @@ try
             boost::variant<
               string, 
               shared_ptr<DownstreamState>,
+              ClientState*,
               std::unordered_map<string, double>
               >
             >
           >(withReturn ? ("return "+line) : line);
 
       if(ret) {
-       if (const auto dsValue = boost::get<shared_ptr<DownstreamState>>(&*ret)) {
-         response=(*dsValue)->getName()+"\n";
-       }
-       else if (const auto strValue = boost::get<string>(&*ret)) {
-         response=*strValue+"\n";
-       }
+        if (const auto dsValue = boost::get<shared_ptr<DownstreamState>>(&*ret)) {
+          response=(*dsValue)->getName()+"\n";
+        }
+        else if (const auto csValue = boost::get<ClientState*>(&*ret)) {
+          response=(*csValue)->local.toStringWithPort()+"\n";
+        }
+        else if (const auto strValue = boost::get<string>(&*ret)) {
+          response=*strValue+"\n";
+        }
         else if(const auto um = boost::get<std::unordered_map<string, double> >(&*ret)) {
           using namespace json11;
           Json::object o;