Commit 92912f06 authored by Jan Moskyto Matejka's avatar Jan Moskyto Matejka
Browse files

Merge remote-tracking branch 'origin/rte-update' into int-new

parents a8caff32 2003a184
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ proto_get_router_id(struct proto_config *pc)
}

/* Moved from route.h to avoid dependency conflicts */
static inline void rte_update(struct proto *p, net *net, rte *new) { rte_update2(p->main_channel, net, new, p->main_source); }
static inline void rte_update(struct proto *p, net_addr *n, rte *new) { rte_update2(p->main_channel, n, new, p->main_source); }

extern list proto_list;

+1 −1
Original line number Diff line number Diff line
@@ -276,7 +276,7 @@ static inline net *net_get(rtable *tab, const net_addr *addr) { return (net *) f

rte *rte_find(net *net, struct rte_src *src);
rte *rte_get_temp(struct rta *);
void rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src);
void rte_update2(struct channel *c, net_addr *n, rte *new, struct rte_src *src);
/* rte_update() moved to protocol.h to avoid dependency conflicts */
void rte_discard(rtable *tab, rte *old);
int rt_examine(rtable *t, net_addr *a, struct proto *p, struct filter *filter);
+2 −13
Original line number Diff line number Diff line
@@ -55,24 +55,15 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad)

  if (flags & IF_CHANGE_DOWN)
    {
      net *n;

      DBG("dev_if_notify: %s:%I going down\n", ad->iface->name, ad->ip);
      n = net_find(c->table, &ad->prefix);
      if (!n)
	{
	  DBG("dev_if_notify: device shutdown: prefix not found\n");
	  return;
	}

      /* Use iface ID as local source ID */
      struct rte_src *src = rt_get_source(P, ad->iface->index);
      rte_update2(c, n, NULL, src);
      rte_update2(c, &ad->prefix, NULL, src);
    }
  else if (flags & IF_CHANGE_UP)
    {
      rta *a;
      net *n;
      rte *e;

      DBG("dev_if_notify: %s:%I going up\n", ad->iface->name, ad->ip);
@@ -90,11 +81,9 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad)
      };

      a = rta_lookup(&a0);
      n = net_get(c->table, &ad->prefix);
      e = rte_get_temp(a);
      e->net = n;
      e->pflags = 0;
      rte_update2(c, n, e, src);
      rte_update2(c, &ad->prefix, e, src);
    }
}

+9 −5
Original line number Diff line number Diff line
@@ -1267,19 +1267,23 @@ rte_unhide_dummy_routes(net *net, rte **dummy)
 */

void
rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src)
rte_update2(struct channel *c, net_addr *n, rte *new, struct rte_src *src)
{
  struct proto *p = c->proto;
  struct proto_stats *stats = &c->stats;
  struct filter *filter = c->in_filter;
  ea_list *tmpa = NULL;
  rte *dummy = NULL;
  net *nn;

  ASSERT(c->channel_state == CS_UP);

  rte_update_lock();
  if (new)
    {
      nn = net_get(c->table, n);

      new->net = nn;
      new->sender = c;

      if (!new->pref)
@@ -1333,7 +1337,7 @@ rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src)
    {
      stats->imp_withdraws_received++;

      if (!net || !src)
      if (!(nn = net_find(c->table, n)) || !src)
	{
	  stats->imp_withdraws_ignored++;
	  rte_update_unlock();
@@ -1342,9 +1346,9 @@ rte_update2(struct channel *c, net *net, rte *new, struct rte_src *src)
    }

 recalc:
  rte_hide_dummy_routes(net, &dummy);
  rte_recalculate(c, net, new, src);
  rte_unhide_dummy_routes(net, &dummy);
  rte_hide_dummy_routes(nn, &dummy);
  rte_recalculate(c, nn, new, src);
  rte_unhide_dummy_routes(nn, &dummy);
  rte_update_unlock();
  return;

+2 −5
Original line number Diff line number Diff line
@@ -1973,7 +1973,6 @@ again1:

      if (reload || ort_changed(nf, &a0))
      {
	net *ne = net_get(p->p.main_channel->table, nf->fn.addr);
	rta *a = rta_lookup(&a0);
	rte *e = rte_get_temp(a);

@@ -1984,11 +1983,10 @@ again1:
	e->u.ospf.tag = nf->old_tag = nf->n.tag;
	e->u.ospf.router_id = nf->old_rid = nf->n.rid;
	e->pflags = 0;
	e->net = ne;

	DBG("Mod rte type %d - %N via %I on iface %s, met %d\n",
	    a0.source, nf->fn.addr, a0.gw, a0.iface ? a0.iface->name : "(none)", nf->n.metric1);
	rte_update(&p->p, ne, e);
	rte_update(&p->p, nf->fn.addr, e);
      }
    }
    else if (nf->old_rta)
@@ -1997,8 +1995,7 @@ again1:
      rta_free(nf->old_rta);
      nf->old_rta = NULL;

      net *ne = net_get(p->p.main_channel->table, nf->fn.addr);
      rte_update(&p->p, ne, NULL);
      rte_update(&p->p, nf->fn.addr, NULL);
    }

    /* Remove unused rt entry, some special entries are persistent */
Loading