]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
RIP: move to its own loop
authorKaterina Kubecova <katerina.kubecova@nic.cz>
Fri, 9 May 2025 10:21:20 +0000 (12:21 +0200)
committerMaria Matejka <mq@ucw.cz>
Tue, 27 May 2025 09:29:21 +0000 (11:29 +0200)
This closes #147.

proto/rip/config.Y
proto/rip/packets.c
proto/rip/rip.c

index 6520844236a520a40e4457bbc26f6a9537aff65c..593354907336934cff7962b4f71e9bad717ba3af 100644 (file)
@@ -88,6 +88,7 @@ rip_iface_start:
   init_list(&this_ipatt->ipn_list);
   reset_passwords();
 
+  this_proto->loop_order = DOMAIN_ORDER(proto);
   RIP_IFACE->metric = 1;
   RIP_IFACE->port = rip_cfg_is_v2() ? RIP_PORT : RIP_NG_PORT;
   RIP_IFACE->version = rip_cfg_is_v2() ? RIP_V2 : RIP_V1;
index 70108ac35b6ea32e45ec261f0a86009b1da2429c..06f464057cbd86b47bbf6b3475b31e54705d7547 100644 (file)
@@ -436,7 +436,7 @@ static inline void
 rip_kick_rxmt_timer(struct rip_iface *ifa)
 {
   if (! tm_active(ifa->rxmt_timer))
-    tm_start(ifa->rxmt_timer, ifa->cf->rxmt_time);
+    tm_start_in(ifa->rxmt_timer, ifa->cf->rxmt_time, ifa->rip->p.loop);
 }
 
 
@@ -989,6 +989,8 @@ drop:
 int
 rip_open_socket(struct rip_iface *ifa)
 {
+  ASSERT_DIE(birdloop_inside(ifa->rip->p.loop));
+
   struct rip_proto *p = ifa->rip;
 
   sock *sk = sk_new(p->p.pool);
index a4ce3c9d7f2bd2f5c12fa1ed762f057ead38110e..3491c9beabdf6927da47b5515e6079f4c76a4a84 100644 (file)
@@ -585,7 +585,7 @@ rip_iface_start(struct rip_iface *ifa)
   if (! ifa->cf->demand_circuit)
   {
     ifa->next_regular = current_time() + (random() % ifa->cf->update_time) + 100 MS;
-    tm_set(ifa->timer, ifa->next_regular);
+    tm_set_in(ifa->timer, ifa->next_regular, ifa->rip->p.loop);
   }
   else
   {
@@ -752,7 +752,7 @@ rip_add_iface(struct rip_proto *p, struct iface *iface, struct rip_iface_config
     .hook = rip_iface_locked,
     .data = ifa,
   };
-  lock->target = &global_event_list;
+  lock->target = proto_event_list(&p->p);
   ifa->lock = lock;
 
   olock_acquire(lock);
@@ -1018,14 +1018,14 @@ rip_timer(timer *t)
       }
   }
 
-  tm_start(p->timer, MAX(next - now_, 100 MS));
+  tm_start_in(p->timer, MAX(next - now_, 100 MS), p->p.loop);
 }
 
 static inline void
 rip_kick_timer(struct rip_proto *p)
 {
   if ((p->timer->expires > (current_time() + 100 MS)))
-    tm_start(p->timer, 100 MS);
+    tm_start_in(p->timer, 100 MS, p->p.loop);
 }
 
 /**
@@ -1053,7 +1053,7 @@ rip_iface_timer(timer *t)
 
   if (ifa->tx_active)
   {
-    tm_start(ifa->timer, 100 MS);
+    tm_start_in(ifa->timer, 100 MS, p->p.loop);
     return;
   }
 
@@ -1077,9 +1077,9 @@ rip_iface_timer(timer *t)
   }
 
   if (ifa->want_triggered && (ifa->next_triggered < ifa->next_regular))
-    tm_set(ifa->timer, ifa->next_triggered);
+    tm_set_in(ifa->timer, ifa->next_triggered, ifa->rip->p.loop);
   else if (ifa->next_regular != TIME_INFINITY)
-    tm_set(ifa->timer, ifa->next_regular);
+    tm_set_in(ifa->timer, ifa->next_regular, ifa->rip->p.loop);
 }
 
 
@@ -1087,7 +1087,7 @@ static inline void
 rip_iface_kick_timer(struct rip_iface *ifa)
 {
   if ((! tm_active(ifa->timer)) || (ifa->timer->expires > (current_time() + 100 MS)))
-    tm_start(ifa->timer, 100 MS);
+    tm_start_in(ifa->timer, 100 MS, ifa->rip->p.loop);
 }
 
 static void
@@ -1204,7 +1204,7 @@ rip_start(struct proto *P)
   p->log_pkt_tbf = (struct tbf){ .rate = 1, .burst = 5 };
   p->log_rte_tbf = (struct tbf){ .rate = 4, .burst = 20 };
 
-  tm_start(p->timer, MIN(cf->min_timeout_time, cf->max_garbage_time));
+  tm_start_in(p->timer, MIN(cf->min_timeout_time, cf->max_garbage_time), P->loop);
 
   return PS_UP;
 }