]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Protocol hooks. All of them may be NULL.
authorMartin Mares <mj@ucw.cz>
Wed, 3 Jun 1998 08:40:10 +0000 (08:40 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 3 Jun 1998 08:40:10 +0000 (08:40 +0000)
nest/iface.c
nest/rt-attr.c
nest/rt-table.c

index 5342f120faaf7feeac3a683d3973593bf733f901..3f21c435fe9271582bb57adae868ea568ce1f304 100644 (file)
@@ -130,7 +130,8 @@ neigh_if_up(struct iface *i)
        n->sibling = i->neigh;
        i->neigh = n;
        DBG("Waking up sticky neighbor %08x\n", _I(n->addr));
-       n->proto->neigh_notify(n);
+       if (n->proto->neigh_notify)
+         n->proto->neigh_notify(n);
       }
 }
 
@@ -144,7 +145,8 @@ neigh_if_down(struct iface *i)
       m = n->sibling;
       DBG("Flushing neighbor %08x on %s\n", _I(n->addr), n->iface->name);
       n->iface = NULL;
-      n->proto->neigh_notify(n);
+      if (n->proto->neigh_notify)
+       n->proto->neigh_notify(n);
       if (!(n->flags & NEF_STICKY))
        {
          rem_node(&n->n);
@@ -241,6 +243,8 @@ if_changed(struct iface *i, struct iface *j)
 static void
 if_notify_change(unsigned c, struct iface *old, struct iface *new)
 {
+  struct proto *p;
+
   debug("Interface change notification (%x) for %s\n", c, new->name);
   if (old)
     if_dump(old);
@@ -250,7 +254,9 @@ if_notify_change(unsigned c, struct iface *old, struct iface *new)
   if (c & IF_CHANGE_UP)
     neigh_if_up(new);
 
-  /* FIXME: Notify protocols here */
+  WALK_LIST(p, proto_list)
+    if (p->if_notify)
+      p->if_notify(p, c, old, new);
 
   if (c & IF_CHANGE_DOWN)
     neigh_if_down(old);
index e6676252d7946b33dad056c26fe396299a5ed3e2..5f386a76110b2532cbbd1c96aa56a437e42a53a0 100644 (file)
@@ -62,7 +62,7 @@ rta_same(rta *x, rta *y)
          ipa_equal(x->from, y->from) &&
          x->iface == y->iface &&
          ea_same(x->attrs, y->attrs) &&
-         x->proto->rta_same(x, y));
+         (!x->proto->rta_same || x->proto->rta_same(x, y)));
 }
 
 static inline ea_list *
index e61e9f20f9ed06ddd28c5e93c71dd37d533d1f41..85d42beb701e12175ba6b9aa08832c56a4378a90 100644 (file)
@@ -85,6 +85,8 @@ rte_get_temp(rta *a)
 static int                             /* Actually better or at least as good as */
 rte_better(rte *new, rte *old)
 {
+  int (*better)(rte *, rte *);
+
   if (!old)
     return 1;
   if (new->pref > old->pref)
@@ -96,7 +98,9 @@ rte_better(rte *new, rte *old)
       /* FIXME!!! */
       die("Different protocols, but identical preferences => oops");
     }
-  return new->attrs->proto->rte_better(new, old);
+  if (better = new->attrs->proto->rte_better)
+    return better(new, old);
+  return 0;
 }
 
 void
@@ -106,7 +110,8 @@ rte_announce(rte *new, rte *old)
 
   WALK_LIST(p, proto_list)
     if (!new || new->attrs->proto != p)
-      p->rt_notify(p, new, old);
+      if (p->rt_notify)
+       p->rt_notify(p, new, old);
 }
 
 static inline void