Route update hook now gets network prefix as well as updated

route attributes.
This commit is contained in:
Martin Mares 1998-08-31 21:13:42 +00:00
parent bf65d27dea
commit 8c43696da0
2 changed files with 6 additions and 5 deletions

View file

@ -16,6 +16,7 @@ struct iface;
struct rte; struct rte;
struct neighbor; struct neighbor;
struct rtattr; struct rtattr;
struct network;
/* /*
* Routing Protocol * Routing Protocol
@ -59,7 +60,7 @@ struct proto {
unsigned preference; /* Default route preference */ unsigned preference; /* Default route preference */
void (*if_notify)(struct proto *, unsigned flags, struct iface *new, struct iface *old); void (*if_notify)(struct proto *, unsigned flags, struct iface *new, struct iface *old);
void (*rt_notify)(struct proto *, struct rte *new, struct rte *old); void (*rt_notify)(struct proto *, struct network *net, struct rte *new, struct rte *old);
void (*neigh_notify)(struct neighbor *neigh); void (*neigh_notify)(struct neighbor *neigh);
void (*dump)(struct proto *); /* Debugging dump */ void (*dump)(struct proto *); /* Debugging dump */
void (*start)(struct proto *); /* Start the instance */ void (*start)(struct proto *); /* Start the instance */

View file

@ -106,14 +106,14 @@ rte_better(rte *new, rte *old)
} }
void void
rte_announce(rte *new, rte *old) rte_announce(net *net, rte *new, rte *old)
{ {
struct proto *p; struct proto *p;
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) if (p->rt_notify)
p->rt_notify(p, new, old); p->rt_notify(p, net, new, old);
} }
static inline void static inline void
@ -143,7 +143,7 @@ rte_update(net *net, struct proto *p, rte *new)
if (new && rte_better(new, old_best)) /* It's a new optimal route => announce and relink it */ if (new && rte_better(new, old_best)) /* It's a new optimal route => announce and relink it */
{ {
rte_announce(new, old_best); rte_announce(net, new, old_best);
new->next = net->routes; new->next = net->routes;
net->routes = new; net->routes = new;
} }
@ -155,7 +155,7 @@ rte_update(net *net, struct proto *p, rte *new)
for(s=net->routes; s; s=s->next) for(s=net->routes; s; s=s->next)
if (rte_better(s, r)) if (rte_better(s, r))
r = s; r = s;
rte_announce(r, old_best); rte_announce(net, r, old_best);
if (r) /* Re-link the new optimal route */ if (r) /* Re-link the new optimal route */
{ {
k = &net->routes; k = &net->routes;