mirror of
				https://gitlab.labs.nic.cz/labs/bird.git
				synced 2024-05-11 16:54:54 +00:00 
			
		
		
		
	Iface: trace log messages cleanup
This commit is contained in:
		
							
								
								
									
										11
									
								
								nest/iface.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								nest/iface.c
									
									
									
									
									
								
							@@ -190,7 +190,7 @@ void ifa_link(struct ifa *a)
 | 
			
		||||
 | 
			
		||||
  if (a)
 | 
			
		||||
  {
 | 
			
		||||
    debug("ifa_link: %p %d\n", a, a->uc);
 | 
			
		||||
//    debug("ifa_link: %p %d\n", a, a->uc);
 | 
			
		||||
    a->uc++;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -202,7 +202,7 @@ void ifa_unlink(struct ifa *a)
 | 
			
		||||
  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;
 | 
			
		||||
 | 
			
		||||
@@ -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);
 | 
			
		||||
  *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);
 | 
			
		||||
}
 | 
			
		||||
@@ -558,11 +557,11 @@ iface_notify_hook(void *_s)
 | 
			
		||||
  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) {
 | 
			
		||||
@@ -663,7 +662,7 @@ iface_unsubscribe(struct iface_subscription *s)
 | 
			
		||||
 | 
			
		||||
  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:
 | 
			
		||||
 
 | 
			
		||||
@@ -218,6 +218,9 @@ struct iface_subscription {
 | 
			
		||||
  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"
 | 
			
		||||
@@ -229,6 +232,11 @@ void iface_flush_notifications(struct iface_subscription *);
 | 
			
		||||
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
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
@@ -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->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)
 | 
			
		||||
  {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user