summaryrefslogtreecommitdiffstats
path: root/ospf6d
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-05-11 12:16:44 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-05-11 13:08:47 +0200
commit6006b807b1a84d31611173b837fafcd96ba9d692 (patch)
tree08f25453328d8c408f1a8c658e4e6ef91005d4a7 /ospf6d
parentripd: Use correct usage of memcpy() when zeroing struct (diff)
downloadfrr-6006b807b1a84d31611173b837fafcd96ba9d692.tar.xz
frr-6006b807b1a84d31611173b837fafcd96ba9d692.zip
*: Properly use memset() when zeroing
Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_asbr.c2
-rw-r--r--ospf6d/ospf6_auth_trailer.c2
-rw-r--r--ospf6d/ospf6_intra.c2
-rw-r--r--ospf6d/ospf6_network.c4
-rw-r--r--ospf6d/ospf6_route.c8
-rw-r--r--ospf6d/ospf6_top.c4
-rw-r--r--ospf6d/ospf6_zebra.c2
7 files changed, 12 insertions, 12 deletions
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 0ca4eb3d5..899c78c9f 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -628,7 +628,7 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
if (CHECK_FLAG(external->bits_metric, OSPF6_ASBR_BIT_F)) {
offset = sizeof(*external)
+ 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.prefixlen = IPV6_MAX_BITLEN;
memcpy(&fwd_addr.u.prefix6, (caddr_t)external + offset,
diff --git a/ospf6d/ospf6_auth_trailer.c b/ospf6d/ospf6_auth_trailer.c
index 1f3f87751..77ac4a187 100644
--- a/ospf6d/ospf6_auth_trailer.c
+++ b/ospf6d/ospf6_auth_trailer.c
@@ -406,7 +406,7 @@ int ospf6_auth_validate_pkt(struct ospf6_interface *oi, unsigned int *pkt_len,
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 (IS_OSPF6_DEBUG_AUTH_RX)
zlog_err("RECV[%s] : Wrong auth data in %s packet",
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index f3fd9dab6..b5ea3ada3 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -2010,7 +2010,7 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa)
break;
prefix_num--;
- memset(&prefix, 0, sizeof(struct prefix));
+ memset(&prefix, 0, sizeof(prefix));
prefix.family = AF_INET6;
prefix.prefixlen = op->prefix_length;
ospf6_prefix_in6_addr(&prefix.u.prefix6, intra_prefix_lsa, op);
diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c
index 7501f49fe..9a549e2fc 100644
--- a/ospf6d/ospf6_network.c
+++ b/ospf6d/ospf6_network.c
@@ -173,7 +173,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst,
memset(&cmsgbuf, 0, sizeof(cmsgbuf));
scmsgp = (struct cmsghdr *)&cmsgbuf;
pktinfo = (struct in6_pktinfo *)(CMSG_DATA(scmsgp));
- memset(&dst_sin6, 0, sizeof(struct sockaddr_in6));
+ memset(&dst_sin6, 0, sizeof(dst_sin6));
/* source address */
pktinfo->ipi6_ifindex = ifindex;
@@ -226,7 +226,7 @@ int ospf6_recvmsg(struct in6_addr *src, struct in6_addr *dst,
rcmsgp = (struct cmsghdr *)cmsgbuf;
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 */
rcmsgp->cmsg_level = IPPROTO_IPV6;
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 3c74ca55c..8e964393f 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -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;
json_object *json = NULL;
- memset(&prefix, 0, sizeof(struct prefix));
+ memset(&prefix, 0, sizeof(prefix));
if (use_json)
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;
struct prefix router, id, prefix;
- memset(&router, 0, sizeof(struct prefix));
- memset(&id, 0, sizeof(struct prefix));
- memset(&prefix, 0, sizeof(struct prefix));
+ memset(&router, 0, sizeof(router));
+ memset(&id, 0, sizeof(id));
+ memset(&prefix, 0, sizeof(prefix));
for (i = idx_ipv4; i < argc; i++) {
if (strmatch(argv[i]->text, "detail")) {
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 634eabbf7..8f482d707 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -579,7 +579,7 @@ static void ospf6_disable(struct ospf6 *o)
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 = list_new();
@@ -1758,7 +1758,7 @@ bool ospf6_is_valid_summary_addr(struct vty *vty, struct prefix *p)
{
struct in6_addr addr_zero;
- memset(&addr_zero, 0, sizeof(struct in6_addr));
+ memset(&addr_zero, 0, sizeof(addr_zero));
/* Default prefix validation*/
if ((is_default_prefix(p)) ||
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index 18b1959b9..836671658 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -241,7 +241,7 @@ static int ospf6_zebra_gr_update(struct ospf6 *ospf6, int command,
if (!zclient || zclient->sock < 0 || !ospf6)
return 1;
- memset(&api, 0, sizeof(struct zapi_cap));
+ memset(&api, 0, sizeof(api));
api.cap = command;
api.stale_removal_time = stale_time;
api.vrf_id = ospf6->vrf_id;