bgpd: fix populating the attribute

This code is populating a temporary variable `add` instead of the attr.
Initially this variable was later copied to the attr but the copying was
erroneously deleted by 0a50c2481. Directly populate the attr to restore
the correct behavior.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
Igor Ryzhov 2022-01-19 23:02:11 +03:00
parent 8f2661b01d
commit b04c1e9997

View File

@ -6072,7 +6072,6 @@ static void bgp_static_update_safi(struct bgp *bgp, const struct prefix *p,
mpls_label_t label = 0;
#endif
uint32_t num_labels = 0;
union gw_addr add;
assert(bgp_static);
@ -6095,12 +6094,17 @@ static void bgp_static_update_safi(struct bgp *bgp, const struct prefix *p,
}
}
if (afi == AFI_L2VPN) {
if (bgp_static->gatewayIp.family == AF_INET)
add.ipv4.s_addr =
bgp_static->gatewayIp.u.prefix4.s_addr;
else if (bgp_static->gatewayIp.family == AF_INET6)
memcpy(&(add.ipv6), &(bgp_static->gatewayIp.u.prefix6),
sizeof(struct in6_addr));
if (bgp_static->gatewayIp.family == AF_INET) {
SET_IPADDR_V4(&attr.evpn_overlay.gw_ip);
memcpy(&attr.evpn_overlay.gw_ip.ipaddr_v4,
&bgp_static->gatewayIp.u.prefix4,
IPV4_MAX_BYTELEN);
} else if (bgp_static->gatewayIp.family == AF_INET6) {
SET_IPADDR_V6(&attr.evpn_overlay.gw_ip);
memcpy(&attr.evpn_overlay.gw_ip.ipaddr_v6,
&bgp_static->gatewayIp.u.prefix6,
IPV6_MAX_BYTELEN);
}
memcpy(&attr.esi, bgp_static->eth_s_id, sizeof(esi_t));
if (bgp_static->encap_tunneltype == BGP_ENCAP_TYPE_VXLAN) {
struct bgp_encap_type_vxlan bet;