0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-03 15:41:54 +00:00

Fixed annoying undefined values with nexthops

This commit is contained in:
Maria Matejka 2024-04-03 18:27:09 +02:00
parent 3a2e423d3e
commit ef16f07633
2 changed files with 10 additions and 20 deletions

View File

@ -1104,17 +1104,11 @@ bgp_apply_next_hop(struct bgp_parse_state *s, ea_list **to, ip_addr gw, ip_addr
ea_set_attr_u32(to, &ea_gen_igp_metric, 0, c->cf->cost); ea_set_attr_u32(to, &ea_gen_igp_metric, 0, c->cf->cost);
struct nexthop_adata_mpls nam = { struct nexthop_adata_mpls nam;
.nhad = { memset(&nam, 0, sizeof nam);
.nh = { nam.nhad.nh.gw = nbr->addr;
.gw = nbr->addr, nam.nhad.nh.iface = nbr->iface;
.iface = nbr->iface, nam.nhad.ad.length = NEXTHOP_NEXT(&nam.nhad.nh) - (void *) nam.nhad.ad.data;
},
.ad = {
.length = NEXTHOP_NEXT(&nam.nhad.nh) - (void *) nam.nhad.ad.data,
},
},
};
ea_set_attr_data(to, &ea_gen_nexthop, 0, nam.nhad.ad.data, nam.nhad.ad.length); ea_set_attr_data(to, &ea_gen_nexthop, 0, nam.nhad.ad.data, nam.nhad.ad.length);
} }
else /* GW_RECURSIVE */ else /* GW_RECURSIVE */

View File

@ -34,15 +34,11 @@ unresolved_vlink(ort *ort)
static inline struct nexthop_adata * static inline struct nexthop_adata *
new_nexthop(struct ospf_proto *p, ip_addr gw, struct iface *iface, byte weight) new_nexthop(struct ospf_proto *p, ip_addr gw, struct iface *iface, byte weight)
{ {
struct nexthop_adata *nhad = lp_alloc(p->nhpool, sizeof(struct nexthop_adata)); struct nexthop_adata *nhad = lp_allocz(p->nhpool, sizeof(struct nexthop_adata));
*nhad = (struct nexthop_adata) { nhad->ad.length = sizeof *nhad - sizeof nhad->ad;
.ad = { .length = sizeof *nhad - sizeof nhad->ad, }, nhad->nh.gw = gw;
.nh = { nhad->nh.iface = iface;
.gw = gw, nhad->nh.weight = weight;
.iface = iface,
.weight = weight,
},
};
return nhad; return nhad;
} }