diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index a98f7615..2aa5be4f 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -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 */ diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index ffb075d5..902ad768 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -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; }