Merge pull request #11177 from opensourcerouting/fix/memset_memcpy

*: memcpy/memset zeroing
This commit is contained in:
Donald Sharp 2022-05-13 07:40:58 -04:00 committed by GitHub
commit f205a2309c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
83 changed files with 265 additions and 247 deletions

View File

@ -854,7 +854,7 @@ struct aspath *aspath_parse(struct stream *s, size_t length, int use32bit)
if (length % AS16_VALUE_SIZE) if (length % AS16_VALUE_SIZE)
return NULL; return NULL;
memset(&as, 0, sizeof(struct aspath)); memset(&as, 0, sizeof(as));
if (assegments_parse(s, length, &as.segments, use32bit) < 0) if (assegments_parse(s, length, &as.segments, use32bit) < 0)
return NULL; return NULL;

View File

@ -980,7 +980,7 @@ struct attr *bgp_attr_aggregate_intern(
struct attr *new; struct attr *new;
int ret; int ret;
memset(&attr, 0, sizeof(struct attr)); memset(&attr, 0, sizeof(attr));
/* Origin attribute. */ /* Origin attribute. */
attr.origin = origin; attr.origin = origin;
@ -1043,7 +1043,7 @@ struct attr *bgp_attr_aggregate_intern(
struct attr attr_tmp = attr; struct attr attr_tmp = attr;
struct bgp_path_info rmap_path; 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.peer = bgp->peer_self;
rmap_path.attr = &attr_tmp; rmap_path.attr = &attr_tmp;

View File

@ -49,7 +49,7 @@ void bgp_add_routermac_ecom(struct attr *attr, struct ethaddr *routermac)
struct ecommunity_val routermac_ecom; struct ecommunity_val routermac_ecom;
struct ecommunity *ecomm = bgp_attr_get_ecommunity(attr); 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[0] = ECOMMUNITY_ENCODE_EVPN;
routermac_ecom.val[1] = ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC; routermac_ecom.val[1] = ECOMMUNITY_EVPN_SUBTYPE_ROUTERMAC;
memcpy(&routermac_ecom.val[2], routermac->octet, ETH_ALEN); memcpy(&routermac_ecom.val[2], routermac->octet, ETH_ALEN);

View File

@ -639,7 +639,7 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv,
return CMD_WARNING; return CMD_WARNING;
if (evpn_type == BGP_EVPN_MAC_IP_ROUTE) { if (evpn_type == BGP_EVPN_MAC_IP_ROUTE) {
memset(&ip, 0, sizeof(struct ipaddr)); memset(&ip, 0, sizeof(ip));
if (argv_find(argv, argc, "mac", &mac_idx)) if (argv_find(argv, argc, "mac", &mac_idx))
if (!prefix_str2mac(argv[mac_idx + 1]->arg, &mac)) { if (!prefix_str2mac(argv[mac_idx + 1]->arg, &mac)) {
@ -656,7 +656,7 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv,
build_evpn_type2_prefix((struct prefix_evpn *)argv_p, build_evpn_type2_prefix((struct prefix_evpn *)argv_p,
&mac, &ip); &mac, &ip);
} else if (evpn_type == BGP_EVPN_IMET_ROUTE) { } else if (evpn_type == BGP_EVPN_IMET_ROUTE) {
memset(&ip, 0, sizeof(struct ipaddr)); memset(&ip, 0, sizeof(ip));
if (argv_find(argv, argc, "ip", &ip_idx)) if (argv_find(argv, argc, "ip", &ip_idx))
if (str2ipaddr(argv[ip_idx + 1]->arg, &ip) != 0) { if (str2ipaddr(argv[ip_idx + 1]->arg, &ip) != 0) {
@ -669,7 +669,7 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv,
} else if (evpn_type == BGP_EVPN_IP_PREFIX_ROUTE) { } else if (evpn_type == BGP_EVPN_IP_PREFIX_ROUTE) {
struct prefix ip_prefix; 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)) { if (argv_find(argv, argc, "ip", &ip_idx)) {
(void)str2prefix(argv[ip_idx + 1]->arg, &ip_prefix); (void)str2prefix(argv[ip_idx + 1]->arg, &ip_prefix);
apply_mask(&ip_prefix); apply_mask(&ip_prefix);

View File

@ -851,9 +851,9 @@ static int config_write_bgp_dump(struct vty *vty)
/* Initialize BGP packet dump functionality. */ /* Initialize BGP packet dump functionality. */
void bgp_dump_init(void) void bgp_dump_init(void)
{ {
memset(&bgp_dump_all, 0, sizeof(struct bgp_dump)); memset(&bgp_dump_all, 0, sizeof(bgp_dump_all));
memset(&bgp_dump_updates, 0, sizeof(struct bgp_dump)); memset(&bgp_dump_updates, 0, sizeof(bgp_dump_updates));
memset(&bgp_dump_routes, 0, sizeof(struct bgp_dump)); memset(&bgp_dump_routes, 0, sizeof(bgp_dump_routes));
bgp_dump_obuf = bgp_dump_obuf =
stream_new((BGP_STANDARD_MESSAGE_MAX_PACKET_SIZE * 2) stream_new((BGP_STANDARD_MESSAGE_MAX_PACKET_SIZE * 2)

View File

@ -209,7 +209,7 @@ static struct vrf_irt_node *lookup_vrf_import_rt(struct ecommunity_val *rt)
return NULL; return NULL;
} }
memset(&tmp, 0, sizeof(struct vrf_irt_node)); memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp.rt, rt, ECOMMUNITY_SIZE); memcpy(&tmp.rt, rt, ECOMMUNITY_SIZE);
irt = hash_lookup(bgp_evpn->vrf_import_rt_hash, &tmp); irt = hash_lookup(bgp_evpn->vrf_import_rt_hash, &tmp);
return irt; return irt;
@ -291,7 +291,7 @@ static struct irt_node *lookup_import_rt(struct bgp *bgp,
struct irt_node *irt; struct irt_node *irt;
struct irt_node tmp; struct irt_node tmp;
memset(&tmp, 0, sizeof(struct irt_node)); memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp.rt, rt, ECOMMUNITY_SIZE); memcpy(&tmp.rt, rt, ECOMMUNITY_SIZE);
irt = hash_lookup(bgp->import_rt_hash, &tmp); irt = hash_lookup(bgp->import_rt_hash, &tmp);
return irt; return irt;
@ -1291,7 +1291,7 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp,
if (src_attr) if (src_attr)
attr = *src_attr; attr = *src_attr;
else { else {
memset(&attr, 0, sizeof(struct attr)); memset(&attr, 0, sizeof(attr));
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP); 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; int route_change;
bool old_is_sync = false; bool old_is_sync = false;
memset(&attr, 0, sizeof(struct attr)); memset(&attr, 0, sizeof(attr));
/* Build path-attribute for this route. */ /* Build path-attribute for this route. */
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP); 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; pfx += 8;
/* Make EVPN prefix. */ /* Make EVPN prefix. */
memset(&p, 0, sizeof(struct prefix_evpn)); memset(&p, 0, sizeof(p));
p.family = AF_EVPN; p.family = AF_EVPN;
p.prefixlen = EVPN_ROUTE_PREFIXLEN; p.prefixlen = EVPN_ROUTE_PREFIXLEN;
p.prefix.route_type = BGP_EVPN_IMET_ROUTE; 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; pfx += 8;
/* Make EVPN prefix. */ /* Make EVPN prefix. */
memset(&p, 0, sizeof(struct prefix_evpn)); memset(&p, 0, sizeof(p));
p.family = AF_EVPN; p.family = AF_EVPN;
p.prefixlen = EVPN_ROUTE_PREFIXLEN; p.prefixlen = EVPN_ROUTE_PREFIXLEN;
p.prefix.route_type = BGP_EVPN_IP_PREFIX_ROUTE; p.prefix.route_type = BGP_EVPN_IP_PREFIX_ROUTE;
@ -4167,7 +4167,7 @@ static void evpn_mpattr_encode_type5(struct stream *s, const struct prefix *p,
char temp[16]; char temp[16];
const struct evpn_addr *p_evpn_p; const struct evpn_addr *p_evpn_p;
memset(&temp, 0, 16); memset(&temp, 0, sizeof(temp));
if (p->family != AF_EVPN) if (p->family != AF_EVPN)
return; return;
p_evpn_p = &(p->u.prefix_evpn); p_evpn_p = &(p->u.prefix_evpn);
@ -4427,7 +4427,7 @@ void bgp_evpn_install_uninstall_default_route(struct bgp *bgp_vrf, afi_t afi,
struct prefix ip_prefix; struct prefix ip_prefix;
/* form the default prefix 0.0.0.0/0 */ /* 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); ip_prefix.family = afi2family(afi);
if (add) { if (add) {
@ -4990,7 +4990,7 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
for (; pnt < lim; pnt += psize) { for (; pnt < lim; pnt += psize) {
/* Clear prefix structure. */ /* Clear prefix structure. */
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
/* Deal with path-id if AddPath is supported. */ /* Deal with path-id if AddPath is supported. */
if (addpath_capable) { if (addpath_capable) {
@ -5274,7 +5274,7 @@ struct bgpevpn *bgp_evpn_lookup_vni(struct bgp *bgp, vni_t vni)
struct bgpevpn *vpn; struct bgpevpn *vpn;
struct bgpevpn tmp; struct bgpevpn tmp;
memset(&tmp, 0, sizeof(struct bgpevpn)); memset(&tmp, 0, sizeof(tmp));
tmp.vni = vni; tmp.vni = vni;
vpn = hash_lookup(bgp->vnihash, &tmp); vpn = hash_lookup(bgp->vnihash, &tmp);
return vpn; return vpn;
@ -6306,7 +6306,7 @@ static struct bgpevpn *bgp_evpn_vni_svi_hash_lookup(struct bgp *bgp,
struct bgpevpn *vpn; struct bgpevpn *vpn;
struct bgpevpn tmp; struct bgpevpn tmp;
memset(&tmp, 0, sizeof(struct bgpevpn)); memset(&tmp, 0, sizeof(tmp));
tmp.svi_ifindex = svi; tmp.svi_ifindex = svi;
vpn = hash_lookup(bgp->vni_svi_hash, &tmp); vpn = hash_lookup(bgp->vni_svi_hash, &tmp);
return vpn; 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 * which stores all the remote IP addresses received via MAC/IP routes
* in this EVI * in this EVI
*/ */
memset(&tmp, 0, sizeof(struct evpn_remote_ip)); memset(&tmp, 0, sizeof(tmp));
p = &bnc->prefix; p = &bnc->prefix;
if (p->family == AF_INET) { 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) if (!vpn->bgp_vrf || vpn->svi_ifindex == 0)
return; return;
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
if (addr->ipa_type == IPADDR_V4) { if (addr->ipa_type == IPADDR_V4) {
afi = AFI_IP; afi = AFI_IP;

View File

@ -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)); bgp_attr_set_ecommunity(attr, ecommunity_dup(&ecom_encap));
/* ES import RT */ /* ES import RT */
memset(&mac, 0, sizeof(struct ethaddr)); memset(&mac, 0, sizeof(mac));
memset(&ecom_es_rt, 0, sizeof(ecom_es_rt)); memset(&ecom_es_rt, 0, sizeof(ecom_es_rt));
es_get_system_mac(&es->esi, &mac); es_get_system_mac(&es->esi, &mac);
encode_es_rt_extcomm(&eval_es_rt, &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_dest *dest = NULL;
struct bgp_path_info *pi = NULL; struct bgp_path_info *pi = NULL;
memset(&attr, 0, sizeof(struct attr)); memset(&attr, 0, sizeof(attr));
/* Build path-attribute for this route. */ /* Build path-attribute for this route. */
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP); 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; int route_changed = 0;
struct prefix_rd *global_rd; struct prefix_rd *global_rd;
memset(&attr, 0, sizeof(struct attr)); memset(&attr, 0, sizeof(attr));
/* Build path-attribute for this route. */ /* Build path-attribute for this route. */
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP); 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 tmp_n;
struct bgp_evpn_nh *n = NULL; 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)); memcpy(&tmp_n.ip, ip, sizeof(struct ipaddr));
n = hash_get(bgp_vrf->evpn_nh_table, &tmp_n, bgp_evpn_nh_alloc); n = hash_get(bgp_vrf->evpn_nh_table, &tmp_n, bgp_evpn_nh_alloc);
ipaddr2str(ip, n->nh_str, sizeof(n->nh_str)); ipaddr2str(ip, n->nh_str, sizeof(n->nh_str));

View File

@ -2362,7 +2362,7 @@ static void evpn_show_routes_vni_all(struct vty *vty, struct bgp *bgp,
num_vnis = hashcount(bgp->vnihash); num_vnis = hashcount(bgp->vnihash);
if (!num_vnis) if (!num_vnis)
return; return;
memset(&wctx, 0, sizeof(struct vni_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.bgp = bgp; wctx.bgp = bgp;
wctx.vty = vty; wctx.vty = vty;
wctx.vtep_ip = vtep_ip; wctx.vtep_ip = vtep_ip;

View File

@ -121,7 +121,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
for (; pnt < lim; pnt += psize) { for (; pnt < lim; pnt += psize) {
/* Clear prefix structure. */ /* Clear prefix structure. */
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
/* All FlowSpec NLRI begin with length. */ /* All FlowSpec NLRI begin with length. */
if (pnt + 1 > lim) if (pnt + 1 > lim)

View File

@ -97,7 +97,7 @@ bool bgp_flowspec_contains_prefix(const struct prefix *pfs,
switch (type) { switch (type) {
case FLOWSPEC_DEST_PREFIX: case FLOWSPEC_DEST_PREFIX:
case FLOWSPEC_SRC_PREFIX: case FLOWSPEC_SRC_PREFIX:
memset(&compare, 0, sizeof(struct prefix)); memset(&compare, 0, sizeof(compare));
ret = bgp_flowspec_ip_address( ret = bgp_flowspec_ip_address(
BGP_FLOWSPEC_CONVERT_TO_NON_OPAQUE, BGP_FLOWSPEC_CONVERT_TO_NON_OPAQUE,
nlri_content+offset, nlri_content+offset,
@ -185,7 +185,7 @@ int bgp_flowspec_ip_address(enum bgp_flowspec_util_nlri_t type,
uint8_t prefix_offset = 0; uint8_t prefix_offset = 0;
*error = 0; *error = 0;
memset(&prefix_local, 0, sizeof(struct prefix)); memset(&prefix_local, 0, sizeof(prefix_local));
/* read the prefix length */ /* read the prefix length */
prefix_local.prefixlen = nlri_ptr[offset]; prefix_local.prefixlen = nlri_ptr[offset];
psize = PSIZE(prefix_local.prefixlen); 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_dest *dest = pi->net;
struct bgp_pbr_entry_action *api_action; 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, if (bgp_pbr_build_and_validate_entry(bgp_dest_get_prefix(dest), pi,
&api) &api)
< 0) < 0)

View File

@ -121,7 +121,7 @@ static void peer_process(struct hash_bucket *hb, void *arg)
bgp_keepalive_send(pkat->peer); bgp_keepalive_send(pkat->peer);
monotime(&pkat->last); monotime(&pkat->last);
memset(&elapsed, 0x00, sizeof(struct timeval)); memset(&elapsed, 0, sizeof(elapsed));
diff = ka; diff = ka;
} }
@ -220,7 +220,7 @@ void *bgp_keepalives_start(void *arg)
hash_iterate(peerhash, peer_process, &next_update); hash_iterate(peerhash, peer_process, &next_update);
if (next_update.tv_sec == -1) if (next_update.tv_sec == -1)
memset(&next_update, 0x00, sizeof(next_update)); memset(&next_update, 0, sizeof(next_update));
monotime_since(&currtime, &aftertime); monotime_since(&currtime, &aftertime);

View File

@ -55,7 +55,7 @@ int bgp_parse_fec_update(void)
s = zclient->ibuf; s = zclient->ibuf;
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
p.family = stream_getw(s); p.family = stream_getw(s);
p.prefixlen = stream_getc(s); p.prefixlen = stream_getc(s);
stream_get(p.u.val, s, PSIZE(p.prefixlen)); 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) { for (; pnt < lim; pnt += psize) {
/* Clear prefix structure. */ /* Clear prefix structure. */
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
if (addpath_capable) { if (addpath_capable) {

View File

@ -131,7 +131,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr,
#define VPN_PREFIXLEN_MIN_BYTES (3 + 8) /* label + RD */ #define VPN_PREFIXLEN_MIN_BYTES (3 + 8) /* label + RD */
while (STREAM_READABLE(data) > 0) { while (STREAM_READABLE(data) > 0) {
/* Clear prefix structure. */ /* Clear prefix structure. */
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
if (addpath_capable) { if (addpath_capable) {
STREAM_GET(&addpath_id, data, BGP_ADDPATH_ID_LEN); STREAM_GET(&addpath_id, data, BGP_ADDPATH_ID_LEN);

View File

@ -560,7 +560,7 @@ bool bgp_nexthop_self(struct bgp *bgp, afi_t afi, uint8_t type,
return true; return true;
if (new_afi == AF_INET && hashcount(bgp->tip_hash)) { 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; tmp_tip.addr = attr->nexthop;
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) { if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) {

View File

@ -1710,7 +1710,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
} }
/* Set initial values. */ /* Set initial values. */
memset(&attr, 0, sizeof(struct attr)); memset(&attr, 0, sizeof(attr));
attr.label_index = BGP_INVALID_LABEL_INDEX; attr.label_index = BGP_INVALID_LABEL_INDEX;
attr.label = MPLS_INVALID_LABEL; attr.label = MPLS_INVALID_LABEL;
memset(&nlris, 0, sizeof(nlris)); 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. * to maximise debug information.
*/ */
int ok; int ok;
memset(&orfp, 0, memset(&orfp, 0, sizeof(orfp));
sizeof(struct orf_prefix));
common = *p_pnt++; common = *p_pnt++;
/* after ++: p_pnt <= p_end */ /* after ++: p_pnt <= p_end */
if (common if (common

View File

@ -2679,9 +2679,9 @@ static void bgp_pbr_handle_entry(struct bgp *bgp, struct bgp_path_info *path,
struct bgp_pbr_val_mask bpvm; struct bgp_pbr_val_mask bpvm;
memset(&range, 0, sizeof(range)); memset(&range, 0, sizeof(range));
memset(&nh, 0, sizeof(struct nexthop)); memset(&nh, 0, sizeof(nh));
memset(&bpf, 0, sizeof(struct bgp_pbr_filter)); memset(&bpf, 0, sizeof(bpf));
memset(&bpof, 0, sizeof(struct bgp_pbr_or_filter)); memset(&bpof, 0, sizeof(bpof));
if (api->match_bitmask & PREFIX_SRC_PRESENT || if (api->match_bitmask & PREFIX_SRC_PRESENT ||
(api->type == BGP_PBR_IPRULE && (api->type == BGP_PBR_IPRULE &&
api->match_bitmask_iprule & PREFIX_SRC_PRESENT)) 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; dst = &api->dst_prefix;
if (api->type == BGP_PBR_IPRULE) if (api->type == BGP_PBR_IPRULE)
bpf.type = api->type; bpf.type = api->type;
memset(&nh, 0, sizeof(struct nexthop)); memset(&nh, 0, sizeof(nh));
nh.vrf_id = VRF_UNKNOWN; nh.vrf_id = VRF_UNKNOWN;
if (api->match_protocol_num) { if (api->match_protocol_num) {
proto = (uint8_t)api->protocol[0].value; proto = (uint8_t)api->protocol[0].value;

View File

@ -1594,7 +1594,7 @@ static int bgp_input_modifier(struct peer *peer, const struct prefix *p,
/* Route map apply. */ /* Route map apply. */
if (rmap) { 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. */ /* Duplicate current value to new structure for modification. */
rmap_path.peer = peer; rmap_path.peer = peer;
rmap_path.attr = attr; rmap_path.attr = attr;
@ -1650,7 +1650,7 @@ static int bgp_output_modifier(struct peer *peer, const struct prefix *p,
if (rmap == NULL) if (rmap == NULL)
return RMAP_DENY; return RMAP_DENY;
memset(&rmap_path, 0, sizeof(struct bgp_path_info)); memset(&rmap_path, 0, sizeof(rmap_path));
/* Route map apply. */ /* Route map apply. */
/* Duplicate current value to new structure for modification. */ /* Duplicate current value to new structure for modification. */
rmap_path.peer = peer; rmap_path.peer = peer;
@ -2695,7 +2695,7 @@ void subgroup_process_announce_selected(struct update_subgroup *subgrp,
PEER_STATUS_ORF_WAIT_REFRESH)) PEER_STATUS_ORF_WAIT_REFRESH))
return; return;
memset(&attr, 0, sizeof(struct attr)); memset(&attr, 0, sizeof(attr));
/* It's initialized in bgp_announce_check() */ /* It's initialized in bgp_announce_check() */
/* Announcement to the subgroup. If the route is filtered withdraw it. /* Announcement to the subgroup. If the route is filtered withdraw it.
@ -3755,7 +3755,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
if (orig_safi == SAFI_LABELED_UNICAST) if (orig_safi == SAFI_LABELED_UNICAST)
safi = SAFI_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_index = BGP_INVALID_LABEL_INDEX;
new_attr.label = MPLS_INVALID_LABEL; new_attr.label = MPLS_INVALID_LABEL;
@ -5653,7 +5653,7 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr,
then the Error Subcode is set to Invalid Network Field. */ then the Error Subcode is set to Invalid Network Field. */
for (; pnt < lim; pnt += psize) { for (; pnt < lim; pnt += psize) {
/* Clear prefix structure. */ /* Clear prefix structure. */
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
if (addpath_capable) { if (addpath_capable) {
@ -5830,7 +5830,7 @@ void bgp_static_update(struct bgp *bgp, const struct prefix *p,
if (bgp_static->rmap.name) { if (bgp_static->rmap.name) {
struct attr attr_tmp = attr; 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.peer = bgp->peer_self;
rmap_path.attr = &attr_tmp; rmap_path.attr = &attr_tmp;
@ -6142,7 +6142,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)); memcpy(&attr.esi, bgp_static->eth_s_id, sizeof(esi_t));
if (bgp_static->encap_tunneltype == BGP_ENCAP_TYPE_VXLAN) { if (bgp_static->encap_tunneltype == BGP_ENCAP_TYPE_VXLAN) {
struct bgp_encap_type_vxlan bet; 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; bet.vnid = p->u.prefix_evpn.prefix_addr.eth_tag;
bgp_encap_type_vxlan_to_tlv(&bet, &attr); bgp_encap_type_vxlan_to_tlv(&bet, &attr);
} }
@ -6642,7 +6642,7 @@ int bgp_static_set_safi(afi_t afi, safi_t safi, struct vty *vty,
return CMD_WARNING_CONFIG_FAILED; return CMD_WARNING_CONFIG_FAILED;
} }
if (gwip) { if (gwip) {
memset(&gw_ip, 0, sizeof(struct prefix)); memset(&gw_ip, 0, sizeof(gw_ip));
ret = str2prefix(gwip, &gw_ip); ret = str2prefix(gwip, &gw_ip);
if (!ret) { if (!ret) {
vty_out(vty, "%% Malformed GatewayIp\n"); vty_out(vty, "%% Malformed GatewayIp\n");
@ -8369,7 +8369,7 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p,
/* Apply route-map. */ /* Apply route-map. */
if (red->rmap.name) { 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.peer = bgp->peer_self;
rmap_path.attr = &attr_new; rmap_path.attr = &attr_new;

View File

@ -461,7 +461,7 @@ static int write_bgpPeerTable(int action, uint8_t *var_val,
intval = *(long *)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); peer = bgpPeerTable_lookup(NULL, name, &length, &addr, 1);
if (!peer) 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) if (smux_header_table(v, name, length, exact, var_len, write_method)
== MATCH_FAILED) == MATCH_FAILED)
return NULL; return NULL;
memset(&addr, 0, sizeof(struct in_addr)); memset(&addr, 0, sizeof(addr));
peer = bgpPeerTable_lookup(v, name, length, &addr, exact); peer = bgpPeerTable_lookup(v, name, length, &addr, exact);
if (!peer) 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) if (smux_header_table(v, name, length, exact, var_len, write_method)
== MATCH_FAILED) == MATCH_FAILED)
return NULL; return NULL;
memset(&addr, 0, sizeof(struct prefix_ipv4)); memset(&addr, 0, sizeof(addr));
path = bgp4PathAttrLookup(v, name, length, bgp, &addr, exact); path = bgp4PathAttrLookup(v, name, length, bgp, &addr, exact);
if (!path) if (!path)

View File

@ -2890,8 +2890,8 @@ static int bgp_zebra_process_local_l3vni(ZAPI_CALLBACK_ARGS)
ifindex_t svi_ifindex; ifindex_t svi_ifindex;
bool is_anycast_mac = false; bool is_anycast_mac = false;
memset(&svi_rmac, 0, sizeof(struct ethaddr)); memset(&svi_rmac, 0, sizeof(svi_rmac));
memset(&originator_ip, 0, sizeof(struct in_addr)); memset(&originator_ip, 0, sizeof(originator_ip));
s = zclient->ibuf; s = zclient->ibuf;
l3vni = stream_getl(s); l3vni = stream_getl(s);
if (cmd == ZEBRA_L3VNI_ADD) { 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 bgp *bgp_vrf = NULL;
struct prefix p; struct prefix p;
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
s = zclient->ibuf; s = zclient->ibuf;
stream_get(&p, s, sizeof(struct prefix)); 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) if (!vrf_is_backend_netns() && bgp->vrf_id != nh->vrf_id)
return; return;
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
if (afi != AFI_IP && afi != AFI_IP6) if (afi != AFI_IP && afi != AFI_IP6)
return; return;
p.family = afi2family(afi); 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 /* Check if capability is already sent. If the flag force is set
* send the capability since this can be initial bgp configuration * send the capability since this can be initial bgp configuration
*/ */
memset(&api, 0, sizeof(struct zapi_cap)); memset(&api, 0, sizeof(api));
if (disable) { if (disable) {
api.cap = ZEBRA_CLIENT_GR_DISABLE; api.cap = ZEBRA_CLIENT_GR_DISABLE;
api.vrf_id = bgp->vrf_id; api.vrf_id = bgp->vrf_id;
@ -3700,7 +3700,7 @@ int bgp_zebra_stale_timer_update(struct bgp *bgp)
return BGP_GR_FAILURE; return BGP_GR_FAILURE;
} }
memset(&api, 0, sizeof(struct zapi_cap)); memset(&api, 0, sizeof(api));
api.cap = ZEBRA_CLIENT_RIB_STALE_TIME; api.cap = ZEBRA_CLIENT_RIB_STALE_TIME;
api.stale_removal_time = bgp->rib_stale_time; api.stale_removal_time = bgp->rib_stale_time;
api.vrf_id = bgp->vrf_id; api.vrf_id = bgp->vrf_id;

View File

@ -7838,7 +7838,7 @@ void bgp_master_init(struct thread_master *master, const int buffer_size,
{ {
qobj_init(); qobj_init();
memset(&bgp_master, 0, sizeof(struct bgp_master)); memset(&bgp_master, 0, sizeof(bgp_master));
bm = &bgp_master; bm = &bgp_master;
bm->bgp = list_new(); bm->bgp = list_new();

View File

@ -238,7 +238,7 @@ static void vnc_rhnck(char *tag)
struct prefix pfx_orig_nexthop; struct prefix pfx_orig_nexthop;
memset(&pfx_orig_nexthop, 0, memset(&pfx_orig_nexthop, 0,
sizeof(struct prefix)); /* keep valgrind happy */ sizeof(pfx_orig_nexthop)); /* keep valgrind happy */
pkey = p->key; pkey = p->key;
pb = p->value; pb = p->value;
@ -303,7 +303,7 @@ static int process_unicast_route(struct bgp *bgp, /* in */
struct prefix pfx_orig_nexthop; struct prefix pfx_orig_nexthop;
memset(&pfx_orig_nexthop, 0, memset(&pfx_orig_nexthop, 0,
sizeof(struct prefix)); /* keep valgrind happy */ sizeof(pfx_orig_nexthop)); /* keep valgrind happy */
/* /*
* prefix list check * 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 * must be freed before we return. It's easier to put it after
* all of the possible returns above. * all of the possible returns above.
*/ */
memset(&hattr, 0, sizeof(struct attr)); memset(&hattr, 0, sizeof(hattr));
/* hattr becomes a ghost attr */ /* hattr becomes a ghost attr */
hattr = *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 * must be freed before we return. It's easier to put it after
* all of the possible returns above. * all of the possible returns above.
*/ */
memset(&hattr, 0, sizeof(struct attr)); memset(&hattr, 0, sizeof(hattr));
/* hattr becomes a ghost attr */ /* hattr becomes a ghost attr */
hattr = *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 * must be freed before we return. It's easier to put it after
* all of the possible returns above. * all of the possible returns above.
*/ */
memset(&hattr, 0, sizeof(struct attr)); memset(&hattr, 0, sizeof(hattr));
/* hattr becomes a ghost attr */ /* hattr becomes a ghost attr */
hattr = *attr; hattr = *attr;
@ -1420,7 +1420,7 @@ void vnc_import_bgp_add_vnc_host_route_mode_resolve_nve(
uint32_t local_pref; uint32_t local_pref;
memset(&pfx_unicast_nexthop, 0, 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)) if (VNC_DEBUG(IMPORT_BGP_ADD_ROUTE))
vnc_zlog_debug_any( vnc_zlog_debug_any(
@ -1538,7 +1538,7 @@ void vnc_import_bgp_del_vnc_host_route_mode_resolve_nve(
struct prefix pfx_unicast_nexthop; struct prefix pfx_unicast_nexthop;
memset(&pfx_unicast_nexthop, 0, 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, if (process_unicast_route(bgp, afi, &pb->upfx, pb->ubpi, &ecom,
&pfx_unicast_nexthop)) { &pfx_unicast_nexthop)) {
@ -1713,7 +1713,7 @@ static void vnc_import_bgp_exterior_add_route_it(
prd = NULL; prd = NULL;
/* use local_pref from unicast route */ /* 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; new_attr = *bpi_interior->attr;
if (info->attr->flag if (info->attr->flag
& ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) { & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
@ -1807,7 +1807,7 @@ void vnc_import_bgp_exterior_del_route(
return; return;
memset(&pfx_orig_nexthop, 0, memset(&pfx_orig_nexthop, 0,
sizeof(struct prefix)); /* keep valgrind happy */ sizeof(pfx_orig_nexthop)); /* keep valgrind happy */
h = bgp_default->rfapi; h = bgp_default->rfapi;
hc = bgp_default->rfapi_cfg; hc = bgp_default->rfapi_cfg;
@ -2473,7 +2473,7 @@ void vnc_import_bgp_exterior_del_route_interior(
prd = NULL; prd = NULL;
/* use local_pref from unicast route */ /* use local_pref from unicast route */
memset(&new_attr, 0, sizeof(struct attr)); memset(&new_attr, 0, sizeof(new_attr));
new_attr = *bpi->attr; new_attr = *bpi->attr;
if (bpi_exterior if (bpi_exterior
&& (bpi_exterior->attr->flag && (bpi_exterior->attr->flag

View File

@ -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, void *rfp_start(struct thread_master *master, struct rfapi_rfp_cfg **cfgp,
struct rfapi_rfp_cb_methods **cbmp) 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 */ global_rfi.master = master; /* for BGPD threads */
/* initilize struct rfapi_rfp_cfg, see rfapi.h */ /* initilize struct rfapi_rfp_cfg, see rfapi.h */

View File

@ -370,7 +370,7 @@ void eigrp_write(struct thread *thread)
if (ep->dst.s_addr == htonl(EIGRP_MULTICAST_ADDRESS)) if (ep->dst.s_addr == htonl(EIGRP_MULTICAST_ADDRESS))
eigrp_if_ipmulticast(eigrp, &ei->address, ei->ifp->ifindex); eigrp_if_ipmulticast(eigrp, &ei->address, ei->ifp->ifindex);
memset(&iph, 0, sizeof(struct ip)); memset(&iph, 0, sizeof(iph));
memset(&sa_dst, 0, sizeof(sa_dst)); memset(&sa_dst, 0, sizeof(sa_dst));
/* /*
@ -713,7 +713,7 @@ static struct stream *eigrp_recv_packet(struct eigrp *eigrp,
char buff[CMSG_SPACE(SOPT_SIZE_CMSG_IFINDEX_IPV4())]; char buff[CMSG_SPACE(SOPT_SIZE_CMSG_IFINDEX_IPV4())];
struct msghdr msgh; struct msghdr msgh;
memset(&msgh, 0, sizeof(struct msghdr)); memset(&msgh, 0, sizeof(msgh));
msgh.msg_iov = &iov; msgh.msg_iov = &iov;
msgh.msg_iovlen = 1; msgh.msg_iovlen = 1;
msgh.msg_control = (caddr_t)buff; msgh.msg_control = (caddr_t)buff;

View File

@ -1034,7 +1034,7 @@ static uint8_t *eigrpPeerEntry(struct variable *v, oid *name, size_t *length,
== MATCH_FAILED) == MATCH_FAILED)
return NULL; return NULL;
memset(&nbr_addr, 0, sizeof(struct in_addr)); memset(&nbr_addr, 0, sizeof(nbr_addr));
ifindex = 0; ifindex = 0;
nbr = eigrpNbrLookup(v, name, length, &nbr_addr, &ifindex, exact); nbr = eigrpNbrLookup(v, name, length, &nbr_addr, &ifindex, exact);

View File

@ -123,7 +123,7 @@ void eigrp_master_init(void)
{ {
struct timeval tv; struct timeval tv;
memset(&eigrp_master, 0, sizeof(struct eigrp_master)); memset(&eigrp_master, 0, sizeof(eigrp_master));
eigrp_om = &eigrp_master; eigrp_om = &eigrp_master;
eigrp_om->eigrp = list_new(); eigrp_om->eigrp = list_new();

View File

@ -161,7 +161,7 @@ static int open_bpf_dev(struct isis_circuit *circuit)
/* /*
* And set the filter * And set the filter
*/ */
memset(&bpf_prog, 0, sizeof(struct bpf_program)); memset(&bpf_prog, 0, sizeof(bpf_prog));
bpf_prog.bf_len = 8; bpf_prog.bf_len = 8;
bpf_prog.bf_insns = &(llcfilter[0]); bpf_prog.bf_insns = &(llcfilter[0]);
if (ioctl(fd, BIOCSETF, (caddr_t)&bpf_prog) < 0) { if (ioctl(fd, BIOCSETF, (caddr_t)&bpf_prog) < 0) {

View File

@ -144,7 +144,7 @@ static int open_packet_socket(struct isis_circuit *circuit)
/* /*
* Bind to the physical interface * Bind to the physical interface
*/ */
memset(&s_addr, 0, sizeof(struct sockaddr_ll)); memset(&s_addr, 0, sizeof(s_addr));
s_addr.sll_family = AF_PACKET; s_addr.sll_family = AF_PACKET;
s_addr.sll_protocol = htons(ETH_P_ALL); s_addr.sll_protocol = htons(ETH_P_ALL);
s_addr.sll_ifindex = circuit->interface->ifindex; s_addr.sll_ifindex = circuit->interface->ifindex;
@ -233,7 +233,7 @@ int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa)
addr_len = sizeof(s_addr); addr_len = sizeof(s_addr);
memset(&s_addr, 0, sizeof(struct sockaddr_ll)); memset(&s_addr, 0, sizeof(s_addr));
bytesread = bytesread =
recvfrom(circuit->fd, (void *)&llc, LLC_LEN, MSG_PEEK, recvfrom(circuit->fd, (void *)&llc, LLC_LEN, MSG_PEEK,
@ -306,7 +306,7 @@ int isis_recv_pdu_p2p(struct isis_circuit *circuit, uint8_t *ssnpa)
int bytesread, addr_len; int bytesread, addr_len;
struct sockaddr_ll s_addr; struct sockaddr_ll s_addr;
memset(&s_addr, 0, sizeof(struct sockaddr_ll)); memset(&s_addr, 0, sizeof(s_addr));
addr_len = sizeof(s_addr); addr_len = sizeof(s_addr);
/* we can read directly to the stream */ /* we can read directly to the stream */
@ -351,7 +351,7 @@ int isis_send_pdu_bcast(struct isis_circuit *circuit, int level)
struct sockaddr_ll sa; struct sockaddr_ll sa;
stream_set_getp(circuit->snd_stream, 0); stream_set_getp(circuit->snd_stream, 0);
memset(&sa, 0, sizeof(struct sockaddr_ll)); memset(&sa, 0, sizeof(sa));
sa.sll_family = AF_PACKET; sa.sll_family = AF_PACKET;
size_t frame_size = stream_get_endp(circuit->snd_stream) + LLC_LEN; size_t frame_size = stream_get_endp(circuit->snd_stream) + LLC_LEN;
@ -398,7 +398,7 @@ int isis_send_pdu_p2p(struct isis_circuit *circuit, int level)
ssize_t rv; ssize_t rv;
stream_set_getp(circuit->snd_stream, 0); stream_set_getp(circuit->snd_stream, 0);
memset(&sa, 0, sizeof(struct sockaddr_ll)); memset(&sa, 0, sizeof(sa));
sa.sll_family = AF_PACKET; sa.sll_family = AF_PACKET;
sa.sll_ifindex = circuit->interface->ifindex; sa.sll_ifindex = circuit->interface->ifindex;
sa.sll_halen = ETH_ALEN; sa.sll_halen = ETH_ALEN;

View File

@ -177,7 +177,7 @@ struct isis *isis_lookup_by_sysid(const uint8_t *sysid)
void isis_master_init(struct thread_master *master) void isis_master_init(struct thread_master *master)
{ {
memset(&isis_master, 0, sizeof(struct isis_master)); memset(&isis_master, 0, sizeof(isis_master));
im = &isis_master; im = &isis_master;
im->isis = list_new(); im->isis = list_new();
im->master = master; im->master = master;

View File

@ -542,7 +542,7 @@ static time_t key_str2time(const char *time_str, const char *day_str,
/* Check year_str. Year must be <1993-2035>. */ /* Check year_str. Year must be <1993-2035>. */
GET_LONG_RANGE(year, year_str, 1993, 2035); GET_LONG_RANGE(year, year_str, 1993, 2035);
memset(&tm, 0, sizeof(struct tm)); memset(&tm, 0, sizeof(tm));
tm.tm_sec = sec; tm.tm_sec = sec;
tm.tm_min = min; tm.tm_min = min;
tm.tm_hour = hour; tm.tm_hour = hour;

View File

@ -759,7 +759,7 @@ struct route_map *route_map_lookup_by_name(const char *name)
return NULL; return NULL;
// map.deleted is false via memset // map.deleted is false via memset
memset(&tmp_map, 0, sizeof(struct route_map)); memset(&tmp_map, 0, sizeof(tmp_map));
tmp_map.name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, name); tmp_map.name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, name);
map = hash_lookup(route_map_master_hash, &tmp_map); map = hash_lookup(route_map_master_hash, &tmp_map);
XFREE(MTYPE_ROUTE_MAP_NAME, tmp_map.name); XFREE(MTYPE_ROUTE_MAP_NAME, tmp_map.name);
@ -797,7 +797,7 @@ int route_map_mark_updated(const char *name)
* with deleted=true * with deleted=true
*/ */
if (!map) { if (!map) {
memset(&tmp_map, 0, sizeof(struct route_map)); memset(&tmp_map, 0, sizeof(tmp_map));
tmp_map.name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, name); tmp_map.name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, name);
tmp_map.deleted = true; tmp_map.deleted = true;
map = hash_lookup(route_map_master_hash, &tmp_map); map = hash_lookup(route_map_master_hash, &tmp_map);
@ -2481,7 +2481,7 @@ void route_map_notify_pentry_dependencies(const char *affected_name,
if (!dep->this_hash) if (!dep->this_hash)
dep->this_hash = upd8_hash; dep->this_hash = upd8_hash;
memset(&pentry_dep, 0, sizeof(struct route_map_pentry_dep)); memset(&pentry_dep, 0, sizeof(pentry_dep));
pentry_dep.pentry = pentry; pentry_dep.pentry = pentry;
pentry_dep.plist_name = affected_name; pentry_dep.plist_name = affected_name;
pentry_dep.event = event; pentry_dep.event = event;
@ -2760,7 +2760,7 @@ static void route_map_clear_reference(struct hash_bucket *bucket, void *arg)
struct route_map_dep *dep = bucket->data; struct route_map_dep *dep = bucket->data;
struct route_map_dep_data *dep_data = NULL, tmp_dep_data; struct route_map_dep_data *dep_data = NULL, tmp_dep_data;
memset(&tmp_dep_data, 0, sizeof(struct route_map_dep_data)); memset(&tmp_dep_data, 0, sizeof(tmp_dep_data));
tmp_dep_data.rname = arg; tmp_dep_data.rname = arg;
dep_data = hash_release(dep->dep_rmap_hash, &tmp_dep_data); dep_data = hash_release(dep->dep_rmap_hash, &tmp_dep_data);
if (dep_data) { if (dep_data) {
@ -2873,7 +2873,7 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
if (!dep->this_hash) if (!dep->this_hash)
dep->this_hash = dephash; dep->this_hash = dephash;
memset(&tmp_dep_data, 0, sizeof(struct route_map_dep_data)); memset(&tmp_dep_data, 0, sizeof(tmp_dep_data));
tmp_dep_data.rname = rname; tmp_dep_data.rname = rname;
dep_data = hash_lookup(dep->dep_rmap_hash, &tmp_dep_data); dep_data = hash_lookup(dep->dep_rmap_hash, &tmp_dep_data);
if (!dep_data) if (!dep_data)
@ -2897,7 +2897,7 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
goto out; goto out;
} }
memset(&tmp_dep_data, 0, sizeof(struct route_map_dep_data)); memset(&tmp_dep_data, 0, sizeof(tmp_dep_data));
tmp_dep_data.rname = rname; tmp_dep_data.rname = rname;
dep_data = hash_lookup(dep->dep_rmap_hash, &tmp_dep_data); dep_data = hash_lookup(dep->dep_rmap_hash, &tmp_dep_data);
/* /*

View File

@ -107,7 +107,7 @@ static void sockunion_normalise_mapped(union sockunion *su)
if (su->sa.sa_family == AF_INET6 if (su->sa.sa_family == AF_INET6
&& IN6_IS_ADDR_V4MAPPED(&su->sin6.sin6_addr)) { && IN6_IS_ADDR_V4MAPPED(&su->sin6.sin6_addr)) {
memset(&sin, 0, sizeof(struct sockaddr_in)); memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET; sin.sin_family = AF_INET;
sin.sin_port = su->sin6.sin6_port; sin.sin_port = su->sin6.sin6_port;
memcpy(&sin.sin_addr, ((char *)&su->sin6.sin6_addr) + 12, 4); memcpy(&sin.sin_addr, ((char *)&su->sin6.sin6_addr) + 12, 4);

View File

@ -228,7 +228,7 @@ struct route_node *route_node_match_ipv4(struct route_table *table,
{ {
struct prefix_ipv4 p; struct prefix_ipv4 p;
memset(&p, 0, sizeof(struct prefix_ipv4)); memset(&p, 0, sizeof(p));
p.family = AF_INET; p.family = AF_INET;
p.prefixlen = IPV4_MAX_BITLEN; p.prefixlen = IPV4_MAX_BITLEN;
p.prefix = *addr; p.prefix = *addr;
@ -241,7 +241,7 @@ struct route_node *route_node_match_ipv6(struct route_table *table,
{ {
struct prefix_ipv6 p; struct prefix_ipv6 p;
memset(&p, 0, sizeof(struct prefix_ipv6)); memset(&p, 0, sizeof(p));
p.family = AF_INET6; p.family = AF_INET6;
p.prefixlen = IPV6_MAX_BITLEN; p.prefixlen = IPV6_MAX_BITLEN;
p.prefix = *addr; p.prefix = *addr;

View File

@ -1827,7 +1827,7 @@ static void vty_serv_sock_addrinfo(const char *hostname, unsigned short port)
int sock; int sock;
char port_str[BUFSIZ]; char port_str[BUFSIZ];
memset(&req, 0, sizeof(struct addrinfo)); memset(&req, 0, sizeof(req));
req.ai_flags = AI_PASSIVE; req.ai_flags = AI_PASSIVE;
req.ai_family = AF_UNSPEC; req.ai_family = AF_UNSPEC;
req.ai_socktype = SOCK_STREAM; req.ai_socktype = SOCK_STREAM;
@ -1912,7 +1912,7 @@ static void vty_serv_un(const char *path)
} }
/* Make server socket. */ /* Make server socket. */
memset(&serv, 0, sizeof(struct sockaddr_un)); memset(&serv, 0, sizeof(serv));
serv.sun_family = AF_UNIX; serv.sun_family = AF_UNIX;
strlcpy(serv.sun_path, path, sizeof(serv.sun_path)); strlcpy(serv.sun_path, path, sizeof(serv.sun_path));
#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN #ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
@ -1976,7 +1976,7 @@ static void vtysh_accept(struct thread *thread)
vty_event_serv(VTYSH_SERV, vtyserv); vty_event_serv(VTYSH_SERV, vtyserv);
memset(&client, 0, sizeof(struct sockaddr_un)); memset(&client, 0, sizeof(client));
client_len = sizeof(struct sockaddr_un); client_len = sizeof(struct sockaddr_un);
sock = accept(accept_sock, (struct sockaddr *)&client, sock = accept(accept_sock, (struct sockaddr *)&client,

View File

@ -600,7 +600,7 @@ int sock_open_unix(const char *path)
if (fd < 0) if (fd < 0)
return -1; return -1;
memset(&addr, 0, sizeof(struct sockaddr_un)); memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
strlcpy(addr.sun_path, path, sizeof(addr.sun_path)); strlcpy(addr.sun_path, path, sizeof(addr.sun_path));

View File

@ -628,7 +628,7 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
if (CHECK_FLAG(external->bits_metric, OSPF6_ASBR_BIT_F)) { if (CHECK_FLAG(external->bits_metric, OSPF6_ASBR_BIT_F)) {
offset = sizeof(*external) offset = sizeof(*external)
+ OSPF6_PREFIX_SPACE(external->prefix.prefix_length); + OSPF6_PREFIX_SPACE(external->prefix.prefix_length);
memset(&fwd_addr, 0, sizeof(struct prefix)); memset(&fwd_addr, 0, sizeof(fwd_addr));
fwd_addr.family = AF_INET6; fwd_addr.family = AF_INET6;
fwd_addr.prefixlen = IPV6_MAX_BITLEN; fwd_addr.prefixlen = IPV6_MAX_BITLEN;
memcpy(&fwd_addr.u.prefix6, (caddr_t)external + offset, memcpy(&fwd_addr.u.prefix6, (caddr_t)external + offset,

View File

@ -406,7 +406,7 @@ int ospf6_auth_validate_pkt(struct ospf6_interface *oi, unsigned int *pkt_len,
return OSPF6_AUTH_VALIDATE_FAILURE; return OSPF6_AUTH_VALIDATE_FAILURE;
} }
memset(&ospf6_auth_info, 0, sizeof(struct ospf6_auth_hdr)); memset(&ospf6_auth_info, 0, sizeof(ospf6_auth_info));
if ((*pkt_len - hdr_len - (*lls_block_len)) > sizeof(ospf6_auth_info)) { if ((*pkt_len - hdr_len - (*lls_block_len)) > sizeof(ospf6_auth_info)) {
if (IS_OSPF6_DEBUG_AUTH_RX) if (IS_OSPF6_DEBUG_AUTH_RX)
zlog_err("RECV[%s] : Wrong auth data in %s packet", zlog_err("RECV[%s] : Wrong auth data in %s packet",

View File

@ -2010,7 +2010,7 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa)
break; break;
prefix_num--; prefix_num--;
memset(&prefix, 0, sizeof(struct prefix)); memset(&prefix, 0, sizeof(prefix));
prefix.family = AF_INET6; prefix.family = AF_INET6;
prefix.prefixlen = op->prefix_length; prefix.prefixlen = op->prefix_length;
ospf6_prefix_in6_addr(&prefix.u.prefix6, intra_prefix_lsa, op); ospf6_prefix_in6_addr(&prefix.u.prefix6, intra_prefix_lsa, op);

View File

@ -173,7 +173,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst,
memset(&cmsgbuf, 0, sizeof(cmsgbuf)); memset(&cmsgbuf, 0, sizeof(cmsgbuf));
scmsgp = (struct cmsghdr *)&cmsgbuf; scmsgp = (struct cmsghdr *)&cmsgbuf;
pktinfo = (struct in6_pktinfo *)(CMSG_DATA(scmsgp)); pktinfo = (struct in6_pktinfo *)(CMSG_DATA(scmsgp));
memset(&dst_sin6, 0, sizeof(struct sockaddr_in6)); memset(&dst_sin6, 0, sizeof(dst_sin6));
/* source address */ /* source address */
pktinfo->ipi6_ifindex = ifindex; pktinfo->ipi6_ifindex = ifindex;
@ -226,7 +226,7 @@ int ospf6_recvmsg(struct in6_addr *src, struct in6_addr *dst,
rcmsgp = (struct cmsghdr *)cmsgbuf; rcmsgp = (struct cmsghdr *)cmsgbuf;
pktinfo = (struct in6_pktinfo *)(CMSG_DATA(rcmsgp)); pktinfo = (struct in6_pktinfo *)(CMSG_DATA(rcmsgp));
memset(&src_sin6, 0, sizeof(struct sockaddr_in6)); memset(&src_sin6, 0, sizeof(src_sin6));
/* receive control msg */ /* receive control msg */
rcmsgp->cmsg_level = IPPROTO_IPV6; rcmsgp->cmsg_level = IPPROTO_IPV6;

View File

@ -1550,7 +1550,7 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc,
int arg_end = use_json ? (argc - 1) : argc; int arg_end = use_json ? (argc - 1) : argc;
json_object *json = NULL; json_object *json = NULL;
memset(&prefix, 0, sizeof(struct prefix)); memset(&prefix, 0, sizeof(prefix));
if (use_json) if (use_json)
json = json_object_new_object(); json = json_object_new_object();
@ -1723,9 +1723,9 @@ int ospf6_linkstate_table_show(struct vty *vty, int idx_ipv4, int argc,
int i, ret; int i, ret;
struct prefix router, id, prefix; struct prefix router, id, prefix;
memset(&router, 0, sizeof(struct prefix)); memset(&router, 0, sizeof(router));
memset(&id, 0, sizeof(struct prefix)); memset(&id, 0, sizeof(id));
memset(&prefix, 0, sizeof(struct prefix)); memset(&prefix, 0, sizeof(prefix));
for (i = idx_ipv4; i < argc; i++) { for (i = idx_ipv4; i < argc; i++) {
if (strmatch(argv[i]->text, "detail")) { if (strmatch(argv[i]->text, "detail")) {

View File

@ -579,7 +579,7 @@ static void ospf6_disable(struct ospf6 *o)
void ospf6_master_init(struct thread_master *master) void ospf6_master_init(struct thread_master *master)
{ {
memset(&ospf6_master, 0, sizeof(struct ospf6_master)); memset(&ospf6_master, 0, sizeof(ospf6_master));
om6 = &ospf6_master; om6 = &ospf6_master;
om6->ospf6 = list_new(); om6->ospf6 = list_new();
@ -1758,7 +1758,7 @@ bool ospf6_is_valid_summary_addr(struct vty *vty, struct prefix *p)
{ {
struct in6_addr addr_zero; struct in6_addr addr_zero;
memset(&addr_zero, 0, sizeof(struct in6_addr)); memset(&addr_zero, 0, sizeof(addr_zero));
/* Default prefix validation*/ /* Default prefix validation*/
if ((is_default_prefix(p)) || if ((is_default_prefix(p)) ||

View File

@ -241,7 +241,7 @@ static int ospf6_zebra_gr_update(struct ospf6 *ospf6, int command,
if (!zclient || zclient->sock < 0 || !ospf6) if (!zclient || zclient->sock < 0 || !ospf6)
return 1; return 1;
memset(&api, 0, sizeof(struct zapi_cap)); memset(&api, 0, sizeof(api));
api.cap = command; api.cap = command;
api.stale_removal_time = stale_time; api.stale_removal_time = stale_time;
api.vrf_id = ospf6->vrf_id; api.vrf_id = ospf6->vrf_id;

View File

@ -124,7 +124,7 @@ struct ospf_apiclient *ospf_apiclient_connect(char *host, int syncport)
/* Prepare socket for asynchronous messages */ /* Prepare socket for asynchronous messages */
/* Initialize async address structure */ /* Initialize async address structure */
memset(&myaddr_async, 0, sizeof(struct sockaddr_in)); memset(&myaddr_async, 0, sizeof(myaddr_async));
myaddr_async.sin_family = AF_INET; myaddr_async.sin_family = AF_INET;
myaddr_async.sin_addr.s_addr = htonl(INADDR_ANY); myaddr_async.sin_addr.s_addr = htonl(INADDR_ANY);
myaddr_async.sin_port = htons(syncport + 1); myaddr_async.sin_port = htons(syncport + 1);
@ -219,7 +219,7 @@ struct ospf_apiclient *ospf_apiclient_connect(char *host, int syncport)
want the sync port number on a fixed port number. The reverse want the sync port number on a fixed port number. The reverse
async channel will be at this port+1 */ async channel will be at this port+1 */
memset(&myaddr_sync, 0, sizeof(struct sockaddr_in)); memset(&myaddr_sync, 0, sizeof(myaddr_sync));
myaddr_sync.sin_family = AF_INET; myaddr_sync.sin_family = AF_INET;
myaddr_sync.sin_port = htons(syncport); myaddr_sync.sin_port = htons(syncport);
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN

View File

@ -615,7 +615,7 @@ void ospf_apiserver_accept(struct thread *thread)
/* Get port address and port number of peer to make reverse connection. /* Get port address and port number of peer to make reverse connection.
The reverse channel uses the port number of the peer port+1. */ The reverse channel uses the port number of the peer port+1. */
memset(&peer_sync, 0, sizeof(struct sockaddr_in)); memset(&peer_sync, 0, sizeof(peer_sync));
peerlen = sizeof(struct sockaddr_in); peerlen = sizeof(struct sockaddr_in);
ret = getpeername(new_sync_sock, (struct sockaddr *)&peer_sync, ret = getpeername(new_sync_sock, (struct sockaddr *)&peer_sync,

View File

@ -648,7 +648,7 @@ struct ospf_lsa *ospf_originate_summary_lsa(struct ospf *ospf,
} }
/* Prepare the extrenal_info for aggregator */ /* Prepare the extrenal_info for aggregator */
memset(&ei_aggr, 0, sizeof(struct external_info)); memset(&ei_aggr, 0, sizeof(ei_aggr));
ei_aggr.p = aggr->p; ei_aggr.p = aggr->p;
ei_aggr.tag = aggr->tag; ei_aggr.tag = aggr->tag;
ei_aggr.type = 0; ei_aggr.type = 0;
@ -1011,7 +1011,7 @@ static void ospf_handle_external_aggr_update(struct ospf *ospf)
aggr->action = OSPF_ROUTE_AGGR_NONE; aggr->action = OSPF_ROUTE_AGGR_NONE;
/* Prepare the extrenal_info for aggregator */ /* Prepare the extrenal_info for aggregator */
memset(&ei_aggr, 0, sizeof(struct external_info)); memset(&ei_aggr, 0, sizeof(ei_aggr));
ei_aggr.p = aggr->p; ei_aggr.p = aggr->p;
ei_aggr.tag = aggr->tag; ei_aggr.tag = aggr->tag;
ei_aggr.type = 0; ei_aggr.type = 0;

View File

@ -114,7 +114,7 @@ int ospf_ext_init(void)
{ {
int rc = 0; int rc = 0;
memset(&OspfEXT, 0, sizeof(struct ospf_ext_lp)); memset(&OspfEXT, 0, sizeof(OspfEXT));
OspfEXT.enabled = false; OspfEXT.enabled = false;
/* Only Area flooding is supported yet */ /* Only Area flooding is supported yet */
OspfEXT.scope = OSPF_OPAQUE_AREA_LSA; OspfEXT.scope = OSPF_OPAQUE_AREA_LSA;

View File

@ -3149,7 +3149,7 @@ void ospf_lsa_maxage_delete(struct ospf *ospf, struct ospf_lsa *lsa)
struct route_node *rn; struct route_node *rn;
struct prefix lsa_prefix; struct prefix lsa_prefix;
memset(&lsa_prefix, 0, sizeof(struct prefix)); memset(&lsa_prefix, 0, sizeof(lsa_prefix));
lsa_prefix.family = AF_UNSPEC; lsa_prefix.family = AF_UNSPEC;
lsa_prefix.prefixlen = sizeof(lsa_prefix.u.ptr) * CHAR_BIT; lsa_prefix.prefixlen = sizeof(lsa_prefix.u.ptr) * CHAR_BIT;
lsa_prefix.u.ptr = (uintptr_t)lsa; lsa_prefix.u.ptr = (uintptr_t)lsa;
@ -3190,7 +3190,7 @@ void ospf_lsa_maxage(struct ospf *ospf, struct ospf_lsa *lsa)
return; return;
} }
memset(&lsa_prefix, 0, sizeof(struct prefix)); memset(&lsa_prefix, 0, sizeof(lsa_prefix));
lsa_prefix.family = AF_UNSPEC; lsa_prefix.family = AF_UNSPEC;
lsa_prefix.prefixlen = sizeof(lsa_prefix.u.ptr) * CHAR_BIT; lsa_prefix.prefixlen = sizeof(lsa_prefix.u.ptr) * CHAR_BIT;
lsa_prefix.u.ptr = (uintptr_t)lsa; lsa_prefix.u.ptr = (uintptr_t)lsa;
@ -3865,8 +3865,7 @@ struct ospf_lsa *ospf_lsa_refresh(struct ospf *ospf, struct ospf_lsa *lsa)
if (aggr) { if (aggr) {
struct external_info ei_aggr; struct external_info ei_aggr;
memset(&ei_aggr, 0, memset(&ei_aggr, 0, sizeof(ei_aggr));
sizeof(struct external_info));
ei_aggr.p = aggr->p; ei_aggr.p = aggr->p;
ei_aggr.tag = aggr->tag; ei_aggr.tag = aggr->tag;
ei_aggr.instance = ospf->instance; ei_aggr.instance = ospf->instance;

View File

@ -198,7 +198,7 @@ struct ospf_lsa *ospf_lsdb_lookup_by_id(struct ospf_lsdb *lsdb, uint8_t type,
table = lsdb->type[type].db; table = lsdb->type[type].db;
memset(&lp, 0, sizeof(struct prefix_ls)); memset(&lp, 0, sizeof(lp));
lp.family = AF_UNSPEC; lp.family = AF_UNSPEC;
lp.prefixlen = 64; lp.prefixlen = 64;
lp.id = id; lp.id = id;
@ -225,7 +225,7 @@ struct ospf_lsa *ospf_lsdb_lookup_by_id_next(struct ospf_lsdb *lsdb,
table = lsdb->type[type].db; table = lsdb->type[type].db;
memset(&lp, 0, sizeof(struct prefix_ls)); memset(&lp, 0, sizeof(lp));
lp.family = AF_UNSPEC; lp.family = AF_UNSPEC;
lp.prefixlen = 64; lp.prefixlen = 64;
lp.id = id; lp.id = id;

View File

@ -696,7 +696,7 @@ static void ospf_write(struct thread *thread)
/* reset get pointer */ /* reset get pointer */
stream_set_getp(op->s, 0); stream_set_getp(op->s, 0);
memset(&iph, 0, sizeof(struct ip)); memset(&iph, 0, sizeof(iph));
memset(&sa_dst, 0, sizeof(sa_dst)); memset(&sa_dst, 0, sizeof(sa_dst));
sa_dst.sin_family = AF_INET; sa_dst.sin_family = AF_INET;
@ -2310,7 +2310,7 @@ static struct stream *ospf_recv_packet(struct ospf *ospf, int fd,
char buff[CMSG_SPACE(SOPT_SIZE_CMSG_IFINDEX_IPV4())]; char buff[CMSG_SPACE(SOPT_SIZE_CMSG_IFINDEX_IPV4())];
struct msghdr msgh; struct msghdr msgh;
memset(&msgh, 0, sizeof(struct msghdr)); memset(&msgh, 0, sizeof(msgh));
msgh.msg_iov = &iov; msgh.msg_iov = &iov;
msgh.msg_iovlen = 1; msgh.msg_iovlen = 1;
msgh.msg_control = (caddr_t)buff; msgh.msg_control = (caddr_t)buff;

View File

@ -90,7 +90,7 @@ int ospf_router_info_init(void)
zlog_info("RI (%s): Initialize Router Information", __func__); zlog_info("RI (%s): Initialize Router Information", __func__);
memset(&OspfRI, 0, sizeof(struct ospf_router_info)); memset(&OspfRI, 0, sizeof(OspfRI));
OspfRI.enabled = false; OspfRI.enabled = false;
OspfRI.registered = 0; OspfRI.registered = 0;
OspfRI.scope = OSPF_OPAQUE_AS_LSA; OspfRI.scope = OSPF_OPAQUE_AS_LSA;

View File

@ -693,7 +693,7 @@ static uint8_t *ospfAreaEntry(struct variable *v, oid *name, size_t *length,
== MATCH_FAILED) == MATCH_FAILED)
return NULL; return NULL;
memset(&addr, 0, sizeof(struct in_addr)); memset(&addr, 0, sizeof(addr));
area = ospfAreaLookup(v, name, length, &addr, exact); area = ospfAreaLookup(v, name, length, &addr, exact);
if (!area) if (!area)
@ -821,7 +821,7 @@ static uint8_t *ospfStubAreaEntry(struct variable *v, oid *name, size_t *length,
== MATCH_FAILED) == MATCH_FAILED)
return NULL; return NULL;
memset(&addr, 0, sizeof(struct in_addr)); memset(&addr, 0, sizeof(addr));
area = ospfStubAreaLookup(v, name, length, &addr, exact); area = ospfStubAreaLookup(v, name, length, &addr, exact);
if (!area) if (!area)
@ -1044,10 +1044,10 @@ static uint8_t *ospfLsdbEntry(struct variable *v, oid *name, size_t *length,
/* INDEX { ospfLsdbAreaId, ospfLsdbType, /* INDEX { ospfLsdbAreaId, ospfLsdbType,
ospfLsdbLsid, ospfLsdbRouterId } */ ospfLsdbLsid, ospfLsdbRouterId } */
memset(&area_id, 0, sizeof(struct in_addr)); memset(&area_id, 0, sizeof(area_id));
type = 0; type = 0;
memset(&ls_id, 0, sizeof(struct in_addr)); memset(&ls_id, 0, sizeof(ls_id));
memset(&router_id, 0, sizeof(struct in_addr)); memset(&router_id, 0, sizeof(router_id));
/* Check OSPF instance. */ /* Check OSPF instance. */
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
@ -1279,7 +1279,7 @@ static uint8_t *ospfHostEntry(struct variable *v, oid *name, size_t *length,
if (ospf == NULL) if (ospf == NULL)
return NULL; return NULL;
memset(&addr, 0, sizeof(struct in_addr)); memset(&addr, 0, sizeof(addr));
nbr_nbma = ospfHostLookup(v, name, length, &addr, exact); nbr_nbma = ospfHostLookup(v, name, length, &addr, exact);
if (nbr_nbma == NULL) if (nbr_nbma == NULL)
@ -1595,7 +1595,7 @@ static uint8_t *ospfIfEntry(struct variable *v, oid *name, size_t *length,
return NULL; return NULL;
ifindex = 0; ifindex = 0;
memset(&ifaddr, 0, sizeof(struct in_addr)); memset(&ifaddr, 0, sizeof(ifaddr));
/* Check OSPF instance. */ /* Check OSPF instance. */
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
@ -1742,7 +1742,7 @@ static uint8_t *ospfIfMetricEntry(struct variable *v, oid *name, size_t *length,
return NULL; return NULL;
ifindex = 0; ifindex = 0;
memset(&ifaddr, 0, sizeof(struct in_addr)); memset(&ifaddr, 0, sizeof(ifaddr));
/* Check OSPF instance. */ /* Check OSPF instance. */
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
@ -1778,7 +1778,7 @@ static int ospf_snmp_vl_add(struct ospf_vl_data *vl_data)
struct prefix_ls lp; struct prefix_ls lp;
struct route_node *rn; struct route_node *rn;
memset(&lp, 0, sizeof(struct prefix_ls)); memset(&lp, 0, sizeof(lp));
lp.family = AF_UNSPEC; lp.family = AF_UNSPEC;
lp.prefixlen = 64; lp.prefixlen = 64;
lp.id = vl_data->vl_area_id; lp.id = vl_data->vl_area_id;
@ -1797,7 +1797,7 @@ static int ospf_snmp_vl_delete(struct ospf_vl_data *vl_data)
struct prefix_ls lp; struct prefix_ls lp;
struct route_node *rn; struct route_node *rn;
memset(&lp, 0, sizeof(struct prefix_ls)); memset(&lp, 0, sizeof(lp));
lp.family = AF_UNSPEC; lp.family = AF_UNSPEC;
lp.prefixlen = 64; lp.prefixlen = 64;
lp.id = vl_data->vl_area_id; lp.id = vl_data->vl_area_id;
@ -1819,7 +1819,7 @@ static struct ospf_vl_data *ospf_snmp_vl_lookup(struct in_addr *area_id,
struct route_node *rn; struct route_node *rn;
struct ospf_vl_data *vl_data; struct ospf_vl_data *vl_data;
memset(&lp, 0, sizeof(struct prefix_ls)); memset(&lp, 0, sizeof(lp));
lp.family = AF_UNSPEC; lp.family = AF_UNSPEC;
lp.prefixlen = 64; lp.prefixlen = 64;
lp.id = *area_id; lp.id = *area_id;
@ -1842,7 +1842,7 @@ static struct ospf_vl_data *ospf_snmp_vl_lookup_next(struct in_addr *area_id,
struct route_node *rn; struct route_node *rn;
struct ospf_vl_data *vl_data; struct ospf_vl_data *vl_data;
memset(&lp, 0, sizeof(struct prefix_ls)); memset(&lp, 0, sizeof(lp));
lp.family = AF_UNSPEC; lp.family = AF_UNSPEC;
lp.prefixlen = 64; lp.prefixlen = 64;
lp.id = *area_id; lp.id = *area_id;
@ -1927,8 +1927,8 @@ static uint8_t *ospfVirtIfEntry(struct variable *v, oid *name, size_t *length,
== MATCH_FAILED) == MATCH_FAILED)
return NULL; return NULL;
memset(&area_id, 0, sizeof(struct in_addr)); memset(&area_id, 0, sizeof(area_id));
memset(&neighbor, 0, sizeof(struct in_addr)); memset(&neighbor, 0, sizeof(neighbor));
vl_data = ospfVirtIfLookup(v, name, length, &area_id, &neighbor, exact); vl_data = ospfVirtIfLookup(v, name, length, &area_id, &neighbor, exact);
if (!vl_data) if (!vl_data)
@ -2139,7 +2139,7 @@ static uint8_t *ospfNbrEntry(struct variable *v, oid *name, size_t *length,
== MATCH_FAILED) == MATCH_FAILED)
return NULL; return NULL;
memset(&nbr_addr, 0, sizeof(struct in_addr)); memset(&nbr_addr, 0, sizeof(nbr_addr));
ifindex = 0; ifindex = 0;
nbr = ospfNbrLookup(v, name, length, &nbr_addr, &ifindex, exact); nbr = ospfNbrLookup(v, name, length, &nbr_addr, &ifindex, exact);
@ -2190,8 +2190,8 @@ static uint8_t *ospfVirtNbrEntry(struct variable *v, oid *name, size_t *length,
== MATCH_FAILED) == MATCH_FAILED)
return NULL; return NULL;
memset(&area_id, 0, sizeof(struct in_addr)); memset(&area_id, 0, sizeof(area_id));
memset(&neighbor, 0, sizeof(struct in_addr)); memset(&neighbor, 0, sizeof(neighbor));
/* Check OSPF instance. */ /* Check OSPF instance. */
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
@ -2331,8 +2331,8 @@ static uint8_t *ospfExtLsdbEntry(struct variable *v, oid *name, size_t *length,
return NULL; return NULL;
type = OSPF_AS_EXTERNAL_LSA; type = OSPF_AS_EXTERNAL_LSA;
memset(&ls_id, 0, sizeof(struct in_addr)); memset(&ls_id, 0, sizeof(ls_id));
memset(&router_id, 0, sizeof(struct in_addr)); memset(&router_id, 0, sizeof(router_id));
/* Check OSPF instance. */ /* Check OSPF instance. */
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT); ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);

View File

@ -608,7 +608,7 @@ int ospf_sr_init(void)
osr_debug("SR (%s): Initialize SR Data Base", __func__); osr_debug("SR (%s): Initialize SR Data Base", __func__);
memset(&OspfSR, 0, sizeof(struct ospf_sr_db)); memset(&OspfSR, 0, sizeof(OspfSR));
OspfSR.status = SR_OFF; OspfSR.status = SR_OFF;
/* Only AREA flooding is supported in this release */ /* Only AREA flooding is supported in this release */
OspfSR.scope = OSPF_OPAQUE_AREA_LSA; OspfSR.scope = OSPF_OPAQUE_AREA_LSA;

View File

@ -159,7 +159,7 @@ int ospf_mpls_te_init(void)
return rc; return rc;
} }
memset(&OspfMplsTE, 0, sizeof(struct ospf_mpls_te)); memset(&OspfMplsTE, 0, sizeof(OspfMplsTE));
OspfMplsTE.enabled = false; OspfMplsTE.enabled = false;
OspfMplsTE.export = false; OspfMplsTE.export = false;
OspfMplsTE.inter_as = Off; OspfMplsTE.inter_as = Off;

View File

@ -1253,7 +1253,7 @@ static int ospf_zebra_gr_update(struct ospf *ospf, int command,
if (!zclient || zclient->sock < 0 || !ospf) if (!zclient || zclient->sock < 0 || !ospf)
return 1; return 1;
memset(&api, 0, sizeof(struct zapi_cap)); memset(&api, 0, sizeof(api));
api.cap = command; api.cap = command;
api.stale_removal_time = stale_time; api.stale_removal_time = stale_time;
api.vrf_id = ospf->vrf_id; api.vrf_id = ospf->vrf_id;

View File

@ -2114,7 +2114,7 @@ int ospf_nbr_nbma_poll_interval_unset(struct ospf *ospf, struct in_addr addr)
void ospf_master_init(struct thread_master *master) void ospf_master_init(struct thread_master *master)
{ {
memset(&ospf_master, 0, sizeof(struct ospf_master)); memset(&ospf_master, 0, sizeof(ospf_master));
om = &ospf_master; om = &ospf_master;
om->ospf = list_new(); om->ospf = list_new();

View File

@ -1027,7 +1027,7 @@ static int path_pcep_cli_pcc_pcc_peer(struct vty *vty, const char *peer_name,
/* Verify the PCE has the IP set */ /* Verify the PCE has the IP set */
struct in6_addr zero_v6_addr; struct in6_addr zero_v6_addr;
memset(&zero_v6_addr, 0, sizeof(struct in6_addr)); memset(&zero_v6_addr, 0, sizeof(zero_v6_addr));
if (memcmp(&pce_opts->addr.ip, &zero_v6_addr, IPADDRSZ(&pce_opts->addr)) if (memcmp(&pce_opts->addr.ip, &zero_v6_addr, IPADDRSZ(&pce_opts->addr))
== 0) { == 0) {
vty_out(vty, vty_out(vty,

View File

@ -215,7 +215,7 @@ void handle_signal_action(int sig_number)
int setup_signals() int setup_signals()
{ {
struct sigaction sa; struct sigaction sa;
memset(&sa, 0, sizeof(struct sigaction)); memset(&sa, 0, sizeof(sa));
sa.sa_handler = handle_signal_action; sa.sa_handler = handle_signal_action;
if (sigaction(SIGINT, &sa, 0) != 0) { if (sigaction(SIGINT, &sa, 0) != 0) {
perror("sigaction()"); perror("sigaction()");

View File

@ -114,7 +114,7 @@ static struct pim_nexthop_cache *pim_nht_get(struct pim_instance *pim,
struct zclient *zclient = NULL; struct zclient *zclient = NULL;
zclient = pim_zebra_zclient_get(); zclient = pim_zebra_zclient_get();
memset(&rpf, 0, sizeof(struct pim_rpf)); memset(&rpf, 0, sizeof(rpf));
rpf.rpf_addr = *addr; rpf.rpf_addr = *addr;
pnc = pim_nexthop_cache_find(pim, &rpf); pnc = pim_nexthop_cache_find(pim, &rpf);

View File

@ -305,7 +305,7 @@ void pim_null_register_send(struct pim_upstream *up)
return; return;
} }
memset(&ip_hdr, 0, sizeof(struct ip)); memset(&ip_hdr, 0, sizeof(ip_hdr));
ip_hdr.ip_p = PIM_IP_PROTO_PIM; ip_hdr.ip_p = PIM_IP_PROTO_PIM;
ip_hdr.ip_hl = 5; ip_hdr.ip_hl = 5;
ip_hdr.ip_v = 4; ip_hdr.ip_v = 4;

View File

@ -360,7 +360,7 @@ int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
*tolen = sizeof(*to); *tolen = sizeof(*to);
} }
memset(&msgh, 0, sizeof(struct msghdr)); memset(&msgh, 0, sizeof(msgh));
iov.iov_base = buf; iov.iov_base = buf;
iov.iov_len = len; iov.iov_len = len;
msgh.msg_control = cbuf; msgh.msg_control = cbuf;

View File

@ -929,7 +929,7 @@ int rip_neighbor_lookup(struct rip *rip, struct sockaddr_in *from)
struct prefix_ipv4 p; struct prefix_ipv4 p;
struct route_node *node; struct route_node *node;
memset(&p, 0, sizeof(struct prefix_ipv4)); memset(&p, 0, sizeof(p));
p.family = AF_INET; p.family = AF_INET;
p.prefix = from->sin_addr; p.prefix = from->sin_addr;
p.prefixlen = IPV4_MAX_BITLEN; p.prefixlen = IPV4_MAX_BITLEN;

View File

@ -132,7 +132,7 @@ int ripd_instance_default_information_originate_modify(
rip = nb_running_get_entry(args->dnode, NULL, true); rip = nb_running_get_entry(args->dnode, NULL, true);
default_information = yang_dnode_get_bool(args->dnode, NULL); default_information = yang_dnode_get_bool(args->dnode, NULL);
memset(&p, 0, sizeof(struct prefix_ipv4)); memset(&p, 0, sizeof(p));
p.family = AF_INET; p.family = AF_INET;
if (default_information) { if (default_information) {
struct nexthop nh; struct nexthop nh;

View File

@ -356,7 +356,7 @@ static uint8_t *rip2IfStatEntry(struct variable *v, oid name[], size_t *length,
== MATCH_FAILED) == MATCH_FAILED)
return NULL; return NULL;
memset(&addr, 0, sizeof(struct in_addr)); memset(&addr, 0, sizeof(addr));
/* Lookup interface. */ /* Lookup interface. */
ifp = rip2IfLookup(v, name, length, &addr, exact); ifp = rip2IfLookup(v, name, length, &addr, exact);
@ -457,7 +457,7 @@ static uint8_t *rip2IfConfAddress(struct variable *v, oid name[],
== MATCH_FAILED) == MATCH_FAILED)
return NULL; return NULL;
memset(&addr, 0, sizeof(struct in_addr)); memset(&addr, 0, sizeof(addr));
/* Lookup interface. */ /* Lookup interface. */
ifp = rip2IfLookup(v, name, length, &addr, exact); ifp = rip2IfLookup(v, name, length, &addr, exact);
@ -529,7 +529,7 @@ static uint8_t *rip2PeerTable(struct variable *v, oid name[], size_t *length,
== MATCH_FAILED) == MATCH_FAILED)
return NULL; return NULL;
memset(&addr, 0, sizeof(struct in_addr)); memset(&addr, 0, sizeof(addr));
/* Lookup interface. */ /* Lookup interface. */
peer = rip2PeerLookup(v, name, length, &addr, exact); peer = rip2PeerLookup(v, name, length, &addr, exact);

View File

@ -1287,10 +1287,9 @@ static void rip_response_process(struct rip_packet *packet, int size,
uint32_t destination; uint32_t destination;
if (subnetted == -1) { if (subnetted == -1) {
memcpy(&ifaddr, ifc->address, memcpy(&ifaddr, ifc->address, sizeof(ifaddr));
sizeof(struct prefix_ipv4));
memcpy(&ifaddrclass, &ifaddr, memcpy(&ifaddrclass, &ifaddr,
sizeof(struct prefix_ipv4)); sizeof(ifaddrclass));
apply_classful_mask_ipv4(&ifaddrclass); apply_classful_mask_ipv4(&ifaddrclass);
subnetted = 0; subnetted = 0;
if (ifaddr.prefixlen > ifaddrclass.prefixlen) if (ifaddr.prefixlen > ifaddrclass.prefixlen)
@ -1476,7 +1475,7 @@ static int rip_send_packet(uint8_t *buf, int size, struct sockaddr_in *to,
} }
/* Make destination address. */ /* Make destination address. */
memset(&sin, 0, sizeof(struct sockaddr_in)); memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET; sin.sin_family = AF_INET;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
sin.sin_len = sizeof(struct sockaddr_in); sin.sin_len = sizeof(struct sockaddr_in);
@ -1544,7 +1543,7 @@ void rip_redistribute_add(struct rip *rip, int type, int sub_type,
rp = route_node_get(rip->table, (struct prefix *)p); rp = route_node_get(rip->table, (struct prefix *)p);
memset(&newinfo, 0, sizeof(struct rip_info)); memset(&newinfo, 0, sizeof(newinfo));
newinfo.type = type; newinfo.type = type;
newinfo.sub_type = sub_type; newinfo.sub_type = sub_type;
newinfo.metric = 1; newinfo.metric = 1;
@ -1738,7 +1737,7 @@ static void rip_read(struct thread *t)
rip_event(rip, RIP_READ, sock); rip_event(rip, RIP_READ, sock);
/* RIPd manages only IPv4. */ /* RIPd manages only IPv4. */
memset(&from, 0, sizeof(struct sockaddr_in)); memset(&from, 0, sizeof(from));
fromlen = sizeof(struct sockaddr_in); fromlen = sizeof(struct sockaddr_in);
len = recvfrom(sock, (char *)&rip_buf.buf, sizeof(rip_buf.buf), 0, len = recvfrom(sock, (char *)&rip_buf.buf, sizeof(rip_buf.buf), 0,
@ -2103,7 +2102,7 @@ void rip_output_process(struct connected *ifc, struct sockaddr_in *to,
} }
if (version == RIPv1) { if (version == RIPv1) {
memcpy(&ifaddrclass, ifc->address, sizeof(struct prefix_ipv4)); memcpy(&ifaddrclass, ifc->address, sizeof(ifaddrclass));
apply_classful_mask_ipv4(&ifaddrclass); apply_classful_mask_ipv4(&ifaddrclass);
subnetted = 0; subnetted = 0;
if (ifc->address->prefixlen > ifaddrclass.prefixlen) if (ifc->address->prefixlen > ifaddrclass.prefixlen)
@ -2385,7 +2384,7 @@ static void rip_update_interface(struct connected *ifc, uint8_t version,
if (if_is_broadcast(ifp) || if_is_pointopoint(ifp)) { if (if_is_broadcast(ifp) || if_is_pointopoint(ifp)) {
if (ifc->address->family == AF_INET) { if (ifc->address->family == AF_INET) {
/* Destination address and port setting. */ /* Destination address and port setting. */
memset(&to, 0, sizeof(struct sockaddr_in)); memset(&to, 0, sizeof(to));
if (ifc->destination) if (ifc->destination)
/* use specified broadcast or peer destination /* use specified broadcast or peer destination
* addr */ * addr */
@ -2834,7 +2833,7 @@ uint8_t rip_distance_apply(struct rip *rip, struct rip_info *rinfo)
struct rip_distance *rdistance; struct rip_distance *rdistance;
struct access_list *alist; struct access_list *alist;
memset(&p, 0, sizeof(struct prefix_ipv4)); memset(&p, 0, sizeof(p));
p.family = AF_INET; p.family = AF_INET;
p.prefix = rinfo->from; p.prefix = rinfo->from;
p.prefixlen = IPV4_MAX_BITLEN; p.prefixlen = IPV4_MAX_BITLEN;

View File

@ -196,7 +196,7 @@ int ripng_send_packet(caddr_t buf, int bufsize, struct sockaddr_in6 *to,
zlog_debug(" send packet size %d", bufsize); zlog_debug(" send packet size %d", bufsize);
} }
memset(&addr, 0, sizeof(struct sockaddr_in6)); memset(&addr, 0, sizeof(addr));
addr.sin6_family = AF_INET6; addr.sin6_family = AF_INET6;
#ifdef SIN6_LEN #ifdef SIN6_LEN
addr.sin6_len = sizeof(struct sockaddr_in6); addr.sin6_len = sizeof(struct sockaddr_in6);
@ -259,7 +259,7 @@ static int ripng_recv_packet(int sock, uint8_t *buf, int bufsize,
struct cmsghdr *cmsgptr; struct cmsghdr *cmsgptr;
struct in6_addr dst = {.s6_addr = {0}}; struct in6_addr dst = {.s6_addr = {0}};
memset(&dst, 0, sizeof(struct in6_addr)); memset(&dst, 0, sizeof(dst));
/* Ancillary data. This store cmsghdr and in6_pktinfo. But at this /* Ancillary data. This store cmsghdr and in6_pktinfo. But at this
point I can't determine size of cmsghdr */ point I can't determine size of cmsghdr */
@ -940,7 +940,7 @@ void ripng_redistribute_add(struct ripng *ripng, int type, int sub_type,
rp = agg_node_get(ripng->table, (struct prefix *)p); rp = agg_node_get(ripng->table, (struct prefix *)p);
memset(&newinfo, 0, sizeof(struct ripng_info)); memset(&newinfo, 0, sizeof(newinfo));
newinfo.type = type; newinfo.type = type;
newinfo.sub_type = sub_type; newinfo.sub_type = sub_type;
newinfo.ifindex = ifindex; newinfo.ifindex = ifindex;
@ -1145,7 +1145,7 @@ static void ripng_response_process(struct ripng_packet *packet, int size,
ripng_peer_update(ripng, from, packet->version); ripng_peer_update(ripng, from, packet->version);
/* Reset nexthop. */ /* Reset nexthop. */
memset(&nexthop, 0, sizeof(struct ripng_nexthop)); memset(&nexthop, 0, sizeof(nexthop));
nexthop.flag = RIPNG_NEXTHOP_UNSPEC; nexthop.flag = RIPNG_NEXTHOP_UNSPEC;
/* Set RTE pointer. */ /* Set RTE pointer. */
@ -1272,7 +1272,7 @@ static void ripng_request_process(struct ripng_packet *packet, int size,
field. Once all the entries have been filled in, change the field. Once all the entries have been filled in, change the
command from Request to Response and send the datagram back command from Request to Response and send the datagram back
to the requestor. */ to the requestor. */
memset(&p, 0, sizeof(struct prefix_ipv6)); memset(&p, 0, sizeof(p));
p.family = AF_INET6; p.family = AF_INET6;
for (; ((caddr_t)rte) < lim; rte++) { for (; ((caddr_t)rte) < lim; rte++) {

View File

@ -0,0 +1,21 @@
//
@@
identifier src, dst;
identifier str, len;
type t =~ "struct";
@@
(
- memset(&dst, 0, sizeof(t));
+ memset(&dst, 0, sizeof(dst));
|
- memcpy(&dst, &src, sizeof(t));
+ memcpy(&dst, &src, sizeof(dst));
|
- char str[...];
...
- memset(&str, 0, ...);
+ memset(&str, 0, sizeof(str));
)

View File

@ -4119,7 +4119,7 @@ static int vtysh_connect(struct vtysh_client *vclient)
return -1; return -1;
} }
memset(&addr, 0, sizeof(struct sockaddr_un)); memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
strlcpy(addr.sun_path, path, sizeof(addr.sun_path)); strlcpy(addr.sun_path, path, sizeof(addr.sun_path));
#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN #ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN

View File

@ -798,7 +798,7 @@ static int try_connect(struct daemon *dmn)
zlog_debug("%s: attempting to connect", dmn->name); zlog_debug("%s: attempting to connect", dmn->name);
dmn->connect_tries++; dmn->connect_tries++;
memset(&addr, 0, sizeof(struct sockaddr_un)); memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s.vty", gs.vtydir, snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s.vty", gs.vtydir,
dmn->name); dmn->name);

View File

@ -512,14 +512,14 @@ void connected_delete_ipv4(struct interface *ifp, int flags,
struct prefix p, d; struct prefix p, d;
struct connected *ifc; struct connected *ifc;
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
p.family = AF_INET; p.family = AF_INET;
p.u.prefix4 = *addr; p.u.prefix4 = *addr;
p.prefixlen = p.prefixlen =
CHECK_FLAG(flags, ZEBRA_IFA_PEER) ? IPV4_MAX_BITLEN : prefixlen; CHECK_FLAG(flags, ZEBRA_IFA_PEER) ? IPV4_MAX_BITLEN : prefixlen;
if (dest) { if (dest) {
memset(&d, 0, sizeof(struct prefix)); memset(&d, 0, sizeof(d));
d.family = AF_INET; d.family = AF_INET;
d.u.prefix4 = *dest; d.u.prefix4 = *dest;
d.prefixlen = prefixlen; d.prefixlen = prefixlen;
@ -603,7 +603,7 @@ void connected_delete_ipv6(struct interface *ifp,
struct prefix p, d; struct prefix p, d;
struct connected *ifc; struct connected *ifc;
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
p.family = AF_INET6; p.family = AF_INET6;
memcpy(&p.u.prefix6, address, sizeof(struct in6_addr)); memcpy(&p.u.prefix6, address, sizeof(struct in6_addr));
p.prefixlen = prefixlen; p.prefixlen = prefixlen;
@ -613,7 +613,7 @@ void connected_delete_ipv6(struct interface *ifp,
rtadv_delete_prefix(ifp->info, &p); rtadv_delete_prefix(ifp->info, &p);
if (dest) { if (dest) {
memset(&d, 0, sizeof(struct prefix)); memset(&d, 0, sizeof(d));
d.family = AF_INET6; d.family = AF_INET6;
IPV6_ADDR_COPY(&d.u.prefix6, dest); IPV6_ADDR_COPY(&d.u.prefix6, dest);
d.prefixlen = prefixlen; d.prefixlen = prefixlen;

View File

@ -242,7 +242,7 @@ static int if_set_prefix_ctx(const struct zebra_dplane_ctx *ctx)
strlcpy((char *)&addreq.ifra_name, dplane_ctx_get_ifname(ctx), strlcpy((char *)&addreq.ifra_name, dplane_ctx_get_ifname(ctx),
sizeof(addreq.ifra_name)); sizeof(addreq.ifra_name));
memset(&addr, 0, sizeof(struct sockaddr_in)); memset(&addr, 0, sizeof(addr));
addr.sin_addr = p->prefix; addr.sin_addr = p->prefix;
addr.sin_family = p->family; addr.sin_family = p->family;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
@ -252,7 +252,7 @@ static int if_set_prefix_ctx(const struct zebra_dplane_ctx *ctx)
if (dplane_ctx_intf_is_connected(ctx)) { if (dplane_ctx_intf_is_connected(ctx)) {
p = (struct prefix_ipv4 *)dplane_ctx_get_intf_dest(ctx); p = (struct prefix_ipv4 *)dplane_ctx_get_intf_dest(ctx);
memset(&mask, 0, sizeof(struct sockaddr_in)); memset(&mask, 0, sizeof(mask));
peer.sin_addr = p->prefix; peer.sin_addr = p->prefix;
peer.sin_family = p->family; peer.sin_family = p->family;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
@ -262,7 +262,7 @@ static int if_set_prefix_ctx(const struct zebra_dplane_ctx *ctx)
sizeof(struct sockaddr_in)); sizeof(struct sockaddr_in));
} }
memset(&mask, 0, sizeof(struct sockaddr_in)); memset(&mask, 0, sizeof(mask));
masklen2ip(p->prefixlen, &mask.sin_addr); masklen2ip(p->prefixlen, &mask.sin_addr);
mask.sin_family = p->family; mask.sin_family = p->family;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
@ -293,7 +293,7 @@ static int if_unset_prefix_ctx(const struct zebra_dplane_ctx *ctx)
strlcpy((char *)&addreq.ifra_name, dplane_ctx_get_ifname(ctx), strlcpy((char *)&addreq.ifra_name, dplane_ctx_get_ifname(ctx),
sizeof(addreq.ifra_name)); sizeof(addreq.ifra_name));
memset(&addr, 0, sizeof(struct sockaddr_in)); memset(&addr, 0, sizeof(addr));
addr.sin_addr = p->prefix; addr.sin_addr = p->prefix;
addr.sin_family = p->family; addr.sin_family = p->family;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
@ -303,7 +303,7 @@ static int if_unset_prefix_ctx(const struct zebra_dplane_ctx *ctx)
if (dplane_ctx_intf_is_connected(ctx)) { if (dplane_ctx_intf_is_connected(ctx)) {
p = (struct prefix_ipv4 *)dplane_ctx_get_intf_dest(ctx); p = (struct prefix_ipv4 *)dplane_ctx_get_intf_dest(ctx);
memset(&mask, 0, sizeof(struct sockaddr_in)); memset(&mask, 0, sizeof(mask));
peer.sin_addr = p->prefix; peer.sin_addr = p->prefix;
peer.sin_family = p->family; peer.sin_family = p->family;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
@ -313,7 +313,7 @@ static int if_unset_prefix_ctx(const struct zebra_dplane_ctx *ctx)
sizeof(struct sockaddr_in)); sizeof(struct sockaddr_in));
} }
memset(&mask, 0, sizeof(struct sockaddr_in)); memset(&mask, 0, sizeof(mask));
masklen2ip(p->prefixlen, &mask.sin_addr); masklen2ip(p->prefixlen, &mask.sin_addr);
mask.sin_family = p->family; mask.sin_family = p->family;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
@ -394,7 +394,7 @@ int if_unset_prefix_ctx(const struct zebra_dplane_ctx *ctx)
strlcpy(ifreq.ifr_name, dplane_ctx_get_ifname(ctx), strlcpy(ifreq.ifr_name, dplane_ctx_get_ifname(ctx),
sizeof(ifreq.ifr_name)); sizeof(ifreq.ifr_name));
memset(&addr, 0, sizeof(struct sockaddr_in)); memset(&addr, 0, sizeof(addr));
addr.sin_family = p->family; addr.sin_family = p->family;
memcpy(&ifreq.ifr_addr, &addr, sizeof(struct sockaddr_in)); memcpy(&ifreq.ifr_addr, &addr, sizeof(struct sockaddr_in));
ret = if_ioctl(SIOCSIFADDR, (caddr_t)&ifreq); ret = if_ioctl(SIOCSIFADDR, (caddr_t)&ifreq);
@ -508,7 +508,7 @@ int if_set_flags(struct interface *ifp, uint64_t flags)
int ret; int ret;
struct ifreq ifreq; struct ifreq ifreq;
memset(&ifreq, 0, sizeof(struct ifreq)); memset(&ifreq, 0, sizeof(ifreq));
ifreq_set_name(&ifreq, ifp); ifreq_set_name(&ifreq, ifp);
ifreq.ifr_flags = ifp->flags; ifreq.ifr_flags = ifp->flags;
@ -529,7 +529,7 @@ int if_unset_flags(struct interface *ifp, uint64_t flags)
int ret; int ret;
struct ifreq ifreq; struct ifreq ifreq;
memset(&ifreq, 0, sizeof(struct ifreq)); memset(&ifreq, 0, sizeof(ifreq));
ifreq_set_name(&ifreq, ifp); ifreq_set_name(&ifreq, ifp);
ifreq.ifr_flags = ifp->flags; ifreq.ifr_flags = ifp->flags;
@ -568,7 +568,7 @@ static int if_set_prefix6_ctx(const struct zebra_dplane_ctx *ctx)
strlcpy((char *)&addreq.ifra_name, strlcpy((char *)&addreq.ifra_name,
dplane_ctx_get_ifname(ctx), sizeof(addreq.ifra_name)); dplane_ctx_get_ifname(ctx), sizeof(addreq.ifra_name));
memset(&addr, 0, sizeof(struct sockaddr_in6)); memset(&addr, 0, sizeof(addr));
addr.sin6_addr = p->prefix; addr.sin6_addr = p->prefix;
addr.sin6_family = p->family; addr.sin6_family = p->family;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
@ -576,7 +576,7 @@ static int if_set_prefix6_ctx(const struct zebra_dplane_ctx *ctx)
#endif #endif
memcpy(&addreq.ifra_addr, &addr, sizeof(struct sockaddr_in6)); memcpy(&addreq.ifra_addr, &addr, sizeof(struct sockaddr_in6));
memset(&mask, 0, sizeof(struct sockaddr_in6)); memset(&mask, 0, sizeof(mask));
masklen2ip6(p->prefixlen, &mask.sin6_addr); masklen2ip6(p->prefixlen, &mask.sin6_addr);
mask.sin6_family = p->family; mask.sin6_family = p->family;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
@ -615,7 +615,7 @@ static int if_unset_prefix6_ctx(const struct zebra_dplane_ctx *ctx)
strlcpy((char *)&addreq.ifra_name, strlcpy((char *)&addreq.ifra_name,
dplane_ctx_get_ifname(ctx), sizeof(addreq.ifra_name)); dplane_ctx_get_ifname(ctx), sizeof(addreq.ifra_name));
memset(&addr, 0, sizeof(struct sockaddr_in6)); memset(&addr, 0, sizeof(addr));
addr.sin6_addr = p->prefix; addr.sin6_addr = p->prefix;
addr.sin6_family = p->family; addr.sin6_family = p->family;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
@ -623,7 +623,7 @@ static int if_unset_prefix6_ctx(const struct zebra_dplane_ctx *ctx)
#endif #endif
memcpy(&addreq.ifra_addr, &addr, sizeof(struct sockaddr_in6)); memcpy(&addreq.ifra_addr, &addr, sizeof(struct sockaddr_in6));
memset(&mask, 0, sizeof(struct sockaddr_in6)); memset(&mask, 0, sizeof(mask));
masklen2ip6(p->prefixlen, &mask.sin6_addr); masklen2ip6(p->prefixlen, &mask.sin6_addr);
mask.sin6_family = p->family; mask.sin6_family = p->family;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN

View File

@ -1156,7 +1156,7 @@ int rtm_write(int message, union sockunion *dest, union sockunion *mask,
return ZEBRA_ERR_EPERM; return ZEBRA_ERR_EPERM;
/* Clear and set rt_msghdr values */ /* Clear and set rt_msghdr values */
memset(&msg, 0, sizeof(struct rt_msghdr)); memset(&msg, 0, sizeof(msg));
msg.rtm.rtm_version = RTM_VERSION; msg.rtm.rtm_version = RTM_VERSION;
msg.rtm.rtm_type = message; msg.rtm.rtm_type = message;
msg.rtm.rtm_seq = msg_seq++; msg.rtm.rtm_seq = msg_seq++;

View File

@ -3783,7 +3783,7 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
return 0; return 0;
} }
memset(&ip, 0, sizeof(struct ipaddr)); memset(&ip, 0, sizeof(ip));
ip.ipa_type = (ndm->ndm_family == AF_INET) ? IPADDR_V4 : IPADDR_V6; ip.ipa_type = (ndm->ndm_family == AF_INET) ? IPADDR_V4 : IPADDR_V6;
memcpy(&ip.ip.addr, RTA_DATA(tb[NDA_DST]), RTA_PAYLOAD(tb[NDA_DST])); memcpy(&ip.ip.addr, RTA_DATA(tb[NDA_DST]), RTA_PAYLOAD(tb[NDA_DST]));
@ -3863,7 +3863,7 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
return 0; return 0;
} }
memset(&mac, 0, sizeof(struct ethaddr)); memset(&mac, 0, sizeof(mac));
if (h->nlmsg_type == RTM_NEWNEIGH) { if (h->nlmsg_type == RTM_NEWNEIGH) {
if (tb[NDA_LLADDR]) { if (tb[NDA_LLADDR]) {
if (RTA_PAYLOAD(tb[NDA_LLADDR]) != ETH_ALEN) { if (RTA_PAYLOAD(tb[NDA_LLADDR]) != ETH_ALEN) {

View File

@ -2847,7 +2847,7 @@ static int if_join_all_router(int sock, struct interface *ifp)
struct ipv6_mreq mreq; struct ipv6_mreq mreq;
memset(&mreq, 0, sizeof(struct ipv6_mreq)); memset(&mreq, 0, sizeof(mreq));
inet_pton(AF_INET6, ALLROUTER, &mreq.ipv6mr_multiaddr); inet_pton(AF_INET6, ALLROUTER, &mreq.ipv6mr_multiaddr);
mreq.ipv6mr_interface = ifp->ifindex; mreq.ipv6mr_interface = ifp->ifindex;
@ -2873,7 +2873,7 @@ static int if_leave_all_router(int sock, struct interface *ifp)
struct ipv6_mreq mreq; struct ipv6_mreq mreq;
memset(&mreq, 0, sizeof(struct ipv6_mreq)); memset(&mreq, 0, sizeof(mreq));
inet_pton(AF_INET6, ALLROUTER, &mreq.ipv6mr_multiaddr); inet_pton(AF_INET6, ALLROUTER, &mreq.ipv6mr_multiaddr);
mreq.ipv6mr_interface = ifp->ifindex; mreq.ipv6mr_interface = ifp->ifindex;

View File

@ -1592,7 +1592,7 @@ static struct nexthop *nexthop_from_zapi(const struct zapi_nexthop *api_nh,
* the nexthop and associated MAC need to be installed. * the nexthop and associated MAC need to be installed.
*/ */
if (CHECK_FLAG(flags, ZEBRA_FLAG_EVPN_ROUTE)) { if (CHECK_FLAG(flags, ZEBRA_FLAG_EVPN_ROUTE)) {
memset(&vtep_ip, 0, sizeof(struct ipaddr)); memset(&vtep_ip, 0, sizeof(vtep_ip));
vtep_ip.ipa_type = IPADDR_V4; vtep_ip.ipa_type = IPADDR_V4;
memcpy(&(vtep_ip.ipaddr_v4), &(api_nh->gate.ipv4), memcpy(&(vtep_ip.ipaddr_v4), &(api_nh->gate.ipv4),
sizeof(struct in_addr)); sizeof(struct in_addr));
@ -1625,7 +1625,7 @@ static struct nexthop *nexthop_from_zapi(const struct zapi_nexthop *api_nh,
* the nexthop and associated MAC need to be installed. * the nexthop and associated MAC need to be installed.
*/ */
if (CHECK_FLAG(flags, ZEBRA_FLAG_EVPN_ROUTE)) { if (CHECK_FLAG(flags, ZEBRA_FLAG_EVPN_ROUTE)) {
memset(&vtep_ip, 0, sizeof(struct ipaddr)); memset(&vtep_ip, 0, sizeof(vtep_ip));
vtep_ip.ipa_type = IPADDR_V6; vtep_ip.ipa_type = IPADDR_V6;
memcpy(&vtep_ip.ipaddr_v6, &(api_nh->gate.ipv6), memcpy(&vtep_ip.ipaddr_v6, &(api_nh->gate.ipv6),
sizeof(struct in6_addr)); sizeof(struct in6_addr));

View File

@ -1000,7 +1000,7 @@ struct zebra_evpn *zebra_evpn_lookup(vni_t vni)
zvrf = zebra_vrf_get_evpn(); zvrf = zebra_vrf_get_evpn();
assert(zvrf); assert(zvrf);
memset(&tmp_vni, 0, sizeof(struct zebra_evpn)); memset(&tmp_vni, 0, sizeof(tmp_vni));
tmp_vni.vni = vni; tmp_vni.vni = vni;
zevpn = hash_lookup(zvrf->evpn_table, &tmp_vni); zevpn = hash_lookup(zvrf->evpn_table, &tmp_vni);
@ -1019,7 +1019,7 @@ struct zebra_evpn *zebra_evpn_add(vni_t vni)
zvrf = zebra_vrf_get_evpn(); zvrf = zebra_vrf_get_evpn();
assert(zvrf); assert(zvrf);
memset(&tmp_zevpn, 0, sizeof(struct zebra_evpn)); memset(&tmp_zevpn, 0, sizeof(tmp_zevpn));
tmp_zevpn.vni = vni; tmp_zevpn.vni = vni;
zevpn = hash_get(zvrf->evpn_table, &tmp_zevpn, zebra_evpn_alloc); zevpn = hash_get(zvrf->evpn_table, &tmp_zevpn, zebra_evpn_alloc);

View File

@ -1102,7 +1102,7 @@ struct zebra_mac *zebra_evpn_mac_add(struct zebra_evpn *zevpn,
struct zebra_mac tmp_mac; struct zebra_mac tmp_mac;
struct zebra_mac *mac = NULL; struct zebra_mac *mac = NULL;
memset(&tmp_mac, 0, sizeof(struct zebra_mac)); memset(&tmp_mac, 0, sizeof(tmp_mac));
memcpy(&tmp_mac.macaddr, macaddr, ETH_ALEN); memcpy(&tmp_mac.macaddr, macaddr, ETH_ALEN);
mac = hash_get(zevpn->mac_table, &tmp_mac, zebra_evpn_mac_alloc); mac = hash_get(zevpn->mac_table, &tmp_mac, zebra_evpn_mac_alloc);
@ -1255,7 +1255,7 @@ void zebra_evpn_mac_del_all(struct zebra_evpn *zevpn, int uninstall,
if (!zevpn->mac_table) if (!zevpn->mac_table)
return; return;
memset(&wctx, 0, sizeof(struct mac_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
wctx.uninstall = uninstall; wctx.uninstall = uninstall;
wctx.upd_client = upd_client; wctx.upd_client = upd_client;
@ -1930,7 +1930,7 @@ void zebra_evpn_send_mac_list_to_client(struct zebra_evpn *zevpn)
if (!zevpn->mac_table) if (!zevpn->mac_table)
return; return;
memset(&wctx, 0, sizeof(struct mac_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
hash_iterate(zevpn->mac_table, zebra_evpn_send_mac_hash_entry_to_client, hash_iterate(zevpn->mac_table, zebra_evpn_send_mac_hash_entry_to_client,

View File

@ -550,7 +550,7 @@ static struct zebra_neigh *zebra_evpn_neigh_add(struct zebra_evpn *zevpn,
struct zebra_neigh tmp_n; struct zebra_neigh tmp_n;
struct zebra_neigh *n = NULL; struct zebra_neigh *n = NULL;
memset(&tmp_n, 0, sizeof(struct zebra_neigh)); memset(&tmp_n, 0, sizeof(tmp_n));
memcpy(&tmp_n.ip, ip, sizeof(struct ipaddr)); memcpy(&tmp_n.ip, ip, sizeof(struct ipaddr));
n = hash_get(zevpn->neigh_table, &tmp_n, zebra_evpn_neigh_alloc); n = hash_get(zevpn->neigh_table, &tmp_n, zebra_evpn_neigh_alloc);
@ -881,7 +881,7 @@ void zebra_evpn_neigh_del_all(struct zebra_evpn *zevpn, int uninstall,
if (!zevpn->neigh_table) if (!zevpn->neigh_table)
return; return;
memset(&wctx, 0, sizeof(struct neigh_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
wctx.uninstall = uninstall; wctx.uninstall = uninstall;
wctx.upd_client = upd_client; wctx.upd_client = upd_client;
@ -1653,7 +1653,7 @@ void zebra_evpn_send_neigh_to_client(struct zebra_evpn *zevpn)
{ {
struct neigh_walk_ctx wctx; struct neigh_walk_ctx wctx;
memset(&wctx, 0, sizeof(struct neigh_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
hash_iterate(zevpn->neigh_table, hash_iterate(zevpn->neigh_table,

View File

@ -1573,7 +1573,7 @@ static int zfpm_trigger_rmac_update(struct zebra_mac *rmac,
vxlan_if = zl3vni_map_to_vxlan_if(zl3vni); vxlan_if = zl3vni_map_to_vxlan_if(zl3vni);
svi_if = zl3vni_map_to_svi_if(zl3vni); svi_if = zl3vni_map_to_svi_if(zl3vni);
memset(&key, 0, sizeof(struct fpm_mac_info_t)); memset(&key, 0, sizeof(key));
memcpy(&key.macaddr, &rmac->macaddr, ETH_ALEN); memcpy(&key.macaddr, &rmac->macaddr, ETH_ALEN);
key.vni = zl3vni->vni; key.vni = zl3vni->vni;

View File

@ -612,7 +612,7 @@ static int nhlfe_nexthop_active_ipv4(struct zebra_nhlfe *nhlfe,
return 0; return 0;
/* Lookup nexthop in IPv4 routing table. */ /* Lookup nexthop in IPv4 routing table. */
memset(&p, 0, sizeof(struct prefix_ipv4)); memset(&p, 0, sizeof(p));
p.family = AF_INET; p.family = AF_INET;
p.prefixlen = IPV4_MAX_BITLEN; p.prefixlen = IPV4_MAX_BITLEN;
p.prefix = nexthop->gate.ipv4; p.prefix = nexthop->gate.ipv4;
@ -661,7 +661,7 @@ static int nhlfe_nexthop_active_ipv6(struct zebra_nhlfe *nhlfe,
return 0; return 0;
/* Lookup nexthop in IPv6 routing table. */ /* Lookup nexthop in IPv6 routing table. */
memset(&p, 0, sizeof(struct prefix_ipv6)); memset(&p, 0, sizeof(p));
p.family = AF_INET6; p.family = AF_INET6;
p.prefixlen = IPV6_MAX_BITLEN; p.prefixlen = IPV6_MAX_BITLEN;
p.prefix = nexthop->gate.ipv6; p.prefix = nexthop->gate.ipv6;

View File

@ -206,7 +206,7 @@ static int zebra_mpls_bind(struct vty *vty, int add_cmd, const char *prefix,
return CMD_WARNING_CONFIG_FAILED; return CMD_WARNING_CONFIG_FAILED;
} }
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
ret = str2prefix(prefix, &p); ret = str2prefix(prefix, &p);
if (ret <= 0) { if (ret <= 0) {
vty_out(vty, "%% Malformed address\n"); vty_out(vty, "%% Malformed address\n");

View File

@ -221,7 +221,7 @@ static bool zebra_ns_notify_is_default_netns(const char *name)
if (zebra_ns_notify_self_identify(&default_netns_stat)) if (zebra_ns_notify_self_identify(&default_netns_stat))
return false; return false;
memset(&st, 0, sizeof(struct stat)); memset(&st, 0, sizeof(st));
snprintf(netnspath, sizeof(netnspath), "%s/%s", NS_RUN_DIR, name); snprintf(netnspath, sizeof(netnspath), "%s/%s", NS_RUN_DIR, name);
/* compare with local stat */ /* compare with local stat */
if (stat(netnspath, &st) == 0 && if (stat(netnspath, &st) == 0 &&

View File

@ -114,7 +114,7 @@ void zebra_ptm_init(void)
{ {
char buf[64]; char buf[64];
memset(&ptm_cb, 0, sizeof(struct zebra_ptm_cb)); memset(&ptm_cb, 0, sizeof(ptm_cb));
ptm_cb.out_data = calloc(1, ZEBRA_PTM_SEND_MAX_SOCKBUF); ptm_cb.out_data = calloc(1, ZEBRA_PTM_SEND_MAX_SOCKBUF);
if (!ptm_cb.out_data) { if (!ptm_cb.out_data) {
@ -389,7 +389,7 @@ static int zebra_ptm_socket_init(void)
} }
/* Make server socket. */ /* Make server socket. */
memset(&addr, 0, sizeof(struct sockaddr_un)); memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
memcpy(&addr.sun_path, ZEBRA_PTM_SOCK_NAME, memcpy(&addr.sun_path, ZEBRA_PTM_SOCK_NAME,
sizeof(ZEBRA_PTM_SOCK_NAME)); sizeof(ZEBRA_PTM_SOCK_NAME));
@ -503,7 +503,7 @@ static int zebra_ptm_handle_bfd_msg(void *arg, void *in_ctxt,
return -1; return -1;
} }
memset(&src_prefix, 0, sizeof(struct prefix)); memset(&src_prefix, 0, sizeof(src_prefix));
if (strcmp(ZEBRA_PTM_INVALID_SRC_IP, src_str)) { if (strcmp(ZEBRA_PTM_INVALID_SRC_IP, src_str)) {
if (str2prefix(src_str, &src_prefix) == 0) { if (str2prefix(src_str, &src_prefix) == 0) {
flog_err(EC_ZEBRA_PREFIX_PARSE_ERROR, flog_err(EC_ZEBRA_PREFIX_PARSE_ERROR,

View File

@ -381,7 +381,7 @@ struct route_entry *rib_match(afi_t afi, safi_t safi, vrf_id_t vrf_id,
if (!table) if (!table)
return 0; return 0;
memset(&p, 0, sizeof(struct prefix)); memset(&p, 0, sizeof(p));
p.family = afi; p.family = afi;
if (afi == AFI_IP) { if (afi == AFI_IP) {
p.u.prefix4 = addr->ipv4; p.u.prefix4 = addr->ipv4;

View File

@ -275,7 +275,7 @@ static void zevpn_print_neigh_hash_all_evpn(struct hash_bucket *bucket,
* size, we try to be a bit more elegant in display by first computing * size, we try to be a bit more elegant in display by first computing
* the maximum width. * the maximum width.
*/ */
memset(&wctx, 0, sizeof(struct neigh_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
wctx.vty = vty; wctx.vty = vty;
wctx.addr_width = 15; wctx.addr_width = 15;
@ -341,7 +341,7 @@ static void zevpn_print_neigh_hash_all_evpn_detail(struct hash_bucket *bucket,
return; return;
} }
memset(&wctx, 0, sizeof(struct neigh_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
wctx.vty = vty; wctx.vty = vty;
wctx.addr_width = 15; wctx.addr_width = 15;
@ -625,7 +625,7 @@ static void zl3vni_print_nh_hash_all_vni(struct hash_bucket *bucket,
} else } else
json_object_int_add(json_evpn, "numNextHops", num_nh); json_object_int_add(json_evpn, "numNextHops", num_nh);
memset(&wctx, 0, sizeof(struct nh_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty; wctx.vty = vty;
wctx.json = json_evpn; wctx.json = json_evpn;
hash_iterate(zl3vni->nh_table, zl3vni_print_nh_hash, &wctx); hash_iterate(zl3vni->nh_table, zl3vni_print_nh_hash, &wctx);
@ -668,7 +668,7 @@ static void zl3vni_print_rmac_hash_all_vni(struct hash_bucket *bucket,
* under the vni. Re-assign primary json object to fill * under the vni. Re-assign primary json object to fill
* next vni information. * next vni information.
*/ */
memset(&wctx, 0, sizeof(struct rmac_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty; wctx.vty = vty;
wctx.json = json_evpn; wctx.json = json_evpn;
hash_iterate(zl3vni->rmac_table, zl3vni_print_rmac_hash, &wctx); hash_iterate(zl3vni->rmac_table, zl3vni_print_rmac_hash, &wctx);
@ -1184,7 +1184,7 @@ static struct zebra_mac *zl3vni_rmac_add(struct zebra_l3vni *zl3vni,
struct zebra_mac tmp_rmac; struct zebra_mac tmp_rmac;
struct zebra_mac *zrmac = NULL; struct zebra_mac *zrmac = NULL;
memset(&tmp_rmac, 0, sizeof(struct zebra_mac)); memset(&tmp_rmac, 0, sizeof(tmp_rmac));
memcpy(&tmp_rmac.macaddr, rmac, ETH_ALEN); memcpy(&tmp_rmac.macaddr, rmac, ETH_ALEN);
zrmac = hash_get(zl3vni->rmac_table, &tmp_rmac, zl3vni_rmac_alloc); zrmac = hash_get(zl3vni->rmac_table, &tmp_rmac, zl3vni_rmac_alloc);
zrmac->nh_list = list_new(); zrmac->nh_list = list_new();
@ -1367,7 +1367,7 @@ static void zl3vni_remote_rmac_del(struct zebra_l3vni *zl3vni,
struct ipaddr ipv4_vtep; struct ipaddr ipv4_vtep;
if (!zl3vni_nh_lookup(zl3vni, vtep_ip)) { if (!zl3vni_nh_lookup(zl3vni, vtep_ip)) {
memset(&ipv4_vtep, 0, sizeof(struct ipaddr)); memset(&ipv4_vtep, 0, sizeof(ipv4_vtep));
ipv4_vtep.ipa_type = IPADDR_V4; ipv4_vtep.ipa_type = IPADDR_V4;
if (vtep_ip->ipa_type == IPADDR_V6) if (vtep_ip->ipa_type == IPADDR_V6)
ipv4_mapped_ipv6_to_ipv4(&vtep_ip->ipaddr_v6, ipv4_mapped_ipv6_to_ipv4(&vtep_ip->ipaddr_v6,
@ -1459,7 +1459,7 @@ static struct zebra_neigh *zl3vni_nh_add(struct zebra_l3vni *zl3vni,
struct zebra_neigh tmp_n; struct zebra_neigh tmp_n;
struct zebra_neigh *n = NULL; struct zebra_neigh *n = NULL;
memset(&tmp_n, 0, sizeof(struct zebra_neigh)); memset(&tmp_n, 0, sizeof(tmp_n));
memcpy(&tmp_n.ip, ip, sizeof(struct ipaddr)); memcpy(&tmp_n.ip, ip, sizeof(struct ipaddr));
n = hash_get(zl3vni->nh_table, &tmp_n, zl3vni_nh_alloc); n = hash_get(zl3vni->nh_table, &tmp_n, zl3vni_nh_alloc);
@ -1672,7 +1672,7 @@ struct zebra_l3vni *zl3vni_lookup(vni_t vni)
struct zebra_l3vni tmp_l3vni; struct zebra_l3vni tmp_l3vni;
struct zebra_l3vni *zl3vni = NULL; struct zebra_l3vni *zl3vni = NULL;
memset(&tmp_l3vni, 0, sizeof(struct zebra_l3vni)); memset(&tmp_l3vni, 0, sizeof(tmp_l3vni));
tmp_l3vni.vni = vni; tmp_l3vni.vni = vni;
zl3vni = hash_lookup(zrouter.l3vni_table, &tmp_l3vni); zl3vni = hash_lookup(zrouter.l3vni_table, &tmp_l3vni);
@ -1687,7 +1687,7 @@ static struct zebra_l3vni *zl3vni_add(vni_t vni, vrf_id_t vrf_id)
struct zebra_l3vni tmp_zl3vni; struct zebra_l3vni tmp_zl3vni;
struct zebra_l3vni *zl3vni = NULL; struct zebra_l3vni *zl3vni = NULL;
memset(&tmp_zl3vni, 0, sizeof(struct zebra_l3vni)); memset(&tmp_zl3vni, 0, sizeof(tmp_zl3vni));
tmp_zl3vni.vni = vni; tmp_zl3vni.vni = vni;
zl3vni = hash_get(zrouter.l3vni_table, &tmp_zl3vni, zl3vni_alloc); zl3vni = hash_get(zrouter.l3vni_table, &tmp_zl3vni, zl3vni_alloc);
@ -1988,7 +1988,7 @@ static int zl3vni_send_add_to_client(struct zebra_l3vni *zl3vni)
assert(zvrf); assert(zvrf);
/* get the svi and vrr rmac values */ /* get the svi and vrr rmac values */
memset(&svi_rmac, 0, sizeof(struct ethaddr)); memset(&svi_rmac, 0, sizeof(svi_rmac));
zl3vni_get_svi_rmac(zl3vni, &svi_rmac); zl3vni_get_svi_rmac(zl3vni, &svi_rmac);
zl3vni_get_vrr_rmac(zl3vni, &vrr_rmac); zl3vni_get_vrr_rmac(zl3vni, &vrr_rmac);
@ -2276,7 +2276,7 @@ void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id, const struct ethaddr *rmac,
* address. Rmac is programmed against the ipv4 vtep because we only * address. Rmac is programmed against the ipv4 vtep because we only
* support ipv4 tunnels in the h/w right now * support ipv4 tunnels in the h/w right now
*/ */
memset(&ipv4_vtep, 0, sizeof(struct ipaddr)); memset(&ipv4_vtep, 0, sizeof(ipv4_vtep));
ipv4_vtep.ipa_type = IPADDR_V4; ipv4_vtep.ipa_type = IPADDR_V4;
if (vtep_ip->ipa_type == IPADDR_V6) if (vtep_ip->ipa_type == IPADDR_V6)
ipv4_mapped_ipv6_to_ipv4(&vtep_ip->ipaddr_v6, ipv4_mapped_ipv6_to_ipv4(&vtep_ip->ipaddr_v6,
@ -2386,7 +2386,7 @@ void zebra_vxlan_print_rmacs_l3vni(struct vty *vty, vni_t l3vni, bool use_json)
if (use_json) if (use_json)
json = json_object_new_object(); json = json_object_new_object();
memset(&wctx, 0, sizeof(struct rmac_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty; wctx.vty = vty;
wctx.json = json; wctx.json = json;
if (!use_json) { if (!use_json) {
@ -2637,7 +2637,7 @@ void zebra_vxlan_print_neigh_vni(struct vty *vty, struct zebra_vrf *zvrf,
* size, we try to be a bit more elegant in display by first computing * size, we try to be a bit more elegant in display by first computing
* the maximum width. * the maximum width.
*/ */
memset(&wctx, 0, sizeof(struct neigh_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
wctx.vty = vty; wctx.vty = vty;
wctx.addr_width = 15; wctx.addr_width = 15;
@ -2781,7 +2781,7 @@ void zebra_vxlan_print_neigh_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf,
if (use_json) if (use_json)
json = json_object_new_object(); json = json_object_new_object();
memset(&wctx, 0, sizeof(struct neigh_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
wctx.vty = vty; wctx.vty = vty;
wctx.addr_width = 15; wctx.addr_width = 15;
@ -2834,7 +2834,7 @@ void zebra_vxlan_print_neigh_vni_dad(struct vty *vty,
* size, we try to be a bit more elegant in display by first computing * size, we try to be a bit more elegant in display by first computing
* the maximum width. * the maximum width.
*/ */
memset(&wctx, 0, sizeof(struct neigh_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
wctx.vty = vty; wctx.vty = vty;
wctx.addr_width = 15; wctx.addr_width = 15;
@ -2890,7 +2890,7 @@ void zebra_vxlan_print_macs_vni(struct vty *vty, struct zebra_vrf *zvrf,
json_mac = json_object_new_object(); json_mac = json_object_new_object();
} }
memset(&wctx, 0, sizeof(struct mac_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
wctx.vty = vty; wctx.vty = vty;
wctx.json = json_mac; wctx.json = json_mac;
@ -2931,7 +2931,7 @@ void zebra_vxlan_print_macs_all_vni(struct vty *vty, struct zebra_vrf *zvrf,
if (use_json) if (use_json)
json = json_object_new_object(); json = json_object_new_object();
memset(&wctx, 0, sizeof(struct mac_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty; wctx.vty = vty;
wctx.json = json; wctx.json = json;
wctx.print_dup = print_dup; wctx.print_dup = print_dup;
@ -2959,7 +2959,7 @@ void zebra_vxlan_print_macs_all_vni_detail(struct vty *vty,
if (use_json) if (use_json)
json = json_object_new_object(); json = json_object_new_object();
memset(&wctx, 0, sizeof(struct mac_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty; wctx.vty = vty;
wctx.json = json; wctx.json = json;
wctx.print_dup = print_dup; wctx.print_dup = print_dup;
@ -2986,7 +2986,7 @@ void zebra_vxlan_print_macs_all_vni_vtep(struct vty *vty,
if (use_json) if (use_json)
json = json_object_new_object(); json = json_object_new_object();
memset(&wctx, 0, sizeof(struct mac_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.vty = vty; wctx.vty = vty;
wctx.flags = SHOW_REMOTE_MAC_FROM_VTEP; wctx.flags = SHOW_REMOTE_MAC_FROM_VTEP;
wctx.r_vtep_ip = vtep_ip; wctx.r_vtep_ip = vtep_ip;
@ -3071,7 +3071,7 @@ void zebra_vxlan_print_macs_vni_dad(struct vty *vty,
json_mac = json_object_new_object(); json_mac = json_object_new_object();
} }
memset(&wctx, 0, sizeof(struct mac_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
wctx.vty = vty; wctx.vty = vty;
wctx.json = json_mac; wctx.json = json_mac;
@ -3320,7 +3320,7 @@ static void zevpn_clear_dup_detect_hash_vni_all(struct hash_bucket *bucket,
zvrf = (struct zebra_vrf *)args[0]; zvrf = (struct zebra_vrf *)args[0];
if (hashcount(zevpn->neigh_table)) { if (hashcount(zevpn->neigh_table)) {
memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx)); memset(&n_wctx, 0, sizeof(n_wctx));
n_wctx.zevpn = zevpn; n_wctx.zevpn = zevpn;
n_wctx.zvrf = zvrf; n_wctx.zvrf = zvrf;
hash_iterate(zevpn->neigh_table, hash_iterate(zevpn->neigh_table,
@ -3328,7 +3328,7 @@ static void zevpn_clear_dup_detect_hash_vni_all(struct hash_bucket *bucket,
} }
if (num_valid_macs(zevpn)) { if (num_valid_macs(zevpn)) {
memset(&m_wctx, 0, sizeof(struct mac_walk_ctx)); memset(&m_wctx, 0, sizeof(m_wctx));
m_wctx.zevpn = zevpn; m_wctx.zevpn = zevpn;
m_wctx.zvrf = zvrf; m_wctx.zvrf = zvrf;
hash_iterate(zevpn->mac_table, zevpn_clear_dup_mac_hash, &m_wctx); hash_iterate(zevpn->mac_table, zevpn_clear_dup_mac_hash, &m_wctx);
@ -3368,7 +3368,7 @@ int zebra_vxlan_clear_dup_detect_vni(struct zebra_vrf *zvrf, vni_t vni)
} }
if (hashcount(zevpn->neigh_table)) { if (hashcount(zevpn->neigh_table)) {
memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx)); memset(&n_wctx, 0, sizeof(n_wctx));
n_wctx.zevpn = zevpn; n_wctx.zevpn = zevpn;
n_wctx.zvrf = zvrf; n_wctx.zvrf = zvrf;
hash_iterate(zevpn->neigh_table, hash_iterate(zevpn->neigh_table,
@ -3376,7 +3376,7 @@ int zebra_vxlan_clear_dup_detect_vni(struct zebra_vrf *zvrf, vni_t vni)
} }
if (num_valid_macs(zevpn)) { if (num_valid_macs(zevpn)) {
memset(&m_wctx, 0, sizeof(struct mac_walk_ctx)); memset(&m_wctx, 0, sizeof(m_wctx));
m_wctx.zevpn = zevpn; m_wctx.zevpn = zevpn;
m_wctx.zvrf = zvrf; m_wctx.zvrf = zvrf;
hash_iterate(zevpn->mac_table, zevpn_clear_dup_mac_hash, &m_wctx); hash_iterate(zevpn->mac_table, zevpn_clear_dup_mac_hash, &m_wctx);
@ -3417,7 +3417,7 @@ void zebra_vxlan_print_macs_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf,
json_mac = json_object_new_object(); json_mac = json_object_new_object();
} }
memset(&wctx, 0, sizeof(struct mac_walk_ctx)); memset(&wctx, 0, sizeof(wctx));
wctx.zevpn = zevpn; wctx.zevpn = zevpn;
wctx.vty = vty; wctx.vty = vty;
wctx.flags = SHOW_REMOTE_MAC_FROM_VTEP; wctx.flags = SHOW_REMOTE_MAC_FROM_VTEP;
@ -4467,8 +4467,8 @@ int zebra_vxlan_add_del_gw_macip(struct interface *ifp, const struct prefix *p,
struct ethaddr macaddr; struct ethaddr macaddr;
struct zebra_evpn *zevpn = NULL; struct zebra_evpn *zevpn = NULL;
memset(&ip, 0, sizeof(struct ipaddr)); memset(&ip, 0, sizeof(ip));
memset(&macaddr, 0, sizeof(struct ethaddr)); memset(&macaddr, 0, sizeof(macaddr));
/* Check if EVPN is enabled. */ /* Check if EVPN is enabled. */
if (!is_evpn_enabled()) if (!is_evpn_enabled())
@ -4683,7 +4683,7 @@ int zebra_vxlan_svi_up(struct interface *ifp, struct interface *link_if)
zebra_evpn_send_add_to_client(zevpn); zebra_evpn_send_add_to_client(zevpn);
/* Install any remote neighbors for this VNI. */ /* Install any remote neighbors for this VNI. */
memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx)); memset(&n_wctx, 0, sizeof(n_wctx));
n_wctx.zevpn = zevpn; n_wctx.zevpn = zevpn;
hash_iterate(zevpn->neigh_table, zebra_evpn_install_neigh_hash, hash_iterate(zevpn->neigh_table, zebra_evpn_install_neigh_hash,
&n_wctx); &n_wctx);
@ -5153,12 +5153,12 @@ int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags)
zebra_evpn_read_mac_neigh(zevpn, ifp); zebra_evpn_read_mac_neigh(zevpn, ifp);
memset(&m_wctx, 0, sizeof(struct mac_walk_ctx)); memset(&m_wctx, 0, sizeof(m_wctx));
m_wctx.zevpn = zevpn; m_wctx.zevpn = zevpn;
hash_iterate(zevpn->mac_table, hash_iterate(zevpn->mac_table,
zebra_evpn_install_mac_hash, &m_wctx); zebra_evpn_install_mac_hash, &m_wctx);
memset(&n_wctx, 0, sizeof(struct neigh_walk_ctx)); memset(&n_wctx, 0, sizeof(n_wctx));
n_wctx.zevpn = zevpn; n_wctx.zevpn = zevpn;
hash_iterate(zevpn->neigh_table, hash_iterate(zevpn->neigh_table,
zebra_evpn_install_neigh_hash, &n_wctx); zebra_evpn_install_neigh_hash, &n_wctx);