DNS resolution should fail if no DNS servers are available. This
patch fixes it.

Suggested-by: Ben Pfaff <[email protected]>
Suggested-by: Mark Michelson <[email protected]>
Signed-off-by: Yifeng Sun <[email protected]>
---
 lib/dns-resolve.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/dns-resolve.c b/lib/dns-resolve.c
index 3c6d70e8fbba..7d735749e5a5 100644
--- a/lib/dns-resolve.c
+++ b/lib/dns-resolve.c
@@ -90,7 +90,16 @@ dns_resolve_init(bool is_daemon)
         if (retval != 0) {
             VLOG_WARN_RL(&rl, "Failed to read %s: %s",
                          filename, ub_strerror(retval));
+            ub_ctx_delete(ub_ctx__);
+            ub_ctx__ = NULL;
+            return;
         }
+    } else {
+        VLOG_WARN_RL(&rl, "Failed to read %s: %s",
+                     filename, ovs_strerror(errno));
+        ub_ctx_delete(ub_ctx__);
+        ub_ctx__ = NULL;
+        return;
     }
 #endif
 
-- 
2.7.4

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to