mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-09 20:58:44 +00:00
Added pointer to network to RTE. The complications with passing NET separately
aren't worth 4 bytes per RTE. rte_discard and rte_dump don't need net * as parameter.
This commit is contained in:
parent
b6903c948b
commit
a0762910a6
@ -85,7 +85,8 @@ typedef struct network {
|
|||||||
|
|
||||||
typedef struct rte {
|
typedef struct rte {
|
||||||
struct rte *next;
|
struct rte *next;
|
||||||
struct rtattr *attrs;
|
net *net; /* Network this RTE belongs to */
|
||||||
|
struct rtattr *attrs; /* Attributes of this route */
|
||||||
byte flags; /* Flags (REF_...) */
|
byte flags; /* Flags (REF_...) */
|
||||||
byte pflags; /* Protocol-specific flags */
|
byte pflags; /* Protocol-specific flags */
|
||||||
word pref; /* Route preference */
|
word pref; /* Route preference */
|
||||||
@ -125,8 +126,8 @@ net *net_get(rtable *tab, unsigned tos, ip_addr addr, unsigned len);
|
|||||||
rte *rte_find(net *net, struct proto *p);
|
rte *rte_find(net *net, struct proto *p);
|
||||||
rte *rte_get_temp(struct rtattr *);
|
rte *rte_get_temp(struct rtattr *);
|
||||||
void rte_update(net *net, struct proto *p, rte *new);
|
void rte_update(net *net, struct proto *p, rte *new);
|
||||||
void rte_discard(net *net, rte *old);
|
void rte_discard(rte *old);
|
||||||
void rte_dump(net *, rte *);
|
void rte_dump(rte *);
|
||||||
void rt_dump(rtable *);
|
void rt_dump(rtable *);
|
||||||
void rt_dump_all(void);
|
void rt_dump_all(void);
|
||||||
void rt_feed_baby(struct proto *p);
|
void rt_feed_baby(struct proto *p);
|
||||||
|
@ -53,6 +53,7 @@ dev_if_notify(struct proto *p, unsigned c, struct iface *old, struct iface *new)
|
|||||||
else
|
else
|
||||||
n = net_get(&master_table, 0, new->prefix, new->pxlen);
|
n = net_get(&master_table, 0, new->prefix, new->pxlen);
|
||||||
e = rte_get_temp(a);
|
e = rte_get_temp(a);
|
||||||
|
e->net = n;
|
||||||
e->pflags = 0;
|
e->pflags = 0;
|
||||||
rte_update(n, p, e);
|
rte_update(n, p, e);
|
||||||
}
|
}
|
||||||
|
@ -209,16 +209,19 @@ rte_update(net *net, struct proto *p, rte *new)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rte_discard(net *net, rte *old) /* Non-filtered route deletion, used during garbage collection */
|
rte_discard(rte *old) /* Non-filtered route deletion, used during garbage collection */
|
||||||
{
|
{
|
||||||
rte_update(net, old->attrs->proto, NULL);
|
rte_update(old->net, old->attrs->proto, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rte_dump(net *n, rte *e)
|
rte_dump(rte *e)
|
||||||
{
|
{
|
||||||
|
net *n = e->net;
|
||||||
if (n)
|
if (n)
|
||||||
debug("%1I/%2d ", n->n.prefix, n->n.pxlen);
|
debug("%1I/%2d ", n->n.prefix, n->n.pxlen);
|
||||||
|
else
|
||||||
|
debug("??? ");
|
||||||
debug("PF=%02x pref=%d lm=%d ", e->pflags, e->pref, now-e->lastmod);
|
debug("PF=%02x pref=%d lm=%d ", e->pflags, e->pref, now-e->lastmod);
|
||||||
rta_dump(e->attrs);
|
rta_dump(e->attrs);
|
||||||
if (e->flags & REF_CHOSEN)
|
if (e->flags & REF_CHOSEN)
|
||||||
@ -240,7 +243,7 @@ rt_dump(rtable *t)
|
|||||||
{
|
{
|
||||||
n = (net *) fn;
|
n = (net *) fn;
|
||||||
for(e=n->routes; e; e=e->next)
|
for(e=n->routes; e; e=e->next)
|
||||||
rte_dump(n, e);
|
rte_dump(e);
|
||||||
}
|
}
|
||||||
FIB_WALK_END;
|
FIB_WALK_END;
|
||||||
t = t->sibling;
|
t = t->sibling;
|
||||||
|
Loading…
Reference in New Issue
Block a user