]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
rip: move rip protocol to its own loop kk-rip-to-loop
authorKaterina Kubecova <katerina.kubecova@nic.cz>
Fri, 9 May 2025 10:21:20 +0000 (12:21 +0200)
committerKaterina Kubecova <katerina.kubecova@nic.cz>
Fri, 9 May 2025 12:53:05 +0000 (14:53 +0200)
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 27c9408bc7b6519378184bd3aacd780038222c4b..869d895370b5fa857869e22b20af3572daba003d 100644 (file)
@@ -582,7 +582,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
   {
@@ -749,7 +749,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);
@@ -1015,14 +1015,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);
 }
 
 /**
@@ -1050,7 +1050,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;
   }
 
@@ -1074,9 +1074,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);
 }
 
 
@@ -1084,7 +1084,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
@@ -1201,7 +1201,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;
 }