]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge commit 'f48fa14214301382b2e6b134788a7506b61b664f' into integrated
authorOndrej Zajicek <santiago@crfreenet.org>
Tue, 29 Apr 2014 15:23:38 +0000 (17:23 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Tue, 29 Apr 2014 15:23:38 +0000 (17:23 +0200)
Conflicts:

nest/rt-table.c
proto/bgp/attrs.c
proto/bgp/packets.c
proto/ospf/ospf.c
proto/rip/rip.c
proto/static/static.c
sysdep/unix/krt.c

15 files changed:
1  2 
nest/proto.c
nest/protocol.h
nest/route.h
nest/rt-dev.c
nest/rt-table.c
proto/bgp/attrs.c
proto/bgp/packets.c
proto/ospf/ospf.c
proto/ospf/rt.c
proto/rip/rip.c
proto/rip/rip.h
proto/static/static.c
sysdep/bsd/krt-sock.c
sysdep/linux/netlink.c
sysdep/unix/krt.c

diff --cc nest/proto.c
Simple merge
diff --cc nest/protocol.h
Simple merge
diff --cc nest/route.h
Simple merge
diff --cc nest/rt-dev.c
Simple merge
diff --cc nest/rt-table.c
index c8d0c1f73b06427b0f5267fb365fca41aaa2438c,8c91ea0aaf6305c3b9bbf906db7184f543e15a11..66f6c3c6234ced62dc3f1583ae5614acc3a4ac3d
@@@ -688,8 -688,7 +695,8 @@@ rte_recalculate(struct announce_hook *a
  #ifdef CONFIG_RIP
              /* lastmod is used internally by RIP as the last time
                 when the route was received. */
-             if ((src->proto == &proto_rip) ||
-                 (src->proto == &proto_ripng))
 -            if (src->proto->proto == &proto_rip)
++            if ((src->proto->proto == &proto_rip) ||
++                (src->proto->proto == &proto_ripng))
                old->lastmod = now;
  #endif
              return;
@@@ -1240,44 -1243,12 +1251,47 @@@ rt_event(void *ptr
      rt_next_hop_update(tab);
  
    if (tab->gc_scheduled)
-     rt_prune_nets(tab);
+     {
+       rt_prune_nets(tab);
+       rt_prune_sources(); // FIXME this should be moved to independent event
+     }
  }
  
 +/**
 + * rt_addrsize - returns (host format) size of address of given type
 + * @addr_type: address type
 + *
 + * Returns sizeof() appropriate structure or sizeof(ip_addr) if
 + * address type is unknown
 + *
 + */
 +int
 +rt_addrsize(int addr_type)
 +{
 +  switch (addr_type)
 +  {
 +#ifdef MPLS_VPN
 +    case RT_VPN4:
 +      return sizeof(vpn4_addr);
 +    case RT_VPN6:
 +      return sizeof(vpn6_addr);
 +#endif
 +    case RT_IPV4:
 +      // XXXX
 +      return sizeof(ip6_addr);
 +    case RT_IPV6:
 +      return sizeof(ip6_addr);
 +  }
 +
 +  return sizeof(ip_addr);
 +}
 +
 +
 +/**
 + * rt_setup - initialize routing table
 + *
 + * This function is called to set up rtable (hooks, lists, fib, ..)
 + */
  void
  rt_setup(pool *p, rtable *t, char *name, struct rtable_config *cf)
  {
@@@ -2140,12 -2075,10 +2153,13 @@@ rt_get_hostentry(rtable *tab, ip_addr a
  void
  rta_set_recursive_next_hop(rtable *dep, rta *a, rtable *tab, ip_addr *gw, ip_addr *ll)
  {
-   rta_apply_hostentry(a, rt_find_hostentry(tab, *gw, *ll, dep));
 +  if (tab->addr_type != RT_IP)
 +    return;
 +
+   rta_apply_hostentry(a, rt_get_hostentry(tab, *gw, *ll, dep));
  }
  
  /*
   *  CLI commands
   */
@@@ -2192,11 -2128,11 +2209,11 @@@ rt_show_rte(struct cli *c, byte *prefix
        ea_merge(t, tmpa);
        ea_sort(tmpa);
      }
-   if (a->proto->proto->get_route_info)
-     a->proto->proto->get_route_info(e, info, tmpa);
+   if (get_route_info)
+     get_route_info(e, info, tmpa);
    else
      bsprintf(info, " (%d)", e->pref);
-   cli_printf(c, -1007, "%-18s %s [%s %s%s]%s%s", prefix, via, a->proto->name,
 -  cli_printf(c, -1007, "%-18s %s [%s %s%s]%s%s", ia, via, a->src->proto->name,
++  cli_printf(c, -1007, "%-18s %s [%s %s%s]%s%s", prefix, via, a->src->proto->name,
             tm, from, primary ? (sync_error ? " !" : " *") : "", info);
    for (nh = a->nexthops; nh; nh = nh->next)
      cli_printf(c, -1007, "\tvia %I on %s weight %d", nh->gw, nh->iface->name, nh->weight + 1);
Simple merge
index a70c24a6c32a57514d6fd76dc15ba1db6baa2525,4206433278948c213bda64f9f5e9033771b36cbf..94f95e2a5b3e450b3a32259e3ebe451d8d766264
@@@ -229,10 -247,17 +247,17 @@@ bgp_encode_prefixes(struct bgp_proto *p
    while (!EMPTY_LIST(buck->prefixes) && remains >= (1+sizeof(ip_addr)))
      {
        struct bgp_prefix *px = SKIP_BACK(struct bgp_prefix, bucket_node, HEAD(buck->prefixes));
 -      DBG("\tDequeued route %I/%d\n", px->n.prefix, px->n.pxlen);
 +      DBG("\tDequeued route %F\n", &px->n);
+       if (p->add_path_tx)
+       {
+         put_u32(w, px->path_id);
+         w += 4;
+       }
        *w++ = px->n.pxlen;
        bytes = (px->n.pxlen + 7) / 8;
 -      a = px->n.prefix;
 +      a = *FPREFIX_IP(&px->n);
        ipa_hton(a);
        memcpy(w, &a, bytes);
        w += bytes;
@@@ -249,9 -275,10 +275,10 @@@ bgp_flush_prefixes(struct bgp_proto *p
    while (!EMPTY_LIST(buck->prefixes))
      {
        struct bgp_prefix *px = SKIP_BACK(struct bgp_prefix, bucket_node, HEAD(buck->prefixes));
 -      log(L_ERR "%s: - route %I/%d skipped", p->p.name, px->n.prefix, px->n.pxlen);
 +      log(L_ERR "%s: - route %F skipped", p->p.name, &px->n);
        rem_node(&px->bucket_node);
-       fib_delete(&p->prefix_fib, px);
+       bgp_free_prefix(p, px);
+       // fib_delete(&p->prefix_fib, px);
      }
  }
  
index 43e24805144ccbc6d26007add644bdb5864dc6bb,232f3f6c43c338cf735684bff001dfa52511d028..ad027403c6a46937181ff29a2d4ca8b1717e8457
@@@ -297,17 -298,16 +297,17 @@@ ospf_dump(struct proto *p
  static struct proto *
  ospf_init(struct proto_config *c)
  {
 +  struct ospf_config *oc = (struct ospf_config *) c;  
    struct proto *p = proto_new(c, sizeof(struct proto_ospf));
  
-   p->make_tmp_attrs = ospf_make_tmp_attrs;
-   p->store_tmp_attrs = ospf_store_tmp_attrs;
-   p->import_control = ospf_import_control;
-   p->reload_routes = ospf_reload_routes;
    p->accept_ra_types = RA_OPTIMAL;
    p->rt_notify = ospf_rt_notify;
    p->if_notify = ospf_if_notify;
 -  p->ifa_notify = ospf_ifa_notify;
 +  p->ifa_notify = oc->ospf2 ? ospf_ifa_notify2 : ospf_ifa_notify3;
+   p->import_control = ospf_import_control;
+   p->reload_routes = ospf_reload_routes;
+   p->make_tmp_attrs = ospf_make_tmp_attrs;
+   p->store_tmp_attrs = ospf_store_tmp_attrs;
    p->rte_better = ospf_rte_better;
    p->rte_same = ospf_rte_same;
  
diff --cc proto/ospf/rt.c
index 51fbf66c1f855b639331f802f902ab646cc2c711,52110aa177f2634928d9c4ec7826271233d4052c..b8f41f8d09a334455d2cd1f13c33594a1ab86bea
@@@ -1917,11 -2042,11 +1917,11 @@@ again1
        nf->old_rta = NULL;
  
        net *ne = net_get(p->table, nf->fn.prefix, nf->fn.pxlen);
-       rte_update(p->table, ne, p, p, NULL);
+       rte_update(p, ne, NULL);
      }
  
 -    /* Remove unused rt entry. Entries with fn.x0 == 1 are persistent. */
 -    if (!nf->n.type && !nf->fn.x0 && !nf->fn.x1)
 +    /* Remove unused rt entry. Entries with any flags are persistent. */
 +    if (!nf->n.type && !nf->fn.flags)
      {
        FIB_ITERATE_PUT(&fit, nftmp);
        fib_delete(fib, nftmp);
diff --cc proto/rip/rip.c
index 125a193e6143ee7e1a466eb26eb68395c6953a9d,5cc40403f36a5bc58015734aca52f1907d194440..bc93dc7e68993adeb89ac937e2d87c41cec4bc5f
@@@ -356,28 -325,9 +358,28 @@@ process_block( struct proto *p, struct 
      return;
    }
  
 -  A.iface = neighbor->iface;
 -  if (!(rif = neighbor->data)) {
 -    rif = neighbor->data = find_interface(p, A.iface);
 +
 +  TRACE(D_PACKETS, "Received %I/%d metric %d from %I",
 +      prefix, pxlen, metric, from);
 +
 +  rta A = {
-     .proto = p,
++    .src= p->main_source,
 +    .source = RTS_RIP,
 +    .scope = SCOPE_UNIVERSE,
 +    .cast = RTC_UNICAST,
 +    .dest = RTD_ROUTER,
 +    .gw = gw,
 +    .from = from,
 +    .iface = neigh->iface
 +  };
 +
 +  if (rip_is_old(p)) pxlen += 96;  // XXXX: Hack
 +  net *n = net_get(p->table, prefix, pxlen);
 +  rta *a = rta_lookup(&A);
 +  rte *r = rte_get_temp(a);
 +
 +  if (!(rif = neigh->data)) {
 +    rif = neigh->data = find_interface(p, A.iface);
    }
    if (!rif)
      bug("Route packet using unknown interface? No.");
diff --cc proto/rip/rip.h
Simple merge
index f1359b003b83e7f88ab5d758443bcb7d61683665,9b115acd2c2f6b54adafade975e47157f9930649..d84cbb89deea70d23f36a2e79d3f215b7cad0290
@@@ -62,16 -66,14 +62,16 @@@ static_install(struct proto *p, struct 
      return;
  
    DBG("Installing static route %I/%d, rtd=%d\n", r->net, r->masklen, r->dest);
 -  bzero(&a, sizeof(a));
 -  a.src = p->main_source;
 -  a.source = (r->dest == RTD_DEVICE) ? RTS_STATIC_DEVICE : RTS_STATIC;
 -  a.scope = SCOPE_UNIVERSE;
 -  a.cast = RTC_UNICAST;
 -  a.dest = r->dest;
 -  a.gw = r->via;
 -  a.iface = ifa;
 +
 +  rta a = {
-     .proto = p,
++    .src = p->main_source;
 +    .source = (r->dest == RTD_DEVICE) ? RTS_STATIC_DEVICE : RTS_STATIC,
 +    .scope = SCOPE_UNIVERSE,
 +    .cast = RTC_UNICAST,
 +    .dest = r->dest,
 +    .gw = r->via,
 +    .iface = ifa
 +  };
  
    if (r->dest == RTD_MULTIPATH)
      {
    if (r->dest == RTDX_RECURSIVE)
      rta_set_recursive_next_hop(p->table, &a, p_igp_table(p), &r->via, &r->via);
  
 -  aa = rta_lookup(&a);
 -  n = net_get(p->table, r->net, r->masklen);
 -  e = rte_get_temp(aa);
 +  // int pxlen = r->masklen + (ipa_is_ip4(r->net) ? 96 : 0);  // XXXX: Hack
 +  net *n = net_get(p->table, r->net, r->masklen);
 +  rta *aa = rta_lookup(&a);
 +  rte *e = rte_get_temp(aa);
    e->net = n;
    e->pflags = 0;
-   rte_update(p->table, n, p, p, e);
+   rte_update(p, n, e);
    r->installed = 1;
  }
  
@@@ -123,11 -126,8 +123,10 @@@ static_remove(struct proto *p, struct s
      return;
  
    DBG("Removing static route %I/%d\n", r->net, r->masklen);
 -  n = net_find(p->table, r->net, r->masklen);
 +
 +  // int pxlen = r->masklen + (ipa_is_ip4(r->net) ? 96 : 0);  // XXXX: Hack
 +  net *n = net_find(p->table, r->net, r->masklen);
-   if (n)
-     rte_update(p->table, n, p, p, NULL);
+   rte_update(p, n, NULL);
    r->installed = 0;
  }
  
Simple merge
index 0f458b2c866efda14ae2f8cb9576a05d8a463d94,ed8769b70507210d6d23f1b28851e6081f2c59ae..17cf0291b1496e2838d0bffb230b383a819e67b9
@@@ -834,11 -802,10 +834,11 @@@ nl_parse_route(struct nlmsghdr *h, int 
        src = KRT_SRC_ALIEN;
      }
  
 -  net *net = net_get(p->p.table, dst, i->rtm_dst_len);
 +  int pxlen = i->rtm_dst_len + (ipv4 ? 96 : 0);  // XXXX: Hack
 +  net *net = net_get(p->p.table, dst, pxlen);
  
    rta ra = {
-     .proto = &p->p,
+     .src= p->p.main_source,
      .source = RTS_INHERIT,
      .scope = SCOPE_UNIVERSE,
      .cast = RTC_UNICAST
index 40827898d9de838320e8e32f8ec278b9078753e4,6fdef61991ba4ba113eaf6bb114a574335487bbf..d64e14f2685415aca4b4ce702cc70deb229e607d
@@@ -357,9 -357,8 +357,8 @@@ krt_learn_announce_update(struct krt_pr
  static void
  krt_learn_announce_delete(struct krt_proto *p, net *n)
  {
 -  n = net_find(p->p.table, n->n.prefix, n->n.pxlen);
 +  n = fib_find(&p->p.table->fib, FPREFIX(&n->n), n->n.pxlen);
-   if (n)
-     rte_update(p->p.table, n, &p->p, &p->p, NULL);
+   rte_update(&p->p, n, NULL);
  }
  
  /* Called when alien route is discovered during scan */