From 7dc4827c968053e45bcb7f145e9986eeb20c993b Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 26 Mar 1999 21:50:43 +0000 Subject: Added everything protocols need to know about multiple routing tables, i.e. struct proto now contains field 'table' pointing to routing table the protocol is attached to. Use this instead of &master_table. Modified all protocols except the kernel syncer to use this field. --- nest/proto.c | 1 + nest/protocol.h | 3 +-- nest/rt-dev.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'nest') diff --git a/nest/proto.c b/nest/proto.c index 04ee289..450128e 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -86,6 +86,7 @@ proto_new(struct proto_config *c, unsigned size) p->preference = c->preference; p->disabled = c->disabled; p->proto = pr; + p->table = &master_table; p->in_filter = c->in_filter; p->out_filter = c->out_filter; return p; diff --git a/nest/protocol.h b/nest/protocol.h index 626dd99..1e62765 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -99,11 +99,10 @@ struct proto { void (*rte_insert)(struct network *, struct rte *); void (*rte_remove)(struct network *, struct rte *); + struct rtable *table; /* Routing table we're connected to */ struct filter *in_filter; /* Input filter */ struct filter *out_filter; /* Output filter */ - /* Connection to routing tables? */ - /* Hic sunt protocol-specific data */ }; diff --git a/nest/rt-dev.c b/nest/rt-dev.c index c122b96..a92fe6f 100644 --- a/nest/rt-dev.c +++ b/nest/rt-dev.c @@ -31,7 +31,7 @@ dev_if_notify(struct proto *p, unsigned c, struct iface *new, struct iface *old) net *n; debug("dev_if_notify: %s going down\n", old->name); - n = net_find(&master_table, 0, old->prefix, old->pxlen); + n = net_find(p->table, 0, old->prefix, old->pxlen); if (!n) { debug("dev_if_notify: device shutdown: prefix not found\n"); @@ -56,9 +56,9 @@ dev_if_notify(struct proto *p, unsigned c, struct iface *new, struct iface *old) A.attrs = NULL; a = rta_lookup(&A); if (new->flags & IF_UNNUMBERED) - n = net_get(&master_table, 0, new->opposite, new->pxlen); + n = net_get(p->table, 0, new->opposite, new->pxlen); else - n = net_get(&master_table, 0, new->prefix, new->pxlen); + n = net_get(p->table, 0, new->prefix, new->pxlen); e = rte_get_temp(a); e->net = n; e->pflags = 0; -- cgit v1.2.3