]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Added everything protocols need to know about multiple routing tables,
authorMartin Mares <mj@ucw.cz>
Fri, 26 Mar 1999 21:50:43 +0000 (21:50 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 26 Mar 1999 21:50:43 +0000 (21:50 +0000)
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
nest/protocol.h
nest/rt-dev.c
proto/rip/rip.c
proto/static/static.c

index 04ee289b58f195fa47c425ecfcd82623c3d80990..450128e34ce30c4a6c925e7d2d1379a8d87b1693 100644 (file)
@@ -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;
index 626dd994fca44cd4cc765648258e96f9b24b3a49..1e6276524f559433dab3aff4c193cb64804ffba5 100644 (file)
@@ -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 */
 };
 
index c122b967b0b7089313bcfeab32dd926680e56ecc..a92fe6f9bc47b99261b9bdc2a4bd082c3901365f 100644 (file)
@@ -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;
index 249026d3603fe5b6ff4573ea2172e6cfa5785ccd..060446f7ba2ce0c4d97048ec46e47e20da42021a 100644 (file)
@@ -226,7 +226,7 @@ advertise_entry( struct proto *p, struct rip_block *b, ip_addr whotoldme )
     log( L_ERR "%I asked me to route %I/%I, but that is not valid netmask.", A.from, b->network, b->netmask );
     return;
   }
-  n = net_get( &master_table, 0, b->network, ipa_mklen( b->netmask ));
+  n = net_get( p->table, 0, b->network, ipa_mklen( b->netmask ));
   r = rte_get_temp(a);
   r->u.rip.metric = ntohl(b->metric) + rif->metric;
   if (r->u.rip.metric > P_CF->infinity) r->u.rip.metric = P_CF->infinity;
index 873abe3db4d998863f0fa9bdf18132eb5ddfc5a4..3a485bf3f20a5d4f4ac393a35017e82b63a7a9cf 100644 (file)
@@ -37,7 +37,7 @@ static_install(struct proto *p, struct static_route *r, struct iface *ifa)
   a.iface = ifa;
   aa = rta_lookup(&a);
 
-  n = net_get(&master_table, a.tos, r->net, r->masklen);
+  n = net_get(p->table, a.tos, r->net, r->masklen);
   e = rte_get_temp(aa);
   e->net = n;
   e->pflags = 0;
@@ -50,7 +50,7 @@ static_remove(struct proto *p, struct static_route *r)
   net *n;
 
   DBG("Removing static route %I/%d\n", r->net, r->masklen);
-  n = net_find(&master_table, 0, r->net, r->masklen);
+  n = net_find(p->table, 0, r->net, r->masklen);
   if (n)
     rte_update(n, p, NULL);
 }