]> git.feebdaed.xyz Git - 0xmirror/libreswan.git/commitdiff
connections: during load, don't try orienting a connection with unresolved addresses
authorAndrew Cagney <cagney@gnu.org>
Sun, 14 Dec 2025 22:54:11 +0000 (17:54 -0500)
committerAndrew Cagney <cagney@gnu.org>
Sun, 14 Dec 2025 22:55:16 +0000 (17:55 -0500)
programs/pluto/extract.c

index 94eb5c19ebb6b9dfcb94635f2d523fa9561cce2f..2f3706c08bcfa9a903f59224b1776b9b3514188d 100644 (file)
@@ -4672,27 +4672,25 @@ diag_t extract_connection(const struct whack_message *wm,
         */
        connection_db_add(c);
        vdbg_connection(c, verbose, HERE, "extracted");
-
        if (verbose.debug) {
-               VDBG_log("oriented; maybe");
                connection_db_check(verbose.logger, HERE);
        }
 
        build_connection_host_and_proposals_from_resolve(c, resolved_host_addrs, verbose);
 
        /*
-        * Force orientation (currently kind of unoriented?).
-        *
-        * If the connection orients,the SPDs and host-pair hash
-        * tables are updated.
+        * When possible, try to orient the connection.
         *
-        * This function holds the just allocated reference.
+        * This logic can probably be smashed together with logic
+        * found in ddns.c.
         */
        vassert(!oriented(c));
-       orient(c, verbose.logger);
-
-       if (verbose.debug) {
-               VDBG_log("oriented; still maybe");
+       if (!resolved_host_addrs->ok) {
+               vdbg("unresolved connection can't orient; scheduling CHECK_DDNS");
+       } else if (!orient(c, verbose.logger)) {
+               vdbg("connection did not orient, scheduling CHECK_DDNS");
+       } else {
+               vdbg("connection oriented, re-checking DB");
                connection_db_check(verbose.logger, HERE);
        }