Exemplo n.º 1
0
int report_message(message *m)
{
  struct chunk *ch;

  for (ch=m->u.down;ch;ch=ch->next) {
    report_chunk(ch);
  }

  return 0;
}
Exemplo n.º 2
0
/*
 * send the next chunk of our routing table to all neighbors.
 * return the length of the smallest chunk we sent out.
 */
int
report_next_chunk(void)
{
    register vifi_t vifi;
    register struct uvif *v;
    register struct rtentry *sr;
    register int i, n = 0, min = 20000;
    static int start_rt;

    if (nroutes <= 0)
        return (0);

    /*
     * find this round's starting route.
     */
    for (sr = rt_end, i = start_rt; --i >= 0; ) {
        sr = sr->rt_prev;
        if (sr == RT_ADDR)
            sr = rt_end;
    }

    /*
     * send one chunk of routes starting at this round's start to
     * all our neighbors.
     */
    for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
        if ((v->uv_neighbors != NULL)
#ifdef NOTYET
                && !(v->uv_flags & VIFF_LEAF)
#endif
           ) {
            n = report_chunk(sr, vifi,
                             (v->uv_flags & VIFF_TUNNEL) ? v->uv_rmt_addr
                             : dvmrp_group);
            if (n < min)
                min = n;
        }
    }
    if (min == 20000)
        min = 0;	/* Neighborless router didn't send any routes */

    n = min;
    logit(LOG_INFO, 0, "update %d starting at %d of %d",
          n, (nroutes - start_rt), nroutes);

    start_rt = (start_rt + n) % nroutes;
    return (n);
}