summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorF. Aragon <paco@voltanet.io>2018-07-02 18:50:20 +0200
committerF. Aragon <paco@voltanet.io>2018-07-06 01:10:15 +0200
commit2e1cc436791c3d2e39af9ffbd8194e9e4abc7795 (patch)
treeff80fa30b11c02764a44f6f20781c5cdb6f07c90
parent8d6d6b2581be7c60ab4913df1adf46098a3dc4ae (diff)
eigrpd lib pimd zebra: dead code (PVS-Studio)
Signed-off-by: F. Aragon <paco@voltanet.io>
-rw-r--r--eigrpd/eigrp_packet.c2
-rw-r--r--lib/filter.c3
-rw-r--r--lib/module.c2
-rw-r--r--lib/vrf.c5
-rw-r--r--pimd/pim_ifchannel.c5
-rw-r--r--pimd/pim_igmp.c3
-rw-r--r--pimd/pim_nht.c2
-rw-r--r--zebra/if_netlink.c2
-rw-r--r--zebra/zebra_ptm.c36
9 files changed, 26 insertions, 34 deletions
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index fab21e5201..129b5aedde 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -566,7 +566,7 @@ int eigrp_read(struct thread *thread)
// return -1;
/* If incoming interface is passive one, ignore it. */
- if (ei && eigrp_if_is_passive(ei)) {
+ if (eigrp_if_is_passive(ei)) {
char buf[3][INET_ADDRSTRLEN];
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
diff --git a/lib/filter.c b/lib/filter.c
index 5f391aa767..670c65374a 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -549,8 +549,7 @@ static int vty_access_list_remark_unset(struct vty *vty, afi_t afi,
access->remark = NULL;
}
- if (access->head == NULL && access->tail == NULL
- && access->remark == NULL)
+ if (access->head == NULL && access->tail == NULL)
access_list_delete(access);
return CMD_SUCCESS;
diff --git a/lib/module.c b/lib/module.c
index 0c85364003..7d5671290b 100644
--- a/lib/module.c
+++ b/lib/module.c
@@ -85,7 +85,7 @@ struct frrmod_runtime *frrmod_load(const char *spec, const char *dir, char *err,
*args++ = '\0';
if (!strchr(name, '/')) {
- if (!handle && execname) {
+ if (execname) {
snprintf(fullpath, sizeof(fullpath), "%s/%s_%s.so", dir,
execname, name);
handle = dlopen(fullpath, RTLD_NOW | RTLD_GLOBAL);
diff --git a/lib/vrf.c b/lib/vrf.c
index 643ad29cf8..ca50c1e70e 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -628,7 +628,7 @@ int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname,
}
if (vrf->ns_ctxt != NULL) {
ns = (struct ns *)vrf->ns_ctxt;
- if (ns && 0 != strcmp(ns->name, pathname)) {
+ if (!strcmp(ns->name, pathname)) {
if (vty)
vty_out(vty,
"VRF %u already configured with NETNS %s\n",
@@ -661,8 +661,7 @@ int vrf_netns_handler_create(struct vty *vty, struct vrf *vrf, char *pathname,
ns->vrf_ctxt = (void *)vrf;
vrf->ns_ctxt = (void *)ns;
/* update VRF netns NAME */
- if (vrf)
- strlcpy(vrf->data.l.netns_name, basename(pathname), NS_NAMSIZ);
+ strlcpy(vrf->data.l.netns_name, basename(pathname), NS_NAMSIZ);
if (!ns_enable(ns, vrf_update_vrf_id)) {
if (vty)
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index 5e6b0f10cf..6c347a430f 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -136,9 +136,8 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch)
mask = PIM_OIF_FLAG_PROTO_IGMP;
/* SGRpt entry could have empty oil */
- if (ch->upstream->channel_oil)
- pim_channel_del_oif(ch->upstream->channel_oil,
- ch->interface, mask);
+ pim_channel_del_oif(ch->upstream->channel_oil, ch->interface,
+ mask);
/*
* Do we have any S,G's that are inheriting?
* Nuke from on high too.
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index c980f5fcba..92993ff1b9 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -919,10 +919,9 @@ static int pim_igmp_read(struct thread *t)
socklen_t fromlen = sizeof(from);
socklen_t tolen = sizeof(to);
ifindex_t ifindex = -1;
- int cont = 1;
int len;
- while (cont) {
+ while (1) {
len = pim_socket_recvfromto(igmp->fd, buf, sizeof(buf), &from,
&fromlen, &to, &tolen, &ifindex);
if (len < 0) {
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c
index fa6486a83e..d0fa90f0db 100644
--- a/pimd/pim_nht.c
+++ b/pimd/pim_nht.c
@@ -168,7 +168,7 @@ int pim_find_or_track_nexthop(struct pim_instance *pim, struct prefix *addr,
if (up != NULL)
hash_get(pnc->upstream_hash, up, hash_alloc_intern);
- if (pnc && CHECK_FLAG(pnc->flags, PIM_NEXTHOP_VALID)) {
+ if (CHECK_FLAG(pnc->flags, PIM_NEXTHOP_VALID)) {
memcpy(out_pnc, pnc, sizeof(struct pim_nexthop_cache));
return 1;
}
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 5c84219418..8f6e31cfa8 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -986,7 +986,7 @@ int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if (tb[IFA_LABEL])
label = (char *)RTA_DATA(tb[IFA_LABEL]);
- if (ifp && label && strcmp(ifp->name, label) == 0)
+ if (label && strcmp(ifp->name, label) == 0)
label = NULL;
/* Register interface address to the interface. */
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index 8c23bf34cf..5975c4058b 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -615,7 +615,7 @@ static int zebra_ptm_handle_msg_cb(void *arg, void *in_ctxt)
int zebra_ptm_sock_read(struct thread *thread)
{
- int sock, done = 0;
+ int sock;
int rc;
errno = 0;
@@ -625,28 +625,24 @@ int zebra_ptm_sock_read(struct thread *thread)
return -1;
/* PTM communicates in CSV format */
- while (!done) {
+ do {
rc = ptm_lib_process_msg(ptm_hdl, sock, ptm_cb.in_data,
ZEBRA_PTM_MAX_SOCKBUF, NULL);
- if (rc <= 0)
- break;
- }
+ } while (rc > 0);
- if (rc <= 0) {
- if (((rc == 0) && !errno)
- || (errno && (errno != EWOULDBLOCK) && (errno != EAGAIN))) {
- zlog_warn("%s routing socket error: %s(%d) bytes %d",
- __func__, safe_strerror(errno), errno, rc);
-
- close(ptm_cb.ptm_sock);
- ptm_cb.ptm_sock = -1;
- zebra_ptm_reset_status(0);
- ptm_cb.t_timer = NULL;
- thread_add_timer(zebrad.master, zebra_ptm_connect, NULL,
- ptm_cb.reconnect_time,
- &ptm_cb.t_timer);
- return (-1);
- }
+ if (((rc == 0) && !errno)
+ || (errno && (errno != EWOULDBLOCK) && (errno != EAGAIN))) {
+ zlog_warn("%s routing socket error: %s(%d) bytes %d",
+ __func__, safe_strerror(errno), errno, rc);
+
+ close(ptm_cb.ptm_sock);
+ ptm_cb.ptm_sock = -1;
+ zebra_ptm_reset_status(0);
+ ptm_cb.t_timer = NULL;
+ thread_add_timer(zebrad.master, zebra_ptm_connect, NULL,
+ ptm_cb.reconnect_time,
+ &ptm_cb.t_timer);
+ return (-1);
}
ptm_cb.t_read = NULL;