]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Config: Moved hostname check before any other commit is done
authorMaria Matejka <mq@ucw.cz>
Sun, 28 Jan 2024 22:03:54 +0000 (23:03 +0100)
committerMaria Matejka <mq@ucw.cz>
Sun, 28 Jan 2024 22:03:54 +0000 (23:03 +0100)
This was sending <none> hostname via UDP while reconfiguring.

conf/conf.c

index c17358c14b3fb3ea1c9b52bd190f64cb2fc9f8f7..c5ce6f5ac4d353cf7e11e3cc064cc32e35b3544f 100644 (file)
@@ -246,14 +246,6 @@ config_del_obstacle(struct config *c)
 static int
 global_commit(struct config *new, struct config *old)
 {
-  if (!new->hostname)
-    {
-      new->hostname = get_hostname(new->mem);
-
-      if (!new->hostname)
-        log(L_WARN "Cannot determine hostname");
-    }
-
   if (!old)
     return 0;
 
@@ -289,6 +281,14 @@ config_do_commit(struct config *c, int type)
   old_cftype = type;
   config = c;
 
+  if (!c->hostname)
+    {
+      c->hostname = get_hostname(c->mem);
+
+      if (!c->hostname)
+        log(L_WARN "Cannot determine hostname");
+    }
+
   configuring = 1;
   if (old_config && !config->shutdown)
     log(L_INFO "Reconfiguring");