if (a)
{
- debug("ifa_link: %p %d\n", a, a->uc);
+// debug("ifa_link: %p %d\n", a, a->uc);
a->uc++;
}
}
if (!a)
return;
- debug("ifa_unlink: %p %d\n", a, a->uc);
+// debug("ifa_unlink: %p %d\n", a, a->uc);
if (--a->uc)
return;
struct iface_notification *in = sl_alloc(iface_sub_slab);
*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);
ev_send(s->target, &s->event);
}
struct iface_subscription *s = _s;
IFACE_LOCK;
+ iface_trace(s, "Processing interface notifications");
while (!EMPTY_TLIST(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;
switch (n->type) {
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)
{
case IFNOT_ADDRESS:
void (*if_notify)(struct proto *, unsigned flags, struct iface *i);
void (*ifa_notify)(struct proto *, unsigned flags, struct ifa *a);
void (*neigh_notify)(struct neighbor *neigh);
+
+ const char *name;
+ int debug;
};
#include "lib/tlists.h"
void iface_subscribe(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
*/
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.name = p->name;
+ p->iface_sub.debug = !!(p->debug & D_IFACES);
PROTO_LOCKED_FROM_MAIN(p)
{