0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-09 20:58:44 +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);
struct nexthop_adata_mpls nam = {
.nhad = {
.nh = {
.gw = nbr->addr,
.iface = nbr->iface,
},
.ad = {
.length = NEXTHOP_NEXT(&nam.nhad.nh) - (void *) nam.nhad.ad.data,
},
},
};
struct nexthop_adata_mpls nam;
memset(&nam, 0, sizeof nam);
nam.nhad.nh.gw = nbr->addr;
nam.nhad.nh.iface = nbr->iface;
nam.nhad.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);
}
else /* GW_RECURSIVE */

View File

@ -34,15 +34,11 @@ unresolved_vlink(ort *ort)
static inline struct nexthop_adata *
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));
*nhad = (struct nexthop_adata) {
.ad = { .length = sizeof *nhad - sizeof nhad->ad, },
.nh = {
.gw = gw,
.iface = iface,
.weight = weight,
},
};
struct nexthop_adata *nhad = lp_allocz(p->nhpool, sizeof(struct nexthop_adata));
nhad->ad.length = sizeof *nhad - sizeof nhad->ad;
nhad->nh.gw = gw;
nhad->nh.iface = iface;
nhad->nh.weight = weight;
return nhad;
}