]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge commit '98fd158e28d89f10ee7a41b4f6a14fbd0021ef35' into haugesund
authorMaria Matejka <mq@ucw.cz>
Mon, 30 May 2022 13:35:29 +0000 (15:35 +0200)
committerMaria Matejka <mq@ucw.cz>
Mon, 30 May 2022 13:35:29 +0000 (15:35 +0200)
1  2 
nest/route.h
proto/rip/rip.c

diff --cc nest/route.h
Simple merge
diff --cc proto/rip/rip.c
index eeca783436204ff997fbfe1110d687154ccec642,6ca7a6b5383a3dd97857e2874bb246e7b18c330b..5bf1b3e60b14e52df1ea3fccc8ef1702a30cf255
@@@ -188,34 -193,47 +193,46 @@@ rip_announce_rte(struct rip_proto *p, s
        a0.nh.iface = rt->from->ifa->iface;
      }
  
-     a0.eattrs = alloca(sizeof(ea_list) + 3*sizeof(eattr));
-     memset(a0.eattrs, 0, sizeof(ea_list)); /* Zero-ing only the ea_list header */
-     a0.eattrs->count = 3;
-     a0.eattrs->attrs[0] = (eattr) {
-       .id = EA_RIP_METRIC,
-       .type = EAF_TYPE_INT,
-       .u.data = rt_metric,
-     };
-     a0.eattrs->attrs[1] = (eattr) {
-       .id = EA_RIP_TAG,
-       .type = EAF_TYPE_INT,
-       .u.data = rt_tag,
-     };
-     a0.eattrs->attrs[2] = (eattr) {
-       .id = EA_RIP_FROM,
-       .type = EAF_TYPE_PTR,
-       .u.data = (uintptr_t) a0.nh.iface,
+     struct {
+       ea_list l;
+       eattr e[3];
+       struct rip_iface_adata riad;
+     } ea_block = {
+       .l = { .count = 3, },
+       .e = {
+       {
+         .id = EA_RIP_METRIC,
+         .type = EAF_TYPE_INT,
+         .u.data = rt_metric,
+       },
+       {
+         .id = EA_RIP_TAG,
+         .type = EAF_TYPE_INT,
+         .u.data = rt_tag,
+       },
+       {
+         .id = EA_RIP_FROM,
+         .type = EAF_TYPE_IFACE,
+         .u.ptr = &ea_block.riad.ad,
+       }
+       },
+       .riad = {
+       .ad = { .length = sizeof(struct rip_iface_adata) - sizeof(struct adata) },
+       .iface = a0.nh.iface,
+       },
      };
  
 -    rta *a = rta_lookup(&a0);
 -    rte *e = rte_get_temp(a, p->p.main_source);
+     a0.eattrs = &ea_block.l;
 +    rte e0 = {
 +      .attrs = &a0,
 +      .src = p->p.main_source,
 +    };
  
 -    rte_update(&p->p, en->n.addr, e);
 +    rte_update(p->p.main_channel, en->n.addr, &e0, p->p.main_source);
    }
    else
 -  {
 -    /* Withdraw */
 -    rte_update(&p->p, en->n.addr, NULL);
 -  }
 +    rte_update(p->p.main_channel, en->n.addr, NULL, p->p.main_source);
  }
  
  /**