]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Backport some minor changes from int-new
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 12 Sep 2017 14:33:29 +0000 (16:33 +0200)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 12 Sep 2017 14:33:29 +0000 (16:33 +0200)
lib/birdlib.h
nest/protocol.h
nest/route.h
nest/rt-table.c
proto/bgp/attrs.c

index d21cdf1f1b578cf24aac656c73a5cb988a96a621..aaa7a0a3acd4e53d6090da82e8a079499905b423 100644 (file)
@@ -37,6 +37,9 @@ struct align_probe { char x; long int y; };
 #define ABS(a)   ((a)>=0 ? (a) : -(a))
 #define DELTA(a,b) (((a)>=(b))?(a)-(b):(b)-(a))
 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))
+#define BYTES(n) ((((uint) (n)) + 7) / 8)
+#define CALL(fn, args...) ({ if (fn) fn(args); })
+#define ADVANCE(w, r, l) ({ r -= l; w += l; })
 
 
 /* Bitfield macros */
index 3c30a58150536c07e52af0ee9b206a78659049c7..18dfbd6fb71ff2138fde6ecf3b2156799f1e2504 100644 (file)
@@ -12,6 +12,7 @@
 #include "lib/lists.h"
 #include "lib/resource.h"
 #include "lib/timer.h"
+#include "nest/route.h"
 #include "conf/conf.h"
 
 struct iface;
@@ -287,6 +288,17 @@ proto_get_router_id(struct proto_config *pc)
   return pc->router_id ? pc->router_id : pc->global->router_id;
 }
 
+static inline struct ea_list *
+rte_make_tmp_attrs(struct rte *rt, struct linpool *pool)
+{
+  struct ea_list *(*mta)(struct rte *rt, struct linpool *pool);
+  mta = rt->attrs->src->proto->make_tmp_attrs;
+  return mta ? mta(rt, pool) : NULL;
+}
+
+/* Moved from route.h to avoid dependency conflicts */
+static inline void rte_update(struct proto *p, net *net, rte *new) { rte_update2(p->main_ahook, net, new, p->main_source); }
+
 extern list active_proto_list;
 
 /*
index 383f4def09420c1539bb85ad511fdc0b5cc8fa7c..2e6ae5bfed50d119dfd481fcd069c5f5aafa1fef 100644 (file)
 #include "lib/lists.h"
 #include "lib/resource.h"
 #include "lib/timer.h"
-#include "nest/protocol.h"
 
+struct ea_list;
 struct protocol;
 struct proto;
+struct rte_src;
 struct symbol;
 struct filter;
 struct cli;
@@ -273,7 +274,7 @@ static inline net *net_get(rtable *tab, ip_addr addr, unsigned len) { return (ne
 rte *rte_find(net *net, struct rte_src *src);
 rte *rte_get_temp(struct rta *);
 void rte_update2(struct announce_hook *ah, net *net, rte *new, struct rte_src *src);
-static inline void rte_update(struct proto *p, net *net, rte *new) { rte_update2(p->main_ahook, net, new, p->main_source); }
+/* rte_update() moved to protocol.h to avoid dependency conflicts */
 int rt_examine(rtable *t, ip_addr prefix, int pxlen, struct proto *p, struct filter *filter);
 rte *rt_export_merged(struct announce_hook *ah, net *net, rte **rt_free, struct ea_list **tmpa, linpool *pool, int silent);
 void rt_refresh_begin(rtable *t, struct announce_hook *ah);
index c6e48c38016eb18ed2bceae64b97e0dae2835a8b..bcb48b53d2c49f0eb05d24febfc626d445f2aac1 100644 (file)
@@ -60,14 +60,6 @@ static inline void rt_schedule_gc(rtable *tab);
 static inline void rt_schedule_prune(rtable *tab);
 
 
-static inline struct ea_list *
-make_tmp_attrs(struct rte *rt, struct linpool *pool)
-{
-  struct ea_list *(*mta)(struct rte *rt, struct linpool *pool);
-  mta = rt->attrs->src->proto->make_tmp_attrs;
-  return mta ? mta(rt, pool) : NULL;
-}
-
 /* Like fib_route(), but skips empty net entries */
 static net *
 net_route(rtable *tab, ip_addr a, int len)
@@ -260,7 +252,7 @@ export_filter_(struct announce_hook *ah, rte *rt0, rte **rt_free, ea_list **tmpa
   if (!tmpa)
     tmpa = &tmpb;
 
-  *tmpa = make_tmp_attrs(rt, pool);
+  *tmpa = rte_make_tmp_attrs(rt, pool);
 
   v = p->import_control ? p->import_control(p, &rt, tmpa, pool) : 0;
   if (v < 0)
@@ -1223,7 +1215,7 @@ rte_update2(struct announce_hook *ah, net *net, rte *new, struct rte_src *src)
        }
       else
        {
-         tmpa = make_tmp_attrs(new, rte_update_pool);
+         tmpa = rte_make_tmp_attrs(new, rte_update_pool);
          if (filter && (filter != FILTER_REJECT))
            {
              ea_list *old_tmpa = tmpa;
@@ -1303,7 +1295,7 @@ rt_examine(rtable *t, ip_addr prefix, int pxlen, struct proto *p, struct filter
   rte_update_lock();
 
   /* Rest is stripped down export_filter() */
-  ea_list *tmpa = make_tmp_attrs(rt, rte_update_pool);
+  ea_list *tmpa = rte_make_tmp_attrs(rt, rte_update_pool);
   int v = p->import_control ? p->import_control(p, &rt, &tmpa, rte_update_pool) : 0;
   if (v == RIC_PROCESS)
     v = (f_run(filter, &rt, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) <= F_ACCEPT);
@@ -2470,7 +2462,7 @@ rt_show_net(struct cli *c, net *n, struct rt_show_data *d)
 
       ee = e;
       rte_update_lock();               /* We use the update buffer for filtering */
-      tmpa = make_tmp_attrs(e, rte_update_pool);
+      tmpa = rte_make_tmp_attrs(e, rte_update_pool);
 
       /* Special case for merged export */
       if ((d->export_mode == RSEM_EXPORT) && (d->export_protocol->accept_ra_types == RA_MERGED))
index b9e2490dc65cfc10b3c82e47bc4ee0682bdafa2a..73eb4040fa6175163635a3b27a82f350d64af5bf 100644 (file)
@@ -469,8 +469,6 @@ bgp_get_attr_len(eattr *a)
   return len;
 }
 
-#define ADVANCE(w, r, l) do { r -= l; w += l; } while (0)
-
 /**
  * bgp_encode_attrs - encode BGP attributes
  * @p: BGP instance