mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
Protocol hooks. All of them may be NULL.
This commit is contained in:
parent
7f4a39886c
commit
d9f330c5ff
@ -130,6 +130,7 @@ neigh_if_up(struct iface *i)
|
|||||||
n->sibling = i->neigh;
|
n->sibling = i->neigh;
|
||||||
i->neigh = n;
|
i->neigh = n;
|
||||||
DBG("Waking up sticky neighbor %08x\n", _I(n->addr));
|
DBG("Waking up sticky neighbor %08x\n", _I(n->addr));
|
||||||
|
if (n->proto->neigh_notify)
|
||||||
n->proto->neigh_notify(n);
|
n->proto->neigh_notify(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,6 +145,7 @@ neigh_if_down(struct iface *i)
|
|||||||
m = n->sibling;
|
m = n->sibling;
|
||||||
DBG("Flushing neighbor %08x on %s\n", _I(n->addr), n->iface->name);
|
DBG("Flushing neighbor %08x on %s\n", _I(n->addr), n->iface->name);
|
||||||
n->iface = NULL;
|
n->iface = NULL;
|
||||||
|
if (n->proto->neigh_notify)
|
||||||
n->proto->neigh_notify(n);
|
n->proto->neigh_notify(n);
|
||||||
if (!(n->flags & NEF_STICKY))
|
if (!(n->flags & NEF_STICKY))
|
||||||
{
|
{
|
||||||
@ -241,6 +243,8 @@ if_changed(struct iface *i, struct iface *j)
|
|||||||
static void
|
static void
|
||||||
if_notify_change(unsigned c, struct iface *old, struct iface *new)
|
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);
|
debug("Interface change notification (%x) for %s\n", c, new->name);
|
||||||
if (old)
|
if (old)
|
||||||
if_dump(old);
|
if_dump(old);
|
||||||
@ -250,7 +254,9 @@ if_notify_change(unsigned c, struct iface *old, struct iface *new)
|
|||||||
if (c & IF_CHANGE_UP)
|
if (c & IF_CHANGE_UP)
|
||||||
neigh_if_up(new);
|
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)
|
if (c & IF_CHANGE_DOWN)
|
||||||
neigh_if_down(old);
|
neigh_if_down(old);
|
||||||
|
@ -62,7 +62,7 @@ rta_same(rta *x, rta *y)
|
|||||||
ipa_equal(x->from, y->from) &&
|
ipa_equal(x->from, y->from) &&
|
||||||
x->iface == y->iface &&
|
x->iface == y->iface &&
|
||||||
ea_same(x->attrs, y->attrs) &&
|
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 *
|
static inline ea_list *
|
||||||
|
@ -85,6 +85,8 @@ rte_get_temp(rta *a)
|
|||||||
static int /* Actually better or at least as good as */
|
static int /* Actually better or at least as good as */
|
||||||
rte_better(rte *new, rte *old)
|
rte_better(rte *new, rte *old)
|
||||||
{
|
{
|
||||||
|
int (*better)(rte *, rte *);
|
||||||
|
|
||||||
if (!old)
|
if (!old)
|
||||||
return 1;
|
return 1;
|
||||||
if (new->pref > old->pref)
|
if (new->pref > old->pref)
|
||||||
@ -96,7 +98,9 @@ rte_better(rte *new, rte *old)
|
|||||||
/* FIXME!!! */
|
/* FIXME!!! */
|
||||||
die("Different protocols, but identical preferences => oops");
|
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
|
void
|
||||||
@ -106,6 +110,7 @@ rte_announce(rte *new, rte *old)
|
|||||||
|
|
||||||
WALK_LIST(p, proto_list)
|
WALK_LIST(p, proto_list)
|
||||||
if (!new || new->attrs->proto != p)
|
if (!new || new->attrs->proto != p)
|
||||||
|
if (p->rt_notify)
|
||||||
p->rt_notify(p, new, old);
|
p->rt_notify(p, new, old);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user