]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Flock: fixed some random bugs but there are obviously some more
authorMaria Matejka <mq@ucw.cz>
Wed, 2 Oct 2024 21:37:14 +0000 (23:37 +0200)
committerMaria Matejka <mq@ucw.cz>
Sun, 23 Feb 2025 18:07:35 +0000 (19:07 +0100)
flock/container.c
flock/hypervisor.c

index 8868eefc73d7c0d51218236933afefb9a6821f83..44e1ea6ff1a3e8cd6ec2e8e3ba584b08ee0bd589 100644 (file)
@@ -459,6 +459,12 @@ container_mainloop(int fd)
        exit(1);
       }
 
+      if (sz == 0)
+      {
+       log(L_INFO "control socket closing, shutdown");
+       exit(0);
+      }
+
       ASSERT_DIE(sz >= 3);
       ASSERT_DIE(buf[0] == 0xa1);
       switch (buf[1]) {
index 8513b08028a6d349889eb7f3989ae3356d9bbec1..37e3d6e54dd44aedad4a9ad95847b4d91c2e3112 100644 (file)
@@ -40,15 +40,15 @@ hcs_rx(sock *s, uint size)
   log(L_INFO "Parsed command.");
 
   /* TODO do something more */
+  if (sz < size)
+    memmove(s->rbuf, s->rbuf + sz, size - sz);
+  if (!s->rx_hook)
+    return (sz == size);
 
   hcs_parser_cleanup(s->data);
   s->data = hcs_parser_init(s);
 
-  if (sz == size)
-    return 1;
-
-  memmove(s->rbuf, s->rbuf + sz, size - sz);
-  return hcs_rx(s, size - sz);
+  return (sz < size) ? hcs_rx(s, size - sz) : 1;
 }
 
 static void
@@ -517,6 +517,10 @@ static void hexp_received_telnet(void *_data)
 
     sk_send(s, cw->pt);
     sk_resume_rx(hcs_loop, s);
+
+    hcs_parser_cleanup(s->data);
+    s->data = hcs_parser_init(s);
+
     rfree(lp);
   }