summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-05-11 12:16:44 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-05-11 13:08:47 +0200
commit6006b807b1a84d31611173b837fafcd96ba9d692 (patch)
tree08f25453328d8c408f1a8c658e4e6ef91005d4a7 /bgpd
parentripd: Use correct usage of memcpy() when zeroing struct (diff)
downloadfrr-6006b807b1a84d31611173b837fafcd96ba9d692.tar.xz
frr-6006b807b1a84d31611173b837fafcd96ba9d692.zip
*: Properly use memset() when zeroing
Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_aspath.c2
-rw-r--r--bgpd/bgp_attr.c4
-rw-r--r--bgpd/bgp_attr_evpn.c2
-rw-r--r--bgpd/bgp_debug.c6
-rw-r--r--bgpd/bgp_dump.c6
-rw-r--r--bgpd/bgp_evpn.c24
-rw-r--r--bgpd/bgp_evpn_mh.c8
-rw-r--r--bgpd/bgp_evpn_vty.c2
-rw-r--r--bgpd/bgp_flowspec.c2
-rw-r--r--bgpd/bgp_flowspec_util.c6
-rw-r--r--bgpd/bgp_keepalives.c4
-rw-r--r--bgpd/bgp_label.c4
-rw-r--r--bgpd/bgp_mplsvpn.c2
-rw-r--r--bgpd/bgp_nexthop.c2
-rw-r--r--bgpd/bgp_packet.c5
-rw-r--r--bgpd/bgp_pbr.c8
-rw-r--r--bgpd/bgp_route.c18
-rw-r--r--bgpd/bgp_snmp.c6
-rw-r--r--bgpd/bgp_zebra.c12
-rw-r--r--bgpd/bgpd.c2
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c20
-rw-r--r--bgpd/rfp-example/librfp/rfp_example.c2
22 files changed, 73 insertions, 74 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 41166de05..39886337f 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -854,7 +854,7 @@ struct aspath *aspath_parse(struct stream *s, size_t length, int use32bit)
if (length % AS16_VALUE_SIZE)
return NULL;
- memset(&as, 0, sizeof(struct aspath));
+ memset(&as, 0, sizeof(as));
if (assegments_parse(s, length, &as.segments, use32bit) < 0)
return NULL;
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index f45362f81..6c10469da 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -980,7 +980,7 @@ struct attr *bgp_attr_aggregate_intern(
struct attr *new;
int ret;
- memset(&attr, 0, sizeof(struct attr));
+ memset(&attr, 0, sizeof(attr));
/* Origin attribute. */
attr.origin = origin;
@@ -1043,7 +1043,7 @@ struct attr *bgp_attr_aggregate_intern(
struct attr attr_tmp = attr;
struct bgp_path_info rmap_path;
- memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ memset(&rmap_path, 0, sizeof(rmap_path));
rmap_path.peer = bgp->peer_self;
rmap_path.attr = &attr_tmp;
diff --git a/bgpd/bgp_attr_evpn.c b/bgpd/bgp_attr_evpn.c
index e528faded..d379f40a8 100644
--- a/bgpd/bgp_attr_evpn.c
+++ b/bgpd/bgp_attr_evpn.c
@@ -49,7 +49,7 @@ void bgp_add_routermac_ecom(struct attr *attr, struct ethaddr *routermac)
struct ecommunity_val routermac_ecom;
struct ecommunity *ecomm = bgp_attr_get_ecommunity(attr);
- memset(&routermac_ecom, 0, sizeof(struct ecommunity_val));
+ memset(&routermac_ecom, 0, sizeof(routermac_ecom));
routermac_ecom.val[0] = ECOMMUNITY_ENCODE_EVPN;
routermac_ecom.val[1] = ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC;
memcpy(&routermac_ecom.val[2], routermac->octet, ETH_ALEN);
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index 0993d6de5..ef71b191f 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -639,7 +639,7 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv,
return CMD_WARNING;
if (evpn_type == BGP_EVPN_MAC_IP_ROUTE) {
- memset(&ip, 0, sizeof(struct ipaddr));
+ memset(&ip, 0, sizeof(ip));
argv_find(argv, argc, "mac", &mac_idx);
(void)prefix_str2mac(argv[mac_idx + 1]->arg, &mac);
@@ -650,7 +650,7 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv,
build_evpn_type2_prefix((struct prefix_evpn *)argv_p,
&mac, &ip);
} else if (evpn_type == BGP_EVPN_IMET_ROUTE) {
- memset(&ip, 0, sizeof(struct ipaddr));
+ memset(&ip, 0, sizeof(ip));
argv_find(argv, argc, "ip", &ip_idx);
str2ipaddr(argv[ip_idx + 1]->arg, &ip);
@@ -660,7 +660,7 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv,
} else if (evpn_type == BGP_EVPN_IP_PREFIX_ROUTE) {
struct prefix ip_prefix;
- memset(&ip_prefix, 0, sizeof(struct prefix));
+ memset(&ip_prefix, 0, sizeof(ip_prefix));
if (argv_find(argv, argc, "ip", &ip_idx)) {
(void)str2prefix(argv[ip_idx + 1]->arg, &ip_prefix);
apply_mask(&ip_prefix);
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c
index c389fec5f..e57f449f7 100644
--- a/bgpd/bgp_dump.c
+++ b/bgpd/bgp_dump.c
@@ -851,9 +851,9 @@ static int config_write_bgp_dump(struct vty *vty)
/* Initialize BGP packet dump functionality. */
void bgp_dump_init(void)
{
- memset(&bgp_dump_all, 0, sizeof(struct bgp_dump));
- memset(&bgp_dump_updates, 0, sizeof(struct bgp_dump));
- memset(&bgp_dump_routes, 0, sizeof(struct bgp_dump));
+ memset(&bgp_dump_all, 0, sizeof(bgp_dump_all));
+ memset(&bgp_dump_updates, 0, sizeof(bgp_dump_updates));
+ memset(&bgp_dump_routes, 0, sizeof(bgp_dump_routes));
bgp_dump_obuf =
stream_new((BGP_STANDARD_MESSAGE_MAX_PACKET_SIZE * 2)
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index ddb34258c..74395bb0e 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -209,7 +209,7 @@ static struct vrf_irt_node *lookup_vrf_import_rt(struct ecommunity_val *rt)
return NULL;
}
- memset(&tmp, 0, sizeof(struct vrf_irt_node));
+ memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp.rt, rt, ECOMMUNITY_SIZE);
irt = hash_lookup(bgp_evpn->vrf_import_rt_hash, &tmp);
return irt;
@@ -291,7 +291,7 @@ static struct irt_node *lookup_import_rt(struct bgp *bgp,
struct irt_node *irt;
struct irt_node tmp;
- memset(&tmp, 0, sizeof(struct irt_node));
+ memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp.rt, rt, ECOMMUNITY_SIZE);
irt = hash_lookup(bgp->import_rt_hash, &tmp);
return irt;
@@ -1291,7 +1291,7 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp,
if (src_attr)
attr = *src_attr;
else {
- memset(&attr, 0, sizeof(struct attr));
+ memset(&attr, 0, sizeof(attr));
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP);
}
@@ -1728,7 +1728,7 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
int route_change;
bool old_is_sync = false;
- memset(&attr, 0, sizeof(struct attr));
+ memset(&attr, 0, sizeof(attr));
/* Build path-attribute for this route. */
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP);
@@ -3977,7 +3977,7 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi,
pfx += 8;
/* Make EVPN prefix. */
- memset(&p, 0, sizeof(struct prefix_evpn));
+ memset(&p, 0, sizeof(p));
p.family = AF_EVPN;
p.prefixlen = EVPN_ROUTE_PREFIXLEN;
p.prefix.route_type = BGP_EVPN_IMET_ROUTE;
@@ -4047,7 +4047,7 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi,
pfx += 8;
/* Make EVPN prefix. */
- memset(&p, 0, sizeof(struct prefix_evpn));
+ memset(&p, 0, sizeof(p));
p.family = AF_EVPN;
p.prefixlen = EVPN_ROUTE_PREFIXLEN;
p.prefix.route_type = BGP_EVPN_IP_PREFIX_ROUTE;
@@ -4427,7 +4427,7 @@ void bgp_evpn_install_uninstall_default_route(struct bgp *bgp_vrf, afi_t afi,
struct prefix ip_prefix;
/* form the default prefix 0.0.0.0/0 */
- memset(&ip_prefix, 0, sizeof(struct prefix));
+ memset(&ip_prefix, 0, sizeof(ip_prefix));
ip_prefix.family = afi2family(afi);
if (add) {
@@ -4990,7 +4990,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
for (; pnt < lim; pnt += psize) {
/* Clear prefix structure. */
- memset(&p, 0, sizeof(struct prefix));
+ memset(&p, 0, sizeof(p));
/* Deal with path-id if AddPath is supported. */
if (addpath_capable) {
@@ -5274,7 +5274,7 @@ struct bgpevpn *bgp_evpn_lookup_vni(struct bgp *bgp, vni_t vni)
struct bgpevpn *vpn;
struct bgpevpn tmp;
- memset(&tmp, 0, sizeof(struct bgpevpn));
+ memset(&tmp, 0, sizeof(tmp));
tmp.vni = vni;
vpn = hash_lookup(bgp->vnihash, &tmp);
return vpn;
@@ -6306,7 +6306,7 @@ static struct bgpevpn *bgp_evpn_vni_svi_hash_lookup(struct bgp *bgp,
struct bgpevpn *vpn;
struct bgpevpn tmp;
- memset(&tmp, 0, sizeof(struct bgpevpn));
+ memset(&tmp, 0, sizeof(tmp));
tmp.svi_ifindex = svi;
vpn = hash_lookup(bgp->vni_svi_hash, &tmp);
return vpn;
@@ -6376,7 +6376,7 @@ bool bgp_evpn_is_gateway_ip_resolved(struct bgp_nexthop_cache *bnc)
* which stores all the remote IP addresses received via MAC/IP routes
* in this EVI
*/
- memset(&tmp, 0, sizeof(struct evpn_remote_ip));
+ memset(&tmp, 0, sizeof(tmp));
p = &bnc->prefix;
if (p->family == AF_INET) {
@@ -6409,7 +6409,7 @@ static void bgp_evpn_remote_ip_process_nexthops(struct bgpevpn *vpn,
if (!vpn->bgp_vrf || vpn->svi_ifindex == 0)
return;
- memset(&p, 0, sizeof(struct prefix));
+ memset(&p, 0, sizeof(p));
if (addr->ipa_type == IPADDR_V4) {
afi = AFI_IP;
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c
index 6ce97d22c..a1c32403b 100644
--- a/bgpd/bgp_evpn_mh.c
+++ b/bgpd/bgp_evpn_mh.c
@@ -599,7 +599,7 @@ static void bgp_evpn_type4_route_extcomm_build(struct bgp_evpn_es *es,
bgp_attr_set_ecommunity(attr, ecommunity_dup(&ecom_encap));
/* ES import RT */
- memset(&mac, 0, sizeof(struct ethaddr));
+ memset(&mac, 0, sizeof(mac));
memset(&ecom_es_rt, 0, sizeof(ecom_es_rt));
es_get_system_mac(&es->esi, &mac);
encode_es_rt_extcomm(&eval_es_rt, &mac);
@@ -633,7 +633,7 @@ static int bgp_evpn_type4_route_update(struct bgp *bgp,
struct bgp_dest *dest = NULL;
struct bgp_path_info *pi = NULL;
- memset(&attr, 0, sizeof(struct attr));
+ memset(&attr, 0, sizeof(attr));
/* Build path-attribute for this route. */
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP);
@@ -943,7 +943,7 @@ static int bgp_evpn_type1_route_update(struct bgp *bgp, struct bgp_evpn_es *es,
int route_changed = 0;
struct prefix_rd *global_rd;
- memset(&attr, 0, sizeof(struct attr));
+ memset(&attr, 0, sizeof(attr));
/* Build path-attribute for this route. */
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP);
@@ -4507,7 +4507,7 @@ static struct bgp_evpn_nh *bgp_evpn_nh_add(struct bgp *bgp_vrf,
struct bgp_evpn_nh tmp_n;
struct bgp_evpn_nh *n = NULL;
- memset(&tmp_n, 0, sizeof(struct bgp_evpn_nh));
+ memset(&tmp_n, 0, sizeof(tmp_n));
memcpy(&tmp_n.ip, ip, sizeof(struct ipaddr));
n = hash_get(bgp_vrf->evpn_nh_table, &tmp_n, bgp_evpn_nh_alloc);
ipaddr2str(ip, n->nh_str, sizeof(n->nh_str));
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 0c9cd3b72..3d59c9df7 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -2367,7 +2367,7 @@ static void evpn_show_routes_vni_all(struct vty *vty, struct bgp *bgp,
num_vnis = hashcount(bgp->vnihash);
if (!num_vnis)
return;
- memset(&wctx, 0, sizeof(struct vni_walk_ctx));
+ memset(&wctx, 0, sizeof(wctx));
wctx.bgp = bgp;
wctx.vty = vty;
wctx.vtep_ip = vtep_ip;
diff --git a/bgpd/bgp_flowspec.c b/bgpd/bgp_flowspec.c
index de3f2a9d4..39c0cfe51 100644
--- a/bgpd/bgp_flowspec.c
+++ b/bgpd/bgp_flowspec.c
@@ -121,7 +121,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
for (; pnt < lim; pnt += psize) {
/* Clear prefix structure. */
- memset(&p, 0, sizeof(struct prefix));
+ memset(&p, 0, sizeof(p));
/* All FlowSpec NLRI begin with length. */
if (pnt + 1 > lim)
diff --git a/bgpd/bgp_flowspec_util.c b/bgpd/bgp_flowspec_util.c
index 348dc7c9d..9f3ea499f 100644
--- a/bgpd/bgp_flowspec_util.c
+++ b/bgpd/bgp_flowspec_util.c
@@ -97,7 +97,7 @@ bool bgp_flowspec_contains_prefix(const struct prefix *pfs,
switch (type) {
case FLOWSPEC_DEST_PREFIX:
case FLOWSPEC_SRC_PREFIX:
- memset(&compare, 0, sizeof(struct prefix));
+ memset(&compare, 0, sizeof(compare));
ret = bgp_flowspec_ip_address(
BGP_FLOWSPEC_CONVERT_TO_NON_OPAQUE,
nlri_content+offset,
@@ -185,7 +185,7 @@ int bgp_flowspec_ip_address(enum bgp_flowspec_util_nlri_t type,
uint8_t prefix_offset = 0;
*error = 0;
- memset(&prefix_local, 0, sizeof(struct prefix));
+ memset(&prefix_local, 0, sizeof(prefix_local));
/* read the prefix length */
prefix_local.prefixlen = nlri_ptr[offset];
psize = PSIZE(prefix_local.prefixlen);
@@ -665,7 +665,7 @@ bool bgp_flowspec_get_first_nh(struct bgp *bgp, struct bgp_path_info *pi,
struct bgp_dest *dest = pi->net;
struct bgp_pbr_entry_action *api_action;
- memset(&api, 0, sizeof(struct bgp_pbr_entry_main));
+ memset(&api, 0, sizeof(api));
if (bgp_pbr_build_and_validate_entry(bgp_dest_get_prefix(dest), pi,
&api)
< 0)
diff --git a/bgpd/bgp_keepalives.c b/bgpd/bgp_keepalives.c
index 4cb7bd788..86202a0e3 100644
--- a/bgpd/bgp_keepalives.c
+++ b/bgpd/bgp_keepalives.c
@@ -121,7 +121,7 @@ static void peer_process(struct hash_bucket *hb, void *arg)
bgp_keepalive_send(pkat->peer);
monotime(&pkat->last);
- memset(&elapsed, 0x00, sizeof(struct timeval));
+ memset(&elapsed, 0, sizeof(elapsed));
diff = ka;
}
@@ -220,7 +220,7 @@ void *bgp_keepalives_start(void *arg)
hash_iterate(peerhash, peer_process, &next_update);
if (next_update.tv_sec == -1)
- memset(&next_update, 0x00, sizeof(next_update));
+ memset(&next_update, 0, sizeof(next_update));
monotime_since(&currtime, &aftertime);
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index f53deb63b..a9c4b4c67 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -55,7 +55,7 @@ int bgp_parse_fec_update(void)
s = zclient->ibuf;
- memset(&p, 0, sizeof(struct prefix));
+ memset(&p, 0, sizeof(p));
p.family = stream_getw(s);
p.prefixlen = stream_getc(s);
stream_get(p.u.val, s, PSIZE(p.prefixlen));
@@ -350,7 +350,7 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
for (; pnt < lim; pnt += psize) {
/* Clear prefix structure. */
- memset(&p, 0, sizeof(struct prefix));
+ memset(&p, 0, sizeof(p));
if (addpath_capable) {
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 4d8c4ac2a..d1a6daa8f 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -131,7 +131,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
#define VPN_PREFIXLEN_MIN_BYTES (3 + 8) /* label + RD */
while (STREAM_READABLE(data) > 0) {
/* Clear prefix structure. */
- memset(&p, 0, sizeof(struct prefix));
+ memset(&p, 0, sizeof(p));
if (addpath_capable) {
STREAM_GET(&addpath_id, data, BGP_ADDPATH_ID_LEN);
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index de48c9751..c6043807d 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -560,7 +560,7 @@ bool bgp_nexthop_self(struct bgp *bgp, afi_t afi, uint8_t type,
return true;
if (new_afi == AF_INET && hashcount(bgp->tip_hash)) {
- memset(&tmp_tip, 0, sizeof(struct tip_addr));
+ memset(&tmp_tip, 0, sizeof(tmp_tip));
tmp_tip.addr = attr->nexthop;
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) {
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 9a1216a03..459b4d5e3 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1710,7 +1710,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
}
/* Set initial values. */
- memset(&attr, 0, sizeof(struct attr));
+ memset(&attr, 0, sizeof(attr));
attr.label_index = BGP_INVALID_LABEL_INDEX;
attr.label = MPLS_INVALID_LABEL;
memset(&nlris, 0, sizeof(nlris));
@@ -2249,8 +2249,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
* to maximise debug information.
*/
int ok;
- memset(&orfp, 0,
- sizeof(struct orf_prefix));
+ memset(&orfp, 0, sizeof(orfp));
common = *p_pnt++;
/* after ++: p_pnt <= p_end */
if (common
diff --git a/bgpd/bgp_pbr.c b/bgpd/bgp_pbr.c
index 352670e6c..7b5e28724 100644
--- a/bgpd/bgp_pbr.c
+++ b/bgpd/bgp_pbr.c
@@ -2679,9 +2679,9 @@ static void bgp_pbr_handle_entry(struct bgp *bgp, struct bgp_path_info *path,
struct bgp_pbr_val_mask bpvm;
memset(&range, 0, sizeof(range));
- memset(&nh, 0, sizeof(struct nexthop));
- memset(&bpf, 0, sizeof(struct bgp_pbr_filter));
- memset(&bpof, 0, sizeof(struct bgp_pbr_or_filter));
+ memset(&nh, 0, sizeof(nh));
+ memset(&bpf, 0, sizeof(bpf));
+ memset(&bpof, 0, sizeof(bpof));
if (api->match_bitmask & PREFIX_SRC_PRESENT ||
(api->type == BGP_PBR_IPRULE &&
api->match_bitmask_iprule & PREFIX_SRC_PRESENT))
@@ -2692,7 +2692,7 @@ static void bgp_pbr_handle_entry(struct bgp *bgp, struct bgp_path_info *path,
dst = &api->dst_prefix;
if (api->type == BGP_PBR_IPRULE)
bpf.type = api->type;
- memset(&nh, 0, sizeof(struct nexthop));
+ memset(&nh, 0, sizeof(nh));
nh.vrf_id = VRF_UNKNOWN;
if (api->match_protocol_num) {
proto = (uint8_t)api->protocol[0].value;
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 2544ea520..500e2f45e 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1597,7 +1597,7 @@ static int bgp_input_modifier(struct peer *peer, const struct prefix *p,
/* Route map apply. */
if (rmap) {
- memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ memset(&rmap_path, 0, sizeof(rmap_path));
/* Duplicate current value to new structure for modification. */
rmap_path.peer = peer;
rmap_path.attr = attr;
@@ -1653,7 +1653,7 @@ static int bgp_output_modifier(struct peer *peer, const struct prefix *p,
if (rmap == NULL)
return RMAP_DENY;
- memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ memset(&rmap_path, 0, sizeof(rmap_path));
/* Route map apply. */
/* Duplicate current value to new structure for modification. */
rmap_path.peer = peer;
@@ -2698,7 +2698,7 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp,
PEER_STATUS_ORF_WAIT_REFRESH))
return;
- memset(&attr, 0, sizeof(struct attr));
+ memset(&attr, 0, sizeof(attr));
/* It's initialized in bgp_announce_check() */
/* Announcement to the subgroup. If the route is filtered withdraw it.
@@ -3758,7 +3758,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
if (orig_safi == SAFI_LABELED_UNICAST)
safi = SAFI_UNICAST;
- memset(&new_attr, 0, sizeof(struct attr));
+ memset(&new_attr, 0, sizeof(new_attr));
new_attr.label_index = BGP_INVALID_LABEL_INDEX;
new_attr.label = MPLS_INVALID_LABEL;
@@ -5656,7 +5656,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
then the Error Subcode is set to Invalid Network Field. */
for (; pnt < lim; pnt += psize) {
/* Clear prefix structure. */
- memset(&p, 0, sizeof(struct prefix));
+ memset(&p, 0, sizeof(p));
if (addpath_capable) {
@@ -5833,7 +5833,7 @@ void bgp_static_update(struct bgp *bgp, const struct prefix *p,
if (bgp_static->rmap.name) {
struct attr attr_tmp = attr;
- memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ memset(&rmap_path, 0, sizeof(rmap_path));
rmap_path.peer = bgp->peer_self;
rmap_path.attr = &attr_tmp;
@@ -6145,7 +6145,7 @@ static void bgp_static_update_safi(struct bgp *bgp, const struct prefix *p,
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;
- memset(&bet, 0, sizeof(struct bgp_encap_type_vxlan));
+ memset(&bet, 0, sizeof(bet));
bet.vnid = p->u.prefix_evpn.prefix_addr.eth_tag;
bgp_encap_type_vxlan_to_tlv(&bet, &attr);
}
@@ -6645,7 +6645,7 @@ int bgp_static_set_safi(afi_t afi, safi_t safi, struct vty *vty,
return CMD_WARNING_CONFIG_FAILED;
}
if (gwip) {
- memset(&gw_ip, 0, sizeof(struct prefix));
+ memset(&gw_ip, 0, sizeof(gw_ip));
ret = str2prefix(gwip, &gw_ip);
if (!ret) {
vty_out(vty, "%% Malformed GatewayIp\n");
@@ -8372,7 +8372,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
/* Apply route-map. */
if (red->rmap.name) {
- memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ memset(&rmap_path, 0, sizeof(rmap_path));
rmap_path.peer = bgp->peer_self;
rmap_path.attr = &attr_new;
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 868801c14..e25d8d90d 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -461,7 +461,7 @@ static int write_bgpPeerTable(int action, uint8_t *var_val,
intval = *(long *)var_val;
- memset(&addr, 0, sizeof(struct in_addr));
+ memset(&addr, 0, sizeof(addr));
peer = bgpPeerTable_lookup(NULL, name, &length, &addr, 1);
if (!peer)
@@ -518,7 +518,7 @@ static uint8_t *bgpPeerTable(struct variable *v, oid name[], size_t *length,
if (smux_header_table(v, name, length, exact, var_len, write_method)
== MATCH_FAILED)
return NULL;
- memset(&addr, 0, sizeof(struct in_addr));
+ memset(&addr, 0, sizeof(addr));
peer = bgpPeerTable_lookup(v, name, length, &addr, exact);
if (!peer)
@@ -802,7 +802,7 @@ static uint8_t *bgp4PathAttrTable(struct variable *v, oid name[],
if (smux_header_table(v, name, length, exact, var_len, write_method)
== MATCH_FAILED)
return NULL;
- memset(&addr, 0, sizeof(struct prefix_ipv4));
+ memset(&addr, 0, sizeof(addr));
path = bgp4PathAttrLookup(v, name, length, bgp, &addr, exact);
if (!path)
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 77b8a8ab9..2c1d56172 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -2890,8 +2890,8 @@ static int bgp_zebra_process_local_l3vni(ZAPI_CALLBACK_ARGS)
ifindex_t svi_ifindex;
bool is_anycast_mac = false;
- memset(&svi_rmac, 0, sizeof(struct ethaddr));
- memset(&originator_ip, 0, sizeof(struct in_addr));
+ memset(&svi_rmac, 0, sizeof(svi_rmac));
+ memset(&originator_ip, 0, sizeof(originator_ip));
s = zclient->ibuf;
l3vni = stream_getl(s);
if (cmd == ZEBRA_L3VNI_ADD) {
@@ -3048,7 +3048,7 @@ static int bgp_zebra_process_local_ip_prefix(ZAPI_CALLBACK_ARGS)
struct bgp *bgp_vrf = NULL;
struct prefix p;
- memset(&p, 0, sizeof(struct prefix));
+ memset(&p, 0, sizeof(p));
s = zclient->ibuf;
stream_get(&p, s, sizeof(struct prefix));
@@ -3519,7 +3519,7 @@ void bgp_zebra_announce_default(struct bgp *bgp, struct nexthop *nh,
if (!vrf_is_backend_netns() && bgp->vrf_id != nh->vrf_id)
return;
- memset(&p, 0, sizeof(struct prefix));
+ memset(&p, 0, sizeof(p));
if (afi != AFI_IP && afi != AFI_IP6)
return;
p.family = afi2family(afi);
@@ -3620,7 +3620,7 @@ int bgp_zebra_send_capabilities(struct bgp *bgp, bool disable)
/* Check if capability is already sent. If the flag force is set
* send the capability since this can be initial bgp configuration
*/
- memset(&api, 0, sizeof(struct zapi_cap));
+ memset(&api, 0, sizeof(api));
if (disable) {
api.cap = ZEBRA_CLIENT_GR_DISABLE;
api.vrf_id = bgp->vrf_id;
@@ -3700,7 +3700,7 @@ int bgp_zebra_stale_timer_update(struct bgp *bgp)
return BGP_GR_FAILURE;
}
- memset(&api, 0, sizeof(struct zapi_cap));
+ memset(&api, 0, sizeof(api));
api.cap = ZEBRA_CLIENT_RIB_STALE_TIME;
api.stale_removal_time = bgp->rib_stale_time;
api.vrf_id = bgp->vrf_id;
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 33ed7d1d9..48ee84cd3 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -7820,7 +7820,7 @@ void bgp_master_init(struct thread_master *master, const int buffer_size,
{
qobj_init();
- memset(&bgp_master, 0, sizeof(struct bgp_master));
+ memset(&bgp_master, 0, sizeof(bgp_master));
bm = &bgp_master;
bm->bgp = list_new();
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 994de7d72..acbc41391 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -238,7 +238,7 @@ static void vnc_rhnck(char *tag)
struct prefix pfx_orig_nexthop;
memset(&pfx_orig_nexthop, 0,
- sizeof(struct prefix)); /* keep valgrind happy */
+ sizeof(pfx_orig_nexthop)); /* keep valgrind happy */
pkey = p->key;
pb = p->value;
@@ -303,7 +303,7 @@ static int process_unicast_route(struct bgp *bgp, /* in */
struct prefix pfx_orig_nexthop;
memset(&pfx_orig_nexthop, 0,
- sizeof(struct prefix)); /* keep valgrind happy */
+ sizeof(pfx_orig_nexthop)); /* keep valgrind happy */
/*
* prefix list check
@@ -346,7 +346,7 @@ static int process_unicast_route(struct bgp *bgp, /* in */
* must be freed before we return. It's easier to put it after
* all of the possible returns above.
*/
- memset(&hattr, 0, sizeof(struct attr));
+ memset(&hattr, 0, sizeof(hattr));
/* hattr becomes a ghost attr */
hattr = *attr;
@@ -773,7 +773,7 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
* must be freed before we return. It's easier to put it after
* all of the possible returns above.
*/
- memset(&hattr, 0, sizeof(struct attr));
+ memset(&hattr, 0, sizeof(hattr));
/* hattr becomes a ghost attr */
hattr = *attr;
@@ -966,7 +966,7 @@ static void vnc_import_bgp_add_route_mode_nvegroup(
* must be freed before we return. It's easier to put it after
* all of the possible returns above.
*/
- memset(&hattr, 0, sizeof(struct attr));
+ memset(&hattr, 0, sizeof(hattr));
/* hattr becomes a ghost attr */
hattr = *attr;
@@ -1420,7 +1420,7 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
uint32_t local_pref;
memset(&pfx_unicast_nexthop, 0,
- sizeof(struct prefix)); /* keep valgrind happy */
+ sizeof(pfx_unicast_nexthop)); /* keep valgrind happy */
if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE))
vnc_zlog_debug_any(
@@ -1538,7 +1538,7 @@ void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
struct prefix pfx_unicast_nexthop;
memset(&pfx_unicast_nexthop, 0,
- sizeof(struct prefix)); /* keep valgrind happy */
+ sizeof(pfx_unicast_nexthop)); /* keep valgrind happy */
if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubpi, &ecom,
&pfx_unicast_nexthop)) {
@@ -1713,7 +1713,7 @@ static void vnc_import_bgp_exterior_add_route_it(
prd = NULL;
/* use local_pref from unicast route */
- memset(&new_attr, 0, sizeof(struct attr));
+ memset(&new_attr, 0, sizeof(new_attr));
new_attr = *bpi_interior->attr;
if (info->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
@@ -1807,7 +1807,7 @@ void vnc_import_bgp_exterior_del_route(
return;
memset(&pfx_orig_nexthop, 0,
- sizeof(struct prefix)); /* keep valgrind happy */
+ sizeof(pfx_orig_nexthop)); /* keep valgrind happy */
h = bgp_default->rfapi;
hc = bgp_default->rfapi_cfg;
@@ -2473,7 +2473,7 @@ void vnc_import_bgp_exterior_del_route_interior(
prd = NULL;
/* use local_pref from unicast route */
- memset(&new_attr, 0, sizeof(struct attr));
+ memset(&new_attr, 0, sizeof(new_attr));
new_attr = *bpi->attr;
if (bpi_exterior
&& (bpi_exterior->attr->flag
diff --git a/bgpd/rfp-example/librfp/rfp_example.c b/bgpd/rfp-example/librfp/rfp_example.c
index 060fc7655..9a4ec7dbf 100644
--- a/bgpd/rfp-example/librfp/rfp_example.c
+++ b/bgpd/rfp-example/librfp/rfp_example.c
@@ -287,7 +287,7 @@ static int rfp_cfg_write_cb(struct vty *vty, void *rfp_start_val)
void *rfp_start(struct thread_master *master, struct rfapi_rfp_cfg **cfgp,
struct rfapi_rfp_cb_methods **cbmp)
{
- memset(&global_rfi, 0, sizeof(struct rfp_instance_t));
+ memset(&global_rfi, 0, sizeof(global_rfi));
global_rfi.master = master; /* for BGPD threads */
/* initilize struct rfapi_rfp_cfg, see rfapi.h */