summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--babeld/net.c2
-rw-r--r--bgpd/bgp_attr.c5
-rw-r--r--bgpd/bgp_community.c2
-rw-r--r--bgpd/bgp_ecommunity.c2
-rw-r--r--bgpd/bgp_evpn.c4
-rw-r--r--bgpd/bgp_evpn_vty.c5
-rw-r--r--bgpd/bgp_nexthop.c3
-rw-r--r--bgpd/bgp_route.c7
-rw-r--r--bgpd/bgp_snmp.c2
-rw-r--r--bgpd/bgpd.c3
-rw-r--r--bgpd/rfapi/rfapi_import.c2
-rw-r--r--bgpd/rfapi/rfapi_monitor.c5
-rw-r--r--bgpd/rfapi/rfapi_rib.c4
-rw-r--r--bgpd/rfapi/rfapi_vty.c2
-rw-r--r--eigrpd/eigrp_network.c2
-rw-r--r--ldpd/socket.c2
-rw-r--r--lib/command_match.c2
-rw-r--r--lib/md5.c4
-rw-r--r--lib/skiplist.c4
-rw-r--r--lib/table.c2
-rw-r--r--lib/vrf.c2
-rw-r--r--lib/zclient.c2
-rw-r--r--nhrpd/zbuf.h8
-rw-r--r--ospf6d/ospf6_asbr.c4
-rw-r--r--ospf6d/ospf6_lsa.c4
-rw-r--r--ospf6d/ospf6_spf.c6
-rw-r--r--ospf6d/ospf6_zebra.c4
-rw-r--r--ospfd/ospf_abr.c6
-rw-r--r--ospfd/ospf_ext.c4
-rw-r--r--ospfd/ospf_lsa.c9
-rw-r--r--ospfd/ospf_opaque.c2
-rw-r--r--ospfd/ospf_ri.c2
-rw-r--r--ospfd/ospf_sr.c8
-rw-r--r--ospfd/ospf_te.c2
-rw-r--r--ospfd/ospf_zebra.c4
-rw-r--r--ospfd/ospfd.c2
-rw-r--r--pimd/pim_bfd.c10
-rw-r--r--pimd/pim_hello.c2
-rw-r--r--pimd/pim_sock.c5
-rw-r--r--pimd/pim_tlv.c21
-rw-r--r--tests/lib/test_srcdest_table.c3
-rw-r--r--tools/start-stop-daemon.c6
-rw-r--r--vrrpd/vrrp_ndisc.c3
-rw-r--r--zebra/zebra_fpm_protobuf.c2
-rw-r--r--zebra/zebra_netns_id.c2
-rw-r--r--zebra/zebra_rib.c2
-rw-r--r--zebra/zebra_vxlan.c10
47 files changed, 93 insertions, 106 deletions
diff --git a/babeld/net.c b/babeld/net.c
index d1f6a4414..40716a701 100644
--- a/babeld/net.c
+++ b/babeld/net.c
@@ -144,7 +144,7 @@ babel_send(int s,
iovec[1].iov_base = buf2;
iovec[1].iov_len = buflen2;
memset(&msg, 0, sizeof(msg));
- msg.msg_name = (struct sockaddr*)sin;
+ msg.msg_name = sin;
msg.msg_namelen = slen;
msg.msg_iov = iovec;
msg.msg_iovlen = 2;
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 123be42e2..b7e2f4519 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2178,8 +2178,7 @@ bgp_attr_large_community(struct bgp_attr_parser_args *args)
args->total);
}
- attr->lcommunity =
- lcommunity_parse((uint8_t *)stream_pnt(peer->curr), length);
+ attr->lcommunity = lcommunity_parse(stream_pnt(peer->curr), length);
/* XXX: fix ecommunity_parse to use stream API */
stream_forward_getp(peer->curr, length);
@@ -2209,7 +2208,7 @@ bgp_attr_ext_communities(struct bgp_attr_parser_args *args)
}
attr->ecommunity =
- ecommunity_parse((uint8_t *)stream_pnt(peer->curr), length);
+ ecommunity_parse(stream_pnt(peer->curr), length);
/* XXX: fix ecommunity_parse to use stream API */
stream_forward_getp(peer->curr, length);
diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c
index 195c0f394..11f32cdf2 100644
--- a/bgpd/bgp_community.c
+++ b/bgpd/bgp_community.c
@@ -558,7 +558,7 @@ char *community_str(struct community *com, bool make_json)
hash package.*/
unsigned int community_hash_make(const struct community *com)
{
- uint32_t *pnt = (uint32_t *)com->val;
+ uint32_t *pnt = com->val;
return jhash2(pnt, com->size, 0x43ea96c1);
}
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index 5bb4248a5..fe09aab95 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -823,7 +823,7 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
if (sub_type == ECOMMUNITY_REDIRECT_VRF) {
char buf[16] = {};
ecommunity_rt_soo_str(
- buf, sizeof(buf), (uint8_t *)pnt,
+ buf, sizeof(buf), pnt,
type & ~ECOMMUNITY_ENCODE_TRANS_EXP,
ECOMMUNITY_ROUTE_TARGET,
ECOMMUNITY_FORMAT_DISPLAY);
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 9d895fa27..fadccc502 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -901,8 +901,8 @@ static void add_mac_mobility_to_attr(uint32_t seq_num, struct attr *attr)
if (type == ECOMMUNITY_ENCODE_EVPN
&& sub_type
== ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY) {
- ecom_val_ptr = (uint8_t *)(attr->ecommunity->val
- + (i * 8));
+ ecom_val_ptr =
+ (attr->ecommunity->val + (i * 8));
break;
}
}
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index fddb00b6e..769872f2e 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -2515,8 +2515,7 @@ static void evpn_show_route_rd_macip(struct vty *vty, struct bgp *bgp,
return;
}
- bgp_evpn_route2str((struct prefix_evpn *)&p, prefix_str,
- sizeof(prefix_str));
+ bgp_evpn_route2str(&p, prefix_str, sizeof(prefix_str));
/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(vty, bgp, rn, prd, afi, safi, json);
@@ -2574,7 +2573,7 @@ static void evpn_show_route_rd(struct vty *vty, struct bgp *bgp,
safi = SAFI_EVPN;
prefix_cnt = path_cnt = 0;
- prefix_rd2str((struct prefix_rd *)prd, rd_str, sizeof(rd_str));
+ prefix_rd2str(prd, rd_str, sizeof(rd_str));
rd_rn = bgp_node_lookup(bgp->rib[afi][safi], (struct prefix *)prd);
if (!rd_rn)
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index c77238aa3..bfce61c2a 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -436,8 +436,7 @@ void bgp_connected_delete(struct bgp *bgp, struct connected *ifc)
bgp_address_del(bgp, ifc, addr);
- rn = bgp_node_lookup(bgp->connected_table[AFI_IP6],
- (struct prefix *)&p);
+ rn = bgp_node_lookup(bgp->connected_table[AFI_IP6], &p);
}
if (!rn)
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index a11e1d7c6..a036771dc 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -8298,7 +8298,7 @@ void route_vty_out_overlay(struct vty *vty, const struct prefix *p,
mac = ecom_mac2str((char *)routermac->val);
if (mac) {
if (!json_path) {
- vty_out(vty, "/%s", (char *)mac);
+ vty_out(vty, "/%s", mac);
} else {
json_object_string_add(json_overlay, "rmac",
mac);
@@ -12268,7 +12268,7 @@ static int bgp_distance_set(struct vty *vty, const char *distance_str,
distance = atoi(distance_str);
/* Get BGP distance node. */
- rn = bgp_node_get(bgp_distance_table[afi][safi], (struct prefix *)&p);
+ rn = bgp_node_get(bgp_distance_table[afi][safi], &p);
bdistance = bgp_node_get_bgp_distance_info(rn);
if (bdistance)
bgp_unlock_node(rn);
@@ -12309,8 +12309,7 @@ static int bgp_distance_unset(struct vty *vty, const char *distance_str,
return CMD_WARNING_CONFIG_FAILED;
}
- rn = bgp_node_lookup(bgp_distance_table[afi][safi],
- (struct prefix *)&p);
+ rn = bgp_node_lookup(bgp_distance_table[afi][safi], &p);
if (!rn) {
vty_out(vty, "Can't find specified prefix\n");
return CMD_WARNING_CONFIG_FAILED;
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 28eea46a5..e7aa02863 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -330,7 +330,7 @@ static uint8_t *bgpVersion(struct variable *v, oid name[], size_t *length,
/* Return octet string length 1. */
*var_len = 1;
- return (uint8_t *)&version;
+ return &version;
}
static uint8_t *bgpLocalAs(struct variable *v, oid name[], size_t *length,
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 7560cc4da..dedd0ed3b 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -6173,8 +6173,7 @@ static void peer_aslist_update(const char *aslist_name)
static void peer_aslist_add(char *aslist_name)
{
peer_aslist_update(aslist_name);
- route_map_notify_dependencies((char *)aslist_name,
- RMAP_EVENT_ASLIST_ADDED);
+ route_map_notify_dependencies(aslist_name, RMAP_EVENT_ASLIST_ADDED);
}
static void peer_aslist_del(const char *aslist_name)
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index d261a3ee8..41e6a64a6 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -2239,7 +2239,7 @@ static struct bgp_path_info *rfapiItBiIndexSearch(
bpi_fake.peer = peer;
bpi_fake.extra = &bpi_extra;
- bpi_fake.extra->vnc.import.rd = *(struct prefix_rd *)prd;
+ bpi_fake.extra->vnc.import.rd = *prd;
if (aux_prefix) {
bpi_fake.extra->vnc.import.aux_prefix = *aux_prefix;
} else {
diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c
index 0b8dfc355..cd26892b8 100644
--- a/bgpd/rfapi/rfapi_monitor.c
+++ b/bgpd/rfapi/rfapi_monitor.c
@@ -870,10 +870,9 @@ void rfapiMonitorItNodeChanged(
if ((sl = RFAPI_MONITOR_ETH(rn))) {
for (cursor = NULL,
- rc = skiplist_next(sl, NULL, (void **)&m,
- (void **)&cursor);
+ rc = skiplist_next(sl, NULL, (void **)&m, &cursor);
!rc; rc = skiplist_next(sl, NULL, (void **)&m,
- (void **)&cursor)) {
+ &cursor)) {
if (skiplist_search(nves_seen, m->rfd, NULL)) {
/*
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index 04a538dc6..95b8582b9 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -268,8 +268,8 @@ static void rfapi_info_free(struct rfapi_info *goner)
if (goner->timer) {
struct rfapi_rib_tcb *tcb;
- tcb = ((struct thread *)goner->timer)->arg;
- thread_cancel((struct thread *)goner->timer);
+ tcb = goner->timer->arg;
+ thread_cancel(goner->timer);
XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb);
goner->timer = NULL;
}
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index 5a84d14bd..89f6852e2 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -3428,7 +3428,7 @@ static void clear_vnc_nve_closer(struct rfapi_local_reg_delete_arg *cda)
&cursor)) {
if (pValue->rfd) {
- ((struct rfapi_descriptor *)pValue->rfd)->flags |=
+ pValue->rfd->flags |=
RFAPI_HD_FLAG_CLOSING_ADMINISTRATIVELY;
rfapi_close(pValue->rfd);
}
diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c
index 39008a01c..072ff2970 100644
--- a/eigrpd/eigrp_network.c
+++ b/eigrpd/eigrp_network.c
@@ -218,7 +218,7 @@ int eigrp_network_set(struct eigrp *eigrp, struct prefix *p)
struct route_node *rn;
struct interface *ifp;
- rn = route_node_get(eigrp->networks, (struct prefix *)p);
+ rn = route_node_get(eigrp->networks, p);
if (rn->info) {
/* There is already same network statement. */
route_unlock_node(rn);
diff --git a/ldpd/socket.c b/ldpd/socket.c
index 4909ea7ad..e865707d4 100644
--- a/ldpd/socket.c
+++ b/ldpd/socket.c
@@ -320,7 +320,7 @@ sock_set_md5sig(int fd, int af, union ldpd_addr *addr, const char *password)
int
sock_set_ipv4_tos(int fd, int tos)
{
- if (setsockopt(fd, IPPROTO_IP, IP_TOS, (int *)&tos, sizeof(tos)) < 0) {
+ if (setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) {
log_warn("%s: error setting IP_TOS to 0x%x", __func__, tos);
return (-1);
}
diff --git a/lib/command_match.c b/lib/command_match.c
index 0195aebc1..801b05f15 100644
--- a/lib/command_match.c
+++ b/lib/command_match.c
@@ -88,7 +88,7 @@ enum matcher_rv command_match(struct graph *cmdgraph, vector vline,
// prepend a dummy token to match that pesky start node
vector vvline = vector_init(vline->alloced + 1);
- vector_set_index(vvline, 0, (void *)XSTRDUP(MTYPE_TMP, "dummy"));
+ vector_set_index(vvline, 0, XSTRDUP(MTYPE_TMP, "dummy"));
memcpy(vvline->index + 1, vline->index,
sizeof(void *) * vline->alloced);
vvline->active = vline->active + 1;
diff --git a/lib/md5.c b/lib/md5.c
index 9c003a3af..5c93c7bc1 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -429,7 +429,7 @@ void hmac_md5(unsigned char *text, int text_len, unsigned char *key,
* pass */
MD5Update(&context, k_ipad, 64); /* start with inner pad */
MD5Update(&context, text, text_len); /* then text of datagram */
- MD5Final((uint8_t *)digest, &context); /* finish up 1st pass */
+ MD5Final(digest, &context); /* finish up 1st pass */
/*
* perform outer MD5
*/
@@ -438,5 +438,5 @@ void hmac_md5(unsigned char *text, int text_len, unsigned char *key,
MD5Update(&context, k_opad, 64); /* start with outer pad */
MD5Update(&context, digest, 16); /* then results of 1st
* hash */
- MD5Final((uint8_t *)digest, &context); /* finish up 2nd pass */
+ MD5Final(digest, &context); /* finish up 2nd pass */
}
diff --git a/lib/skiplist.c b/lib/skiplist.c
index fa25770ef..790bd71c3 100644
--- a/lib/skiplist.c
+++ b/lib/skiplist.c
@@ -624,7 +624,7 @@ void skiplist_test(struct vty *vty)
zlog_debug("%s: (%d:%d)", __func__, i, k);
}
// keys[k] = (void *)random();
- keys[k] = (void *)scramble(k);
+ keys[k] = scramble(k);
if (skiplist_insert(l, keys[k], keys[k]))
zlog_debug("error in insert #%d,#%d", i, k);
}
@@ -649,7 +649,7 @@ void skiplist_test(struct vty *vty)
zlog_debug("<%d:%d>", i, k);
if (skiplist_delete(l, keys[k], keys[k]))
zlog_debug("error in delete");
- keys[k] = (void *)scramble(k ^ 0xf0f0f0f0);
+ keys[k] = scramble(k ^ 0xf0f0f0f0);
if (skiplist_insert(l, keys[k], keys[k]))
zlog_debug("error in insert #%d,#%d", i, k);
}
diff --git a/lib/table.c b/lib/table.c
index 1a89a95f4..86347cbac 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -160,7 +160,7 @@ static void route_common(const struct prefix *n, const struct prefix *p,
np = (const uint8_t *)&n->u.prefix;
pp = (const uint8_t *)&p->u.prefix;
- newp = (uint8_t *)&new->u.prefix;
+ newp = &new->u.prefix;
for (i = 0; i < p->prefixlen / 8; i++) {
if (np[i] == pp[i])
diff --git a/lib/vrf.c b/lib/vrf.c
index 370a1b235..31ea2d6c4 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -116,7 +116,7 @@ static void vrf_update_vrf_id(ns_id_t ns_id, void *opaqueptr)
vrf->vrf_id = vrf_id;
RB_INSERT(vrf_id_head, &vrfs_by_id, vrf);
if (old_vrf_id == VRF_UNKNOWN)
- vrf_enable((struct vrf *)vrf);
+ vrf_enable(vrf);
}
int vrf_switch_to_netns(vrf_id_t vrf_id)
diff --git a/lib/zclient.c b/lib/zclient.c
index d380267a7..d8c6e002d 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -990,7 +990,7 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
stream_putc(s, api->prefix.family);
psize = PSIZE(api->prefix.prefixlen);
stream_putc(s, api->prefix.prefixlen);
- stream_write(s, (uint8_t *)&api->prefix.u.prefix, psize);
+ stream_write(s, &api->prefix.u.prefix, psize);
if (CHECK_FLAG(api->message, ZAPI_MESSAGE_SRCPFX)) {
psize = PSIZE(api->src_prefix.prefixlen);
diff --git a/nhrpd/zbuf.h b/nhrpd/zbuf.h
index d03f4ca3a..e6f7101d6 100644
--- a/nhrpd/zbuf.h
+++ b/nhrpd/zbuf.h
@@ -86,9 +86,9 @@ static inline void *__zbuf_pull(struct zbuf *zb, size_t size, int error)
}
#define zbuf_pull(zb, type) ((type *)__zbuf_pull(zb, sizeof(type), 1))
-#define zbuf_pulln(zb, sz) ((void *)__zbuf_pull(zb, sz, 1))
+#define zbuf_pulln(zb, sz) (__zbuf_pull(zb, sz, 1))
#define zbuf_may_pull(zb, type) ((type *)__zbuf_pull(zb, sizeof(type), 0))
-#define zbuf_may_pulln(zb, sz) ((void *)__zbuf_pull(zb, sz, 0))
+#define zbuf_may_pulln(zb, sz) (__zbuf_pull(zb, sz, 0))
void *zbuf_may_pull_until(struct zbuf *zb, const char *sep, struct zbuf *msg);
@@ -149,9 +149,9 @@ static inline void *__zbuf_push(struct zbuf *zb, size_t size, int error)
}
#define zbuf_push(zb, type) ((type *)__zbuf_push(zb, sizeof(type), 1))
-#define zbuf_pushn(zb, sz) ((void *)__zbuf_push(zb, sz, 1))
+#define zbuf_pushn(zb, sz) (__zbuf_push(zb, sz, 1))
#define zbuf_may_push(zb, type) ((type *)__zbuf_may_push(zb, sizeof(type), 0))
-#define zbuf_may_pushn(zb, sz) ((void *)__zbuf_push(zb, sz, 0))
+#define zbuf_may_pushn(zb, sz) (__zbuf_push(zb, sz, 0))
static inline void zbuf_put(struct zbuf *zb, const void *src, size_t len)
{
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index e059bfbc5..6e71a21bd 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -918,8 +918,8 @@ void ospf6_asbr_distribute_list_update(int type)
ZROUTE_NAME(type));
ospf6->t_distribute_update = NULL;
- thread_add_timer_msec(master, ospf6_asbr_routemap_update_timer,
- (void **)args, OSPF_MIN_LS_INTERVAL,
+ thread_add_timer_msec(master, ospf6_asbr_routemap_update_timer, args,
+ OSPF_MIN_LS_INTERVAL,
&ospf6->t_distribute_update);
}
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index c63ea47f2..bcfd97587 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -527,7 +527,7 @@ struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header)
/* allocate memory */
lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
- lsa->header = (struct ospf6_lsa_header *)new_header;
+ lsa->header = new_header;
/* dump string */
ospf6_lsa_printbuf(lsa, lsa->name, sizeof(lsa->name));
@@ -554,7 +554,7 @@ struct ospf6_lsa *ospf6_lsa_create_headeronly(struct ospf6_lsa_header *header)
/* allocate memory */
lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
- lsa->header = (struct ospf6_lsa_header *)new_header;
+ lsa->header = new_header;
SET_FLAG(lsa->flag, OSPF6_LSA_HEADERONLY);
/* dump string */
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index b0fe890d3..80bff5795 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -989,7 +989,7 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area,
rtr_lsa = ospf6_lsdb_next(end, rtr_lsa);
continue;
}
- lsa_header = (struct ospf6_lsa_header *)rtr_lsa->header;
+ lsa_header = rtr_lsa->header;
total_lsa_length += (ntohs(lsa_header->length) - lsa_length);
num_lsa++;
rtr_lsa = ospf6_lsdb_next(end, rtr_lsa);
@@ -1027,7 +1027,7 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area,
assert(rtr_lsa);
if (!OSPF6_LSA_IS_MAXAGE(rtr_lsa)) {
/* Append first Link State ID LSA */
- lsa_header = (struct ospf6_lsa_header *)rtr_lsa->header;
+ lsa_header = rtr_lsa->header;
memcpy(new_header, lsa_header, ntohs(lsa_header->length));
/* Assign new lsa length as aggregated length. */
((struct ospf6_lsa_header *)new_header)->length =
@@ -1057,7 +1057,7 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area,
}
/* Append Next Link State ID LSA */
- lsa_header = (struct ospf6_lsa_header *)rtr_lsa->header;
+ lsa_header = rtr_lsa->header;
memcpy(new_header, (OSPF6_LSA_HEADER_END(rtr_lsa->header) + 4),
(ntohs(lsa_header->length) - lsa_length));
new_header += (ntohs(lsa_header->length) - lsa_length);
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index f8df37094..2773a666a 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -171,8 +171,8 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS)
if (IS_OSPF6_DEBUG_ZEBRA(RECV)) {
char prefixstr[PREFIX2STR_BUFFER], nexthopstr[128];
- prefix2str((struct prefix *)&api.prefix, prefixstr,
- sizeof(prefixstr));
+
+ prefix2str(&api.prefix, prefixstr, sizeof(prefixstr));
inet_ntop(AF_INET6, nexthop, nexthopstr, sizeof(nexthopstr));
zlog_debug(
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index a8dfcbb36..eb3323997 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -708,8 +708,7 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost,
else
full_cost = cost;
- old = ospf_lsa_lookup_by_prefix(area->lsdb, OSPF_SUMMARY_LSA,
- (struct prefix_ipv4 *)p,
+ old = ospf_lsa_lookup_by_prefix(area->lsdb, OSPF_SUMMARY_LSA, p,
area->ospf->router_id);
if (old) {
if (IS_DEBUG_OSPF_EVENT)
@@ -761,8 +760,7 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost,
zlog_debug(
"ospf_abr_announce_network_to_area(): "
"creating new summary");
- lsa = ospf_summary_lsa_originate((struct prefix_ipv4 *)p,
- full_cost, area);
+ lsa = ospf_summary_lsa_originate(p, full_cost, area);
/* This will flood through area. */
if (!lsa) {
diff --git a/ospfd/ospf_ext.c b/ospfd/ospf_ext.c
index df64fca88..47883d5f3 100644
--- a/ospfd/ospf_ext.c
+++ b/ospfd/ospf_ext.c
@@ -1684,7 +1684,7 @@ static uint16_t show_vty_link_info(struct vty *vty, struct tlv_header *ext)
/* Extended Link TLVs */
static void ospf_ext_link_show_info(struct vty *vty, struct ospf_lsa *lsa)
{
- struct lsa_header *lsah = (struct lsa_header *)lsa->data;
+ struct lsa_header *lsah = lsa->data;
struct tlv_header *tlvh;
uint16_t length = 0, sum = 0;
@@ -1758,7 +1758,7 @@ static uint16_t show_vty_pref_info(struct vty *vty, struct tlv_header *ext)
/* Extended Prefix TLVs */
static void ospf_ext_pref_show_info(struct vty *vty, struct ospf_lsa *lsa)
{
- struct lsa_header *lsah = (struct lsa_header *)lsa->data;
+ struct lsa_header *lsah = lsa->data;
struct tlv_header *tlvh;
uint16_t length = 0, sum = 0;
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index d50f390e3..088f7f31c 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -123,7 +123,7 @@ int get_age(struct ospf_lsa *lsa)
one-based. */
uint16_t ospf_lsa_checksum(struct lsa_header *lsa)
{
- uint8_t *buffer = (uint8_t *)&lsa->options;
+ uint8_t *buffer = &lsa->options;
int options_offset = buffer - (uint8_t *)&lsa->ls_age; /* should be 2 */
/* Skip the AGE field */
@@ -138,7 +138,7 @@ uint16_t ospf_lsa_checksum(struct lsa_header *lsa)
int ospf_lsa_checksum_valid(struct lsa_header *lsa)
{
- uint8_t *buffer = (uint8_t *)&lsa->options;
+ uint8_t *buffer = &lsa->options;
int options_offset = buffer - (uint8_t *)&lsa->ls_age; /* should be 2 */
/* Skip the AGE field */
@@ -2845,8 +2845,7 @@ void ospf_lsa_maxage_delete(struct ospf *ospf, struct ospf_lsa *lsa)
lsa_prefix.prefixlen = sizeof(lsa_prefix.u.ptr) * CHAR_BIT;
lsa_prefix.u.ptr = (uintptr_t)lsa;
- if ((rn = route_node_lookup(ospf->maxage_lsa,
- (struct prefix *)&lsa_prefix))) {
+ if ((rn = route_node_lookup(ospf->maxage_lsa, &lsa_prefix))) {
if (rn->info == lsa) {
UNSET_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE);
ospf_lsa_unlock(&lsa); /* maxage_lsa */
@@ -2888,7 +2887,7 @@ void ospf_lsa_maxage(struct ospf *ospf, struct ospf_lsa *lsa)
lsa_prefix.prefixlen = sizeof(lsa_prefix.u.ptr) * CHAR_BIT;
lsa_prefix.u.ptr = (uintptr_t)lsa;
- rn = route_node_get(ospf->maxage_lsa, (struct prefix *)&lsa_prefix);
+ rn = route_node_get(ospf->maxage_lsa, &lsa_prefix);
if (rn->info != NULL) {
if (IS_DEBUG_OSPF(lsa, LSA_FLOODING))
zlog_debug(
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index b042a0637..35fa5da74 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -1161,7 +1161,7 @@ void ospf_opaque_config_write_debug(struct vty *vty)
void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa)
{
- struct lsa_header *lsah = (struct lsa_header *)lsa->data;
+ struct lsa_header *lsah = lsa->data;
uint32_t lsid = ntohl(lsah->id.s_addr);
uint8_t opaque_type = GET_OPAQUE_TYPE(lsid);
uint32_t opaque_id = GET_OPAQUE_ID(lsid);
diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c
index fbe513cea..c3d53ad5e 100644
--- a/ospfd/ospf_ri.c
+++ b/ospfd/ospf_ri.c
@@ -1438,7 +1438,7 @@ static uint16_t show_vty_sr_msd(struct vty *vty, struct tlv_header *tlvh)
static void ospf_router_info_show_info(struct vty *vty, struct ospf_lsa *lsa)
{
- struct lsa_header *lsah = (struct lsa_header *)lsa->data;
+ struct lsa_header *lsah = lsa->data;
struct tlv_header *tlvh;
uint16_t length = 0, sum = 0;
diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c
index b5a54a0bc..7a786ba7a 100644
--- a/ospfd/ospf_sr.c
+++ b/ospfd/ospf_sr.c
@@ -1035,7 +1035,7 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa)
{
struct sr_node *srn;
struct tlv_header *tlvh;
- struct lsa_header *lsah = (struct lsa_header *)lsa->data;
+ struct lsa_header *lsah = lsa->data;
struct ri_sr_tlv_sid_label_range *ri_srgb;
struct ri_sr_tlv_sr_algorithm *algo;
struct sr_srgb srgb;
@@ -1156,7 +1156,7 @@ void ospf_sr_ri_lsa_update(struct ospf_lsa *lsa)
void ospf_sr_ri_lsa_delete(struct ospf_lsa *lsa)
{
struct sr_node *srn;
- struct lsa_header *lsah = (struct lsa_header *)lsa->data;
+ struct lsa_header *lsah = lsa->data;
if (IS_DEBUG_OSPF_SR)
zlog_debug("SR (%s): Remove SR node %s from lsa_id 4.0.0.%u",
@@ -1198,7 +1198,7 @@ void ospf_sr_ext_link_lsa_update(struct ospf_lsa *lsa)
{
struct sr_node *srn;
struct tlv_header *tlvh;
- struct lsa_header *lsah = (struct lsa_header *)lsa->data;
+ struct lsa_header *lsah = lsa->data;
struct sr_link *srl;
uint16_t length, sum;
@@ -1308,7 +1308,7 @@ void ospf_sr_ext_prefix_lsa_update(struct ospf_lsa *lsa)
{
struct sr_node *srn;
struct tlv_header *tlvh;
- struct lsa_header *lsah = (struct lsa_header *)lsa->data;
+ struct lsa_header *lsah = lsa->data;
struct sr_prefix *srp;
uint16_t length, sum;
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index a2084e321..1009c7577 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -2119,7 +2119,7 @@ static uint16_t ospf_mpls_te_show_link_subtlv(struct vty *vty,
static void ospf_mpls_te_show_info(struct vty *vty, struct ospf_lsa *lsa)
{
- struct lsa_header *lsah = (struct lsa_header *)lsa->data;
+ struct lsa_header *lsah = lsa->data;
struct tlv_header *tlvh, *next;
uint16_t sum, total;
uint16_t (*subfunc)(struct vty * vty, struct tlv_header * tlvh,
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 385a7ece7..c7e6bd9cb 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -1023,8 +1023,8 @@ void ospf_distribute_list_update(struct ospf *ospf, int type,
/* Set timer. */
ospf->t_distribute_update = NULL;
- thread_add_timer_msec(master, ospf_distribute_list_update_timer,
- (void **)args, ospf->min_ls_interval,
+ thread_add_timer_msec(master, ospf_distribute_list_update_timer, args,
+ ospf->min_ls_interval,
&ospf->t_distribute_update);
}
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index f3fe9e17b..e9f622d21 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -1787,7 +1787,7 @@ static void ospf_nbr_nbma_add(struct ospf_nbr_nbma *nbr_nbma,
p.prefixlen = IPV4_MAX_BITLEN;
p.u.prefix4 = nbr_nbma->addr;
- rn = route_node_get(oi->nbrs, (struct prefix *)&p);
+ rn = route_node_get(oi->nbrs, &p);
if (rn->info) {
nbr = rn->info;
nbr->nbr_nbma = nbr_nbma;
diff --git a/pimd/pim_bfd.c b/pimd/pim_bfd.c
index 84f6733ea..0df8ea692 100644
--- a/pimd/pim_bfd.c
+++ b/pimd/pim_bfd.c
@@ -47,7 +47,7 @@ void pim_bfd_write_config(struct vty *vty, struct interface *ifp)
if (!pim_ifp)
return;
- bfd_info = (struct bfd_info *)pim_ifp->bfd_info;
+ bfd_info = pim_ifp->bfd_info;
if (!bfd_info)
return;
@@ -92,7 +92,7 @@ void pim_bfd_info_nbr_create(struct pim_interface *pim_ifp,
if (!neigh->bfd_info)
return;
- nbr_bfd_info = (struct bfd_info *)neigh->bfd_info;
+ nbr_bfd_info = neigh->bfd_info;
nbr_bfd_info->detect_mult = pim_ifp->bfd_info->detect_mult;
nbr_bfd_info->desired_min_tx = pim_ifp->bfd_info->desired_min_tx;
nbr_bfd_info->required_min_rx = pim_ifp->bfd_info->required_min_rx;
@@ -118,7 +118,7 @@ static void pim_bfd_reg_dereg_nbr(struct pim_neighbor *nbr, int command)
if (!nbr)
return;
pim_ifp = nbr->interface->info;
- bfd_info = (struct bfd_info *)pim_ifp->bfd_info;
+ bfd_info = pim_ifp->bfd_info;
if (!bfd_info)
return;
if (PIM_DEBUG_PIM_TRACE) {
@@ -194,8 +194,8 @@ void pim_bfd_if_param_set(struct interface *ifp, uint32_t min_rx,
if (!pim_ifp)
return;
- bfd_set_param((struct bfd_info **)&(pim_ifp->bfd_info), min_rx, min_tx,
- detect_mult, defaults, &command);
+ bfd_set_param(&(pim_ifp->bfd_info), min_rx, min_tx, detect_mult,
+ defaults, &command);
if (pim_ifp->bfd_info) {
if (PIM_DEBUG_PIM_TRACE)
diff --git a/pimd/pim_hello.c b/pimd/pim_hello.c
index ecdb3a34a..e50504ec1 100644
--- a/pimd/pim_hello.c
+++ b/pimd/pim_hello.c
@@ -484,7 +484,7 @@ int pim_hello_build_tlv(struct interface *ifp, uint8_t *tlv_buf,
return -1;
}
if (can_disable_join_suppression) {
- *((uint8_t *)(curr) + 4) |= 0x80; /* enable T bit */
+ *(curr + 4) |= 0x80; /* enable T bit */
}
curr = tmp;
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index ae5781f0c..f0a71c96c 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -375,8 +375,7 @@ int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
struct in_pktinfo *i =
(struct in_pktinfo *)CMSG_DATA(cmsg);
if (to)
- ((struct sockaddr_in *)to)->sin_addr =
- i->ipi_addr;
+ to->sin_addr = i->ipi_addr;
if (tolen)
*tolen = sizeof(struct sockaddr_in);
if (ifindex)
@@ -391,7 +390,7 @@ int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
&& (cmsg->cmsg_type == IP_RECVDSTADDR)) {
struct in_addr *i = (struct in_addr *)CMSG_DATA(cmsg);
if (to)
- ((struct sockaddr_in *)to)->sin_addr = *i;
+ to->sin_addr = *i;
if (tolen)
*tolen = sizeof(struct sockaddr_in);
diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c
index 881a3e332..633bb207b 100644
--- a/pimd/pim_tlv.c
+++ b/pimd/pim_tlv.c
@@ -121,20 +121,19 @@ int pim_encode_addr_ucast(uint8_t *buf, struct prefix *p)
{
switch (p->family) {
case AF_INET:
- *(uint8_t *)buf =
- PIM_MSG_ADDRESS_FAMILY_IPV4; /* notice: AF_INET !=
- PIM_MSG_ADDRESS_FAMILY_IPV4
- */
+ *buf = PIM_MSG_ADDRESS_FAMILY_IPV4; /* notice: AF_INET !=
+ PIM_MSG_ADDRESS_FAMILY_IPV4
+ */
++buf;
- *(uint8_t *)buf = 0; /* ucast IPv4 native encoding type (RFC
+ *buf = 0; /* ucast IPv4 native encoding type (RFC
4601: 4.9.1) */
++buf;
memcpy(buf, &p->u.prefix4, sizeof(struct in_addr));
return ucast_ipv4_encoding_len;
case AF_INET6:
- *(uint8_t *)buf = PIM_MSG_ADDRESS_FAMILY_IPV6;
+ *buf = PIM_MSG_ADDRESS_FAMILY_IPV6;
++buf;
- *(uint8_t *)buf = 0;
+ *buf = 0;
++buf;
memcpy(buf, &p->u.prefix6, sizeof(struct in6_addr));
return ucast_ipv6_encoding_len;
@@ -198,13 +197,13 @@ int pim_encode_addr_group(uint8_t *buf, afi_t afi, int bidir, int scope,
switch (afi) {
case AFI_IP:
- *(uint8_t *)buf = PIM_MSG_ADDRESS_FAMILY_IPV4;
+ *buf = PIM_MSG_ADDRESS_FAMILY_IPV4;
++buf;
- *(uint8_t *)buf = 0;
+ *buf = 0;
++buf;
- *(uint8_t *)buf = flags;
+ *buf = flags;
++buf;
- *(uint8_t *)buf = 32;
+ *buf = 32;
++buf;
memcpy(buf, &group, sizeof(struct in_addr));
return group_ipv4_encoding_len;
diff --git a/tests/lib/test_srcdest_table.c b/tests/lib/test_srcdest_table.c
index 935ee500a..9d395bee8 100644
--- a/tests/lib/test_srcdest_table.c
+++ b/tests/lib/test_srcdest_table.c
@@ -391,8 +391,7 @@ static void test_state_del_one_route(struct test_state *test, struct prng *prng)
}
assert(rn);
- srcdest_rnode_prefixes(rn, (const struct prefix **)&dst_p,
- (const struct prefix **)&src_p);
+ srcdest_rnode_prefixes(rn, &dst_p, &src_p);
memcpy(&dst6_p, dst_p, sizeof(dst6_p));
if (src_p)
memcpy(&src6_p, src_p, sizeof(src6_p));
diff --git a/tools/start-stop-daemon.c b/tools/start-stop-daemon.c
index c75306a95..13118a276 100644
--- a/tools/start-stop-daemon.c
+++ b/tools/start-stop-daemon.c
@@ -235,7 +235,7 @@ static const char *next_dirname(const char *s)
{
const char *cur;
- cur = (const char *)s;
+ cur = s;
if (*cur != '\0') {
for (; *cur != '/'; ++cur)
@@ -255,7 +255,7 @@ static void add_namespace(const char *path)
const char *nsdirname, *nsname, *cur;
struct namespace *namespace;
- cur = (const char *)path;
+ cur = path;
nsdirname = nsname = "";
while ((cur = next_dirname(cur))[0] != '\0') {
@@ -273,7 +273,7 @@ static void add_namespace(const char *path)
badusage("invalid namepspace path");
namespace = xmalloc(sizeof(*namespace));
- namespace->path = (const char *)path;
+ namespace->path = path;
namespace->nstype = nstype;
LIST_INSERT_HEAD(&namespace_head, namespace, list);
}
diff --git a/vrrpd/vrrp_ndisc.c b/vrrpd/vrrp_ndisc.c
index dc546b09a..b989e66f6 100644
--- a/vrrpd/vrrp_ndisc.c
+++ b/vrrpd/vrrp_ndisc.c
@@ -83,8 +83,7 @@ static int vrrp_ndisc_una_build(struct interface *ifp, struct ipaddr *ip,
struct nd_opt_hdr *nd_opt_h =
(struct nd_opt_hdr *)((char *)ndh
+ sizeof(struct nd_neighbor_advert));
- char *nd_opt_lladdr =
- (char *)((char *)nd_opt_h + sizeof(struct nd_opt_hdr));
+ char *nd_opt_lladdr = ((char *)nd_opt_h + sizeof(struct nd_opt_hdr));
char *lladdr = (char *)ifp->hw_addr;
/*
diff --git a/zebra/zebra_fpm_protobuf.c b/zebra/zebra_fpm_protobuf.c
index ade4b636d..4b31cc028 100644
--- a/zebra/zebra_fpm_protobuf.c
+++ b/zebra/zebra_fpm_protobuf.c
@@ -294,7 +294,7 @@ int zfpm_protobuf_encode_route(rib_dest_t *dest, struct route_entry *re,
return 0;
}
- len = fpm__message__pack(msg, (uint8_t *)in_buf);
+ len = fpm__message__pack(msg, in_buf);
assert(len <= in_buf_len);
QPB_RESET_STACK_ALLOCATOR(allocator);
diff --git a/zebra/zebra_netns_id.c b/zebra/zebra_netns_id.c
index ea4b07a87..77a9a7c36 100644
--- a/zebra/zebra_netns_id.c
+++ b/zebra/zebra_netns_id.c
@@ -143,7 +143,7 @@ static ns_id_t extract_nsid(struct nlmsghdr *nlh, char *buf)
void *tail = (void *)((char *)nlh + NETLINK_ALIGN(nlh->nlmsg_len));
struct nlattr *attr;
- for (attr = (struct nlattr *)((char *)buf + offset);
+ for (attr = (struct nlattr *)(buf + offset);
NETLINK_NLATTR_LEN(tail, attr) >= sizeof(struct nlattr)
&& attr->nla_len >= sizeof(struct nlattr)
&& attr->nla_len <= NETLINK_NLATTR_LEN(tail, attr);
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 58967de77..80116fca1 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -261,7 +261,7 @@ struct route_entry *rib_match(afi_t afi, safi_t safi, vrf_id_t vrf_id,
p.prefixlen = IPV6_MAX_PREFIXLEN;
}
- rn = route_node_match(table, (struct prefix *)&p);
+ rn = route_node_match(table, &p);
while (rn) {
rib_dest_t *dest;
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 234264127..24050d803 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -1515,8 +1515,8 @@ static void zvni_print_mac_hash_all_vni(struct hash_bucket *bucket, void *ctxt)
struct mac_walk_ctx *wctx = ctxt;
char vni_str[VNI_STR_LEN];
- vty = (struct vty *)wctx->vty;
- json = (struct json_object *)wctx->json;
+ vty = wctx->vty;
+ json = wctx->json;
zvni = (zebra_vni_t *)bucket->data;
wctx->zvni = zvni;
@@ -1586,8 +1586,8 @@ static void zvni_print_mac_hash_all_vni_detail(struct hash_bucket *bucket,
struct mac_walk_ctx *wctx = ctxt;
char vni_str[VNI_STR_LEN];
- vty = (struct vty *)wctx->vty;
- json = (struct json_object *)wctx->json;
+ vty = wctx->vty;
+ json = wctx->json;
zvni = (zebra_vni_t *)bucket->data;
if (!zvni) {
@@ -3691,7 +3691,7 @@ static struct interface *zvni_map_to_svi(vlanid_t vid, struct interface *br_if)
if (!zif || zif->zif_type != ZEBRA_IF_VLAN
|| zif->link != br_if)
continue;
- vl = (struct zebra_l2info_vlan *)&zif->l2info.vl;
+ vl = &zif->l2info.vl;
if (vl->vid == vid) {
found = 1;