]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge commit 'd8661a4397e4576ac404661b192dd99d928e7890' into haugesund
authorMaria Matejka <mq@ucw.cz>
Mon, 30 May 2022 15:11:30 +0000 (17:11 +0200)
committerMaria Matejka <mq@ucw.cz>
Mon, 30 May 2022 15:11:30 +0000 (17:11 +0200)
1  2 
lib/route.h
nest/protocol.h
nest/rt-table.c
proto/babel/babel.c
proto/bgp/attrs.c
proto/bgp/bgp.h
proto/bgp/packets.c
proto/ospf/ospf.c
proto/rip/rip.c

diff --cc lib/route.h
index 7bc67847b2da8275969e617bfd6131bdda0f6d7a,3b3686964287bf05034a04fec818750338536ca2..8253ab8e25e5bae9c44b47456a4035d5a41355f0
@@@ -324,6 -319,6 +321,6 @@@ void rta_dump(rta *)
  void rta_dump_all(void);
  void rta_show(struct cli *, rta *);
  
--u32 rt_get_igp_metric(rte *rt);
++u32 rt_get_igp_metric(const rte *rt);
  
  #endif
diff --cc nest/protocol.h
index 1d7dea4bf7d4a0e81543b423cf842950f04e204c,8f0cc4b4eb7d0389ed9408bb470237ddab33b701..aeb60ac65d3aa5ced51e8f602c577396c2353d06
@@@ -189,10 -214,10 +189,10 @@@ struct proto 
    int (*rte_recalculate)(struct rtable *, struct network *, struct rte *, struct rte *, struct rte *);
    int (*rte_better)(struct rte *, struct rte *);
    int (*rte_mergable)(struct rte *, struct rte *);
 -  struct rte * (*rte_modify)(struct rte *, struct linpool *);
 +  struct rte *(*rte_modify)(struct rte *, struct linpool *);
    void (*rte_insert)(struct network *, struct rte *);
    void (*rte_remove)(struct network *, struct rte *);
--  u32 (*rte_igp_metric)(struct rte *);
++  u32 (*rte_igp_metric)(const struct rte *);
  
    /* Hic sunt protocol-specific data */
  };
diff --cc nest/rt-table.c
index 849f6766f4f974bc0fcbfcc25df2e3a16379ac75,01194e02136995376c92c697f1f66d49f674a77e..d89c087dfb6dc84b52f21b171d1429d1b98067a4
@@@ -3534,7 -3458,7 +3536,7 @@@ if_local_addr(ip_addr a, struct iface *
  }
  
  u32
--rt_get_igp_metric(rte *rt)
++rt_get_igp_metric(const rte *rt)
  {
    eattr *ea = ea_find(rt->attrs->eattrs, "igp_metric");
  
index f19a2e0f5c2ac37a9dabb841c476d7824dad9792,97dca4aceb538becb0d7716e98bfec880aff3a8c..eaebdb831d0566c21f3b31484d5c3bb275033e5d
@@@ -2344,7 -2341,7 +2344,7 @@@ babel_rte_better(struct rte *new, struc
  }
  
  static u32
--babel_rte_igp_metric(struct rte *rt)
++babel_rte_igp_metric(const rte *rt)
  {
    return ea_get_int(rt->attrs->eattrs, &ea_babel_metric, BABEL_INFINITY);
  }
index a713b7a2a16b0860c9c108918e8411021fe283b1,597cf96cb6412f8de22b60f28b2e58bc873f20ef..73939bf0e48865d3ec92c44eb501ec6b0ed97bea
@@@ -372,20 -372,20 +372,22 @@@ bgp_aigp_set_metric(struct linpool *poo
  }
  
  int
- bgp_total_aigp_metric_(struct rta *a, u64 *metric, const struct adata **ad)
 -bgp_total_aigp_metric_(rte *e, u64 *metric, const struct adata **ad)
++bgp_total_aigp_metric_(const rte *e, u64 *metric, const struct adata **ad)
  {
 -  eattr *a = ea_find(e->attrs->eattrs, BGP_EA_ID(BA_AIGP));
 -  if (!a)
++  rta *a = e->attrs;
++
 +  eattr *ea = ea_find(a->eattrs, BGP_EA_ID(BA_AIGP));
 +  if (!ea)
      return 0;
  
 -  const byte *b = bgp_aigp_get_tlv(a->u.ptr, BGP_AIGP_METRIC);
 +  const byte *b = bgp_aigp_get_tlv(ea->u.ptr, BGP_AIGP_METRIC);
    if (!b)
      return 0;
  
    u64 aigp = get_u64(b + 3);
-   u64 step = a->igp_metric;
+   u64 step = rt_get_igp_metric(e);
  
 -  if (!rte_resolvable(e) || (step >= IGP_METRIC_UNKNOWN))
 +  if (!rta_resolvable(a) || (step >= IGP_METRIC_UNKNOWN))
      step = BGP_AIGP_MAX;
  
    if (!step)
@@@ -411,9 -411,9 +413,9 @@@ bgp_init_aigp_metric(rte *e, u64 *metri
  }
  
  u32
--bgp_rte_igp_metric(struct rte *rt)
++bgp_rte_igp_metric(const rte *rt)
  {
-   u64 metric = bgp_total_aigp_metric(rt->attrs);
+   u64 metric = bgp_total_aigp_metric(rt);
    return (u32) MIN(metric, (u64) IGP_METRIC_UNKNOWN);
  }
  
@@@ -2399,14 -2394,14 +2401,14 @@@ bgp_get_route_info(rte *e, byte *buf
    {
      buf += bsprintf(buf, "/%lu", metric);
    }
-   else if (e->attrs->igp_metric)
+   else if (metric = rt_get_igp_metric(e))
    {
 -    if (!rte_resolvable(e))
 +    if (!rta_resolvable(e->attrs))
        buf += bsprintf(buf, "/-");
-     else if (e->attrs->igp_metric >= IGP_METRIC_UNKNOWN)
+     else if (metric >= IGP_METRIC_UNKNOWN)
        buf += bsprintf(buf, "/?");
      else
-       buf += bsprintf(buf, "/%d", e->attrs->igp_metric);
+       buf += bsprintf(buf, "/%d", metric);
    }
    buf += bsprintf(buf, ") [");
  
diff --cc proto/bgp/bgp.h
index 554681b4bffa1b966bcdc9a4c6c91264fd4cc38a,e04e3bd079a340d38b8be327eeba550150a82f2f..d0c2daf2c22964bf69862ed61c55798e0d24f8c3
@@@ -566,22 -566,22 +566,22 @@@ int bgp_rte_better(struct rte *, struc
  int bgp_rte_mergable(rte *pri, rte *sec);
  int bgp_rte_recalculate(rtable *table, net *net, rte *new, rte *old, rte *old_best);
  struct rte *bgp_rte_modify_stale(struct rte *r, struct linpool *pool);
--u32 bgp_rte_igp_metric(struct rte *);
 -void bgp_rt_notify(struct proto *P, struct channel *C, net *n, rte *new, rte *old);
 -int bgp_preexport(struct proto *, struct rte *);
 -void bgp_get_route_info(struct rte *, byte *buf);
 -int bgp_total_aigp_metric_(rte *e, u64 *metric, const struct adata **ad);
++u32 bgp_rte_igp_metric(const rte *);
 +void bgp_rt_notify(struct proto *P, struct channel *C, const net_addr *n, rte *new, const rte *old);
 +int bgp_preexport(struct channel *, struct rte *);
 +void bgp_get_route_info(struct rte *, byte *);
- int bgp_total_aigp_metric_(rta *a, u64 *metric, const struct adata **ad);
++int bgp_total_aigp_metric_(const rte *e, u64 *metric, const struct adata **ad);
  
  #define BGP_AIGP_METRIC               1
  #define BGP_AIGP_MAX          U64(0xffffffffffffffff)
  
  static inline u64
- bgp_total_aigp_metric(rta *a)
 -bgp_total_aigp_metric(rte *r)
++bgp_total_aigp_metric(const rte *e)
  {
    u64 metric = BGP_AIGP_MAX;
    const struct adata *ad;
  
-   bgp_total_aigp_metric_(a, &metric, &ad);
 -  bgp_total_aigp_metric_(r, &metric, &ad);
++  bgp_total_aigp_metric_(e, &metric, &ad);
    return metric;
  }
  
Simple merge
index e4522d41d205a55f4bc7b52f41dcf7dd547f48b5,66d0eba67612afed2587ff4f3dc1199e342217d9..bb0d6aaca34aea9adc2efbc72f16f2e253448291
  #include "ospf.h"
  #include "lib/macro.h"
  
 -static int ospf_preexport(struct proto *P, rte *new);
 +static int ospf_preexport(struct channel *C, rte *new);
  static void ospf_reload_routes(struct channel *C);
  static int ospf_rte_better(struct rte *new, struct rte *old);
--static u32 ospf_rte_igp_metric(struct rte *rt);
++static u32 ospf_rte_igp_metric(const rte *rt);
  static void ospf_disp(timer *timer);
  
  
@@@ -411,7 -411,7 +411,7 @@@ ospf_rte_better(struct rte *new, struc
  }
  
  static u32
--ospf_rte_igp_metric(struct rte *rt)
++ospf_rte_igp_metric(const rte *rt)
  {
    if (rt->attrs->source == RTS_OSPF_EXT2)
      return IGP_METRIC_UNKNOWN;
diff --cc proto/rip/rip.c
index 03e0f4fb853098e8262482df09fa0418672b2003,52a3bd2c9227e0479af21569bbd504ce199ea551..739fe96cb55eaf460ef09aa99d1378e3f5eb35fb
@@@ -1103,7 -1104,7 +1103,7 @@@ rip_rte_better(struct rte *new, struct 
  }
  
  static u32
--rip_rte_igp_metric(struct rte *rt)
++rip_rte_igp_metric(const rte *rt)
  {
    return ea_get_int(rt->attrs->eattrs, &ea_rip_metric, IGP_METRIC_UNKNOWN);
  }