u64 router_id, u16 seqno, u8 hop_count,
struct babel_neighbor *target)
{
+ ASSERT_DIE(birdloop_inside(p->p.loop));
struct babel_seqno_request *sr;
btime now_ = current_time();
{
struct babel_proto *p = ifa->proto;
struct babel_msg_ack_req *msg = &m->ack_req;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
TRACE(D_PACKETS, "Handling ACK request nonce %d interval %t",
msg->nonce, (btime) msg->interval);
{
struct babel_proto *p = ifa->proto;
struct babel_msg_hello *msg = &m->hello;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
TRACE(D_PACKETS, "Handling hello seqno %d interval %t",
msg->seqno, (btime) msg->interval);
{
struct babel_proto *p = ifa->proto;
struct babel_msg_ihu *msg = &m->ihu;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
/* Ignore IHUs that are not about us */
if ((msg->ae != BABEL_AE_WILDCARD) && !ipa_equal(msg->addr, ifa->addr))
{
struct babel_proto *p = ifa->proto;
struct babel_msg_update *msg = &m->update;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
struct babel_neighbor *nbr;
struct babel_entry *e;
{
struct babel_proto *p = ifa->proto;
struct babel_msg_route_request *msg = &m->route_request;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
/* RFC 8966 3.8.1.1 */
{
struct babel_proto *p = ifa->proto;
struct babel_msg_seqno_request *msg = &m->seqno_request;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
/* RFC 8966 3.8.1.2 */
void
babel_auth_reset_index(struct babel_iface *ifa)
{
+ ASSERT_DIE(birdloop_inside(ifa->proto->p.loop));
random_bytes(ifa->auth_index, BABEL_AUTH_INDEX_LEN);
ifa->auth_pc = 1;
}
{
struct babel_proto *p = ifa->proto;
struct babel_neighbor *n;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
/*
* We create the neighbour entry at this point because it makes it easier to
btime next_event = MIN(ifa->next_hello, ifa->next_regular);
if (ifa->want_triggered) next_event = MIN(next_event, ifa->next_triggered);
- tm_set(ifa->timer, next_event);
+ tm_set_in(ifa->timer, next_event, ifa->proto->p.loop);
}
static inline void
babel_iface_kick_timer(struct babel_iface *ifa)
{
if (ifa->timer->expires > (current_time() + 100 MS))
- tm_start(ifa->timer, 100 MS);
+ tm_start_in(ifa->timer, 100 MS, ifa->proto->p.loop);
}
static void
ifa->next_regular = current_time() + (random() % ifa->cf->update_interval);
ifa->next_triggered = current_time() + MIN(1 S, ifa->cf->update_interval / 2);
ifa->want_triggered = 0; /* We send an immediate update (below) */
- tm_start(ifa->timer, 100 MS);
+ tm_start_in(ifa->timer, 100 MS, p->p.loop);
ifa->up = 1;
babel_send_hello(ifa, 0);
.hook = babel_iface_locked,
.data = ifa,
};
- lock->target = &global_event_list;
+ lock->target = proto_event_list(&p->p);
olock_acquire(lock);
}
babel_timer(timer *t)
{
struct babel_proto *p = t->data;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
babel_expire_routes(p);
babel_expire_neighbors(p);
babel_kick_timer(struct babel_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);
}
init_list(&p->interfaces);
p->timer = tm_new_init(P->pool, babel_timer, p, 1 S, 0);
- tm_start(p->timer, 1 S);
+ tm_start_in(p->timer, 1 S, P->loop);
p->update_seqno = 1;
p->router_id = proto_get_router_id(&cf->c);
{
struct babel_tlv_ihu *tlv = (void *) hdr;
struct babel_msg_ihu *msg = &m->ihu;
-
msg->type = BABEL_TLV_IHU;
msg->ae = tlv->ae;
msg->rxcost = get_u16(&tlv->rxcost);
babel_send_queue(void *arg)
{
struct babel_iface *ifa = arg;
+ ASSERT_DIE(birdloop_inside(ifa->proto->p.loop));
while ((babel_write_queue(ifa, &ifa->msg_queue) > 0) &&
(babel_send_to(ifa, IP6_BABEL_ROUTERS) > 0));
}
*/
if ((ifa->sk->tpos == ifa->sk->tbuf) && !ev_active(ifa->send_event))
- ev_schedule(ifa->send_event);
+ ev_send(proto_event_list(&ifa->proto->p), ifa->send_event);
}
/**
babel_send_unicast(union babel_msg *msg, struct babel_iface *ifa, ip_addr dest)
{
struct babel_proto *p = ifa->proto;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
struct babel_msg_node *msgn = sl_alloc(p->msg_slab);
list queue;
babel_enqueue(union babel_msg *msg, struct babel_iface *ifa)
{
struct babel_proto *p = ifa->proto;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
struct babel_msg_node *msgn = sl_alloc(p->msg_slab);
*msgn = (struct babel_msg_node) { .msg = *msg };
babel_open_socket(struct babel_iface *ifa)
{
struct babel_proto *p = ifa->proto;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
sock *sk;
sk = sk_new(ifa->pool);
{
uint frame_err UNUSED = 0;
struct babel_proto *p = ifa->proto;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
struct babel_tlv *tlv;
struct babel_parse_state state = {
babel_auth_add_tlvs(struct babel_iface *ifa, struct babel_tlv *hdr, uint max_len)
{
struct babel_proto *p = ifa->proto;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
struct babel_tlv_pc *tlv;
uint len;
babel_auth_sign(struct babel_iface *ifa, ip_addr dest)
{
struct babel_proto *p = ifa->proto;
+ ASSERT_DIE(birdloop_inside(p->p.loop));
sock *sk = ifa->sk;
if (ifa->cf->auth_type == BABEL_AUTH_NONE)
void
babel_auth_set_tx_overhead(struct babel_iface *ifa)
{
+ ASSERT_DIE(birdloop_inside(ifa->proto->p.loop));
if (ifa->cf->auth_type == BABEL_AUTH_NONE)
{
ifa->auth_tx_overhead = 0;