0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Iface: trace log messages cleanup

This commit is contained in:
Maria Matejka 2023-09-24 22:20:01 +02:00
parent c92b5ad218
commit 5ab182d8d1
3 changed files with 15 additions and 6 deletions

View File

@ -190,7 +190,7 @@ void ifa_link(struct ifa *a)
if (a) if (a)
{ {
debug("ifa_link: %p %d\n", a, a->uc); // debug("ifa_link: %p %d\n", a, a->uc);
a->uc++; a->uc++;
} }
} }
@ -202,7 +202,7 @@ void ifa_unlink(struct ifa *a)
if (!a) if (!a)
return; return;
debug("ifa_unlink: %p %d\n", a, a->uc); // debug("ifa_unlink: %p %d\n", a, a->uc);
if (--a->uc) if (--a->uc)
return; return;
@ -267,8 +267,7 @@ if_enqueue_notify_to(struct iface_notification x, struct iface_subscription *s)
struct iface_notification *in = sl_alloc(iface_sub_slab); struct iface_notification *in = sl_alloc(iface_sub_slab);
*in = x; *in = x;
debug("Enqueue notify %d/%p (%p) to %p\n", x.type, x.a, in, s); iface_trace(s, "Enqueueing interface notification (%d, %p, %p)", x.type, x.a, in);
ifnot_add_tail(&s->queue, in); ifnot_add_tail(&s->queue, in);
ev_send(s->target, &s->event); ev_send(s->target, &s->event);
} }
@ -558,11 +557,11 @@ iface_notify_hook(void *_s)
struct iface_subscription *s = _s; struct iface_subscription *s = _s;
IFACE_LOCK; IFACE_LOCK;
iface_trace(s, "Processing interface notifications");
while (!EMPTY_TLIST(ifnot, &s->queue)) while (!EMPTY_TLIST(ifnot, &s->queue))
{ {
struct iface_notification *n = THEAD(ifnot, &s->queue); struct iface_notification *n = THEAD(ifnot, &s->queue);
debug("Process notify %d/%p (%p) to %p\n", n->type, n->a, n, s);
IFACE_UNLOCK; IFACE_UNLOCK;
switch (n->type) { switch (n->type) {
@ -663,7 +662,7 @@ iface_unsubscribe(struct iface_subscription *s)
WALK_TLIST_DELSAFE(ifnot, n, &s->queue) WALK_TLIST_DELSAFE(ifnot, n, &s->queue)
{ {
debug("Drop notify %d/%p (%p) to %p\n", n->type, n->a, n, s); iface_trace(s, "Dropping interface notification (%d, %p, %p) on unsubscribe", n->type, n->a, n);
switch (n->type) switch (n->type)
{ {
case IFNOT_ADDRESS: case IFNOT_ADDRESS:

View File

@ -218,6 +218,9 @@ struct iface_subscription {
void (*if_notify)(struct proto *, unsigned flags, struct iface *i); void (*if_notify)(struct proto *, unsigned flags, struct iface *i);
void (*ifa_notify)(struct proto *, unsigned flags, struct ifa *a); void (*ifa_notify)(struct proto *, unsigned flags, struct ifa *a);
void (*neigh_notify)(struct neighbor *neigh); void (*neigh_notify)(struct neighbor *neigh);
const char *name;
int debug;
}; };
#include "lib/tlists.h" #include "lib/tlists.h"
@ -229,6 +232,11 @@ void iface_flush_notifications(struct iface_subscription *);
void iface_subscribe(struct iface_subscription *); void iface_subscribe(struct iface_subscription *);
void iface_unsubscribe(struct iface_subscription *); void iface_unsubscribe(struct iface_subscription *);
#define iface_trace(s, fmt, args...) do { \
if (s->debug) \
log(L_TRACE "%s: " fmt, s->name, ##args); \
} while (0)
/* /*
* Interface Pattern Lists * Interface Pattern Lists
*/ */

View File

@ -1244,6 +1244,8 @@ proto_start(struct proto *p)
p->pool = rp_newf(proto_pool, the_bird_domain.the_bird, "Protocol %s", p->cf->name); p->pool = rp_newf(proto_pool, the_bird_domain.the_bird, "Protocol %s", p->cf->name);
p->iface_sub.target = proto_event_list(p); p->iface_sub.target = proto_event_list(p);
p->iface_sub.name = p->name;
p->iface_sub.debug = !!(p->debug & D_IFACES);
PROTO_LOCKED_FROM_MAIN(p) PROTO_LOCKED_FROM_MAIN(p)
{ {