summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_aspath.c2
-rw-r--r--bgpd/bgp_clist.c2
-rw-r--r--bgpd/bgp_packet.c50
-rw-r--r--bgpd/rfapi/rfapi_rib.c1
-rw-r--r--ldpd/address.c2
-rw-r--r--ldpd/ldpd.c61
-rw-r--r--ldpd/socket.c4
-rw-r--r--lib/filter.c2
-rw-r--r--lib/plist.c2
-rw-r--r--lib/skiplist.c4
-rw-r--r--lib/sockopt.c3
-rw-r--r--nhrpd/nhrp_peer.c7
-rw-r--r--ospfd/ospf_abr.c3
-rw-r--r--ospfd/ospf_dump.c4
-rw-r--r--ospfd/ospf_opaque.c4
-rw-r--r--ospfd/ospf_zebra.c3
-rw-r--r--zebra/ipforward_proc.c4
-rw-r--r--zebra/zebra_vty.c4
18 files changed, 73 insertions, 89 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index a781e70d2f..5766236a00 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -793,7 +793,7 @@ static int assegments_parse(struct stream *s, size_t length,
if (head)
prev->next = seg;
else /* it's the first segment */
- head = prev = seg;
+ head = seg;
for (i = 0; i < segh.length; i++)
seg->as[i] =
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index 7ca48a5bea..18369002b8 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -44,7 +44,7 @@ static int64_t bgp_clist_new_seq_get(struct community_list *list)
int64_t newseq;
struct community_entry *entry;
- maxseq = newseq = 0;
+ maxseq = 0;
for (entry = list->head; entry; entry = entry->next) {
if (maxseq < entry->seq)
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 9d030378c7..3132c8b866 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1303,8 +1303,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
/* Open option part parse. */
if (optlen != 0) {
- if ((ret = bgp_open_option_parse(peer, optlen, &mp_capability))
- < 0)
+ if (bgp_open_option_parse(peer, optlen, &mp_capability) < 0)
return BGP_Stop;
} else {
if (bgp_debug_neighbor_events(peer))
@@ -1346,7 +1345,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
return BGP_Stop;
/* Get sockname. */
- if ((ret = bgp_getsockname(peer)) < 0) {
+ if (bgp_getsockname(peer) < 0) {
flog_err_sys(EC_LIB_SOCKET,
"%s: bgp_getsockname() failed for peer: %s",
__FUNCTION__, peer->host);
@@ -1972,38 +1971,29 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
} else
p_pnt = p_end;
- if ((ok = (p_pnt < p_end)))
- orfp.ge =
- *p_pnt++; /* value
- checked in
- prefix_bgp_orf_set()
- */
- if ((ok = (p_pnt < p_end)))
- orfp.le =
- *p_pnt++; /* value
- checked in
- prefix_bgp_orf_set()
- */
+ /* val checked in prefix_bgp_orf_set */
+ if (p_pnt < p_end)
+ orfp.ge = *p_pnt++;
+
+ /* val checked in prefix_bgp_orf_set */
+ if (p_pnt < p_end)
+ orfp.le = *p_pnt++;
+
if ((ok = (p_pnt < p_end)))
orfp.p.prefixlen = *p_pnt++;
- orfp.p.family = afi2family(
- afi); /* afi checked already */
-
- psize = PSIZE(
- orfp.p.prefixlen); /* 0 if not
- ok */
- if (psize
- > prefix_blen(
- &orfp.p)) /* valid for
- family ? */
- {
+
+ /* afi checked already */
+ orfp.p.family = afi2family(afi);
+
+ /* 0 if not ok */
+ psize = PSIZE(orfp.p.prefixlen);
+ /* valid for family ? */
+ if (psize > prefix_blen(&orfp.p)) {
ok = 0;
psize = prefix_blen(&orfp.p);
}
- if (psize
- > (p_end - p_pnt)) /* valid for
- packet ? */
- {
+ /* valid for packet ? */
+ if (psize > (p_end - p_pnt)) {
ok = 0;
psize = p_end - p_pnt;
}
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index 39d4b3ee29..b7ec35c661 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -2184,6 +2184,7 @@ void rfapiRibPendingDeleteRoute(struct bgp *bgp, struct rfapi_import_table *it,
rfapiRibUpdatePendingNode(
bgp, m->rfd, it, it_node,
m->rfd->response_lifetime);
+ agg_unlock_node(rn);
}
}
diff --git a/ldpd/address.c b/ldpd/address.c
index 9c1564a31f..74a3f5a309 100644
--- a/ldpd/address.c
+++ b/ldpd/address.c
@@ -67,7 +67,7 @@ send_address(struct nbr *nbr, int af, struct if_addr_head *addr_list,
fatalx("send_address: unknown af");
}
- while ((if_addr = LIST_FIRST(addr_list)) != NULL) {
+ while (LIST_FIRST(addr_list) != NULL) {
/*
* Send as many addresses as possible - respect the session's
* negotiated maximum pdu length.
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
index dcbcf8ce50..13de48fd70 100644
--- a/ldpd/ldpd.c
+++ b/ldpd/ldpd.c
@@ -858,7 +858,6 @@ ldp_acl_request(struct imsgev *iev, char *acl_name, int af,
union ldpd_addr *addr, uint8_t prefixlen)
{
struct imsg imsg;
- ssize_t n;
struct acl_check acl_check;
if (acl_name[0] == '\0')
@@ -876,9 +875,9 @@ ldp_acl_request(struct imsgev *iev, char *acl_name, int af,
imsg_flush(&iev->ibuf);
/* receive (blocking) and parse result */
- if ((n = imsg_read(&iev->ibuf)) == -1)
+ if (imsg_read(&iev->ibuf) == -1)
fatal("imsg_read error");
- if ((n = imsg_get(&iev->ibuf, &imsg)) == -1)
+ if (imsg_get(&iev->ibuf, &imsg) == -1)
fatal("imsg_get");
if (imsg.hdr.type != IMSG_ACL_CHECK ||
imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(int))
@@ -1408,7 +1407,7 @@ merge_ifaces(struct ldpd_conf *conf, struct ldpd_conf *xconf)
RB_FOREACH_SAFE(iface, iface_head, &conf->iface_tree, itmp) {
/* find deleted interfaces */
- if ((xi = if_lookup_name(xconf, iface->name)) == NULL) {
+ if (if_lookup_name(xconf, iface->name) == NULL) {
switch (ldpd_process) {
case PROC_LDP_ENGINE:
ldpe_if_exit(iface);
@@ -1469,7 +1468,7 @@ merge_tnbrs(struct ldpd_conf *conf, struct ldpd_conf *xconf)
continue;
/* find deleted tnbrs */
- if ((xt = tnbr_find(xconf, tnbr->af, &tnbr->addr)) == NULL) {
+ if (tnbr_find(xconf, tnbr->af, &tnbr->addr) == NULL) {
switch (ldpd_process) {
case PROC_LDP_ENGINE:
tnbr->flags &= ~F_TNBR_CONFIGURED;
@@ -1515,33 +1514,35 @@ merge_nbrps(struct ldpd_conf *conf, struct ldpd_conf *xconf)
RB_FOREACH_SAFE(nbrp, nbrp_head, &conf->nbrp_tree, ntmp) {
/* find deleted nbrps */
- if ((xn = nbr_params_find(xconf, nbrp->lsr_id)) == NULL) {
- switch (ldpd_process) {
- case PROC_LDP_ENGINE:
- nbr = nbr_find_ldpid(nbrp->lsr_id.s_addr);
- if (nbr) {
- session_shutdown(nbr, S_SHUTDOWN, 0, 0);
+ if (nbr_params_find(xconf, nbrp->lsr_id) != NULL)
+ continue;
+
+ switch (ldpd_process) {
+ case PROC_LDP_ENGINE:
+ nbr = nbr_find_ldpid(nbrp->lsr_id.s_addr);
+ if (nbr) {
+ session_shutdown(nbr, S_SHUTDOWN, 0, 0);
#ifdef __OpenBSD__
- pfkey_remove(nbr);
+ pfkey_remove(nbr);
#else
- sock_set_md5sig(
- (ldp_af_global_get(&global,
- nbr->af))->ldp_session_socket,
- nbr->af, &nbr->raddr, NULL);
+ sock_set_md5sig(
+ (ldp_af_global_get(&global, nbr->af))
+ ->ldp_session_socket,
+ nbr->af, &nbr->raddr, NULL);
#endif
- nbr->auth.method = AUTH_NONE;
- if (nbr_session_active_role(nbr))
- nbr_establish_connection(nbr);
- }
- break;
- case PROC_LDE_ENGINE:
- case PROC_MAIN:
- break;
+ nbr->auth.method = AUTH_NONE;
+ if (nbr_session_active_role(nbr))
+ nbr_establish_connection(nbr);
}
- RB_REMOVE(nbrp_head, &conf->nbrp_tree, nbrp);
- free(nbrp);
+ break;
+ case PROC_LDE_ENGINE:
+ case PROC_MAIN:
+ break;
}
+ RB_REMOVE(nbrp_head, &conf->nbrp_tree, nbrp);
+ free(nbrp);
}
+
RB_FOREACH_SAFE(xn, nbrp_head, &xconf->nbrp_tree, ntmp) {
/* find new nbrps */
if ((nbrp = nbr_params_find(conf, xn->lsr_id)) == NULL) {
@@ -1624,7 +1625,7 @@ merge_l2vpns(struct ldpd_conf *conf, struct ldpd_conf *xconf)
RB_FOREACH_SAFE(l2vpn, l2vpn_head, &conf->l2vpn_tree, ltmp) {
/* find deleted l2vpns */
- if ((xl = l2vpn_find(xconf, l2vpn->name)) == NULL) {
+ if (l2vpn_find(xconf, l2vpn->name) == NULL) {
switch (ldpd_process) {
case PROC_LDE_ENGINE:
l2vpn_exit(l2vpn);
@@ -1680,7 +1681,7 @@ merge_l2vpn(struct ldpd_conf *xconf, struct l2vpn *l2vpn, struct l2vpn *xl)
/* merge intefaces */
RB_FOREACH_SAFE(lif, l2vpn_if_head, &l2vpn->if_tree, ftmp) {
/* find deleted interfaces */
- if ((xf = l2vpn_if_find(xl, lif->ifname)) == NULL) {
+ if (l2vpn_if_find(xl, lif->ifname) == NULL) {
RB_REMOVE(l2vpn_if_head, &l2vpn->if_tree, lif);
free(lif);
}
@@ -1706,7 +1707,7 @@ merge_l2vpn(struct ldpd_conf *xconf, struct l2vpn *l2vpn, struct l2vpn *xl)
/* merge active pseudowires */
RB_FOREACH_SAFE(pw, l2vpn_pw_head, &l2vpn->pw_tree, ptmp) {
/* find deleted active pseudowires */
- if ((xp = l2vpn_pw_find_active(xl, pw->ifname)) == NULL) {
+ if (l2vpn_pw_find_active(xl, pw->ifname) == NULL) {
switch (ldpd_process) {
case PROC_LDE_ENGINE:
l2vpn_pw_exit(pw);
@@ -1807,7 +1808,7 @@ merge_l2vpn(struct ldpd_conf *xconf, struct l2vpn *l2vpn, struct l2vpn *xl)
/* merge inactive pseudowires */
RB_FOREACH_SAFE(pw, l2vpn_pw_head, &l2vpn->pw_inactive_tree, ptmp) {
/* find deleted inactive pseudowires */
- if ((xp = l2vpn_pw_find_inactive(xl, pw->ifname)) == NULL) {
+ if (l2vpn_pw_find_inactive(xl, pw->ifname) == NULL) {
RB_REMOVE(l2vpn_pw_head, &l2vpn->pw_inactive_tree, pw);
free(pw);
}
diff --git a/ldpd/socket.c b/ldpd/socket.c
index 8706d03c6f..997434620a 100644
--- a/ldpd/socket.c
+++ b/ldpd/socket.c
@@ -209,7 +209,7 @@ sock_set_nonblock(int fd)
flags |= O_NONBLOCK;
- if ((flags = fcntl(fd, F_SETFL, flags)) == -1)
+ if (fcntl(fd, F_SETFL, flags) == -1)
fatal("fcntl F_SETFL");
}
@@ -223,7 +223,7 @@ sock_set_cloexec(int fd)
flags |= FD_CLOEXEC;
- if ((flags = fcntl(fd, F_SETFD, flags)) == -1)
+ if (fcntl(fd, F_SETFD, flags) == -1)
fatal("fcntl F_SETFD");
}
diff --git a/lib/filter.c b/lib/filter.c
index 80f8cf0bd0..3226fb2f5e 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -412,7 +412,7 @@ static int64_t filter_new_seq_get(struct access_list *access)
int64_t newseq;
struct filter *filter;
- maxseq = newseq = 0;
+ maxseq = 0;
for (filter = access->head; filter; filter = filter->next) {
if (maxseq < filter->seq)
diff --git a/lib/plist.c b/lib/plist.c
index 2a3a087cf0..e465963f21 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -387,7 +387,7 @@ static int64_t prefix_new_seq_get(struct prefix_list *plist)
int64_t newseq;
struct prefix_list_entry *pentry;
- maxseq = newseq = 0;
+ maxseq = 0;
for (pentry = plist->head; pentry; pentry = pentry->next) {
if (maxseq < pentry->seq)
diff --git a/lib/skiplist.c b/lib/skiplist.c
index 6efa2c362d..67cc1ab378 100644
--- a/lib/skiplist.c
+++ b/lib/skiplist.c
@@ -378,7 +378,7 @@ int skiplist_next_value(register struct skiplist *l, /* in */
void **valuePointer, /* in/out */
void **cursor) /* in/out */
{
- register int k, m;
+ register int k;
register struct skiplistnode *p, *q;
CHECKLAST(l);
@@ -389,7 +389,7 @@ int skiplist_next_value(register struct skiplist *l, /* in */
if (!cursor || !*cursor) {
p = l->header;
- k = m = l->level;
+ k = l->level;
/*
* Find matching key
diff --git a/lib/sockopt.c b/lib/sockopt.c
index d6c88c0aff..52b1f0356e 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -90,12 +90,11 @@ int getsockopt_so_recvbuf(const int sock)
static void *getsockopt_cmsg_data(struct msghdr *msgh, int level, int type)
{
struct cmsghdr *cmsg;
- void *ptr = NULL;
for (cmsg = CMSG_FIRSTHDR(msgh); cmsg != NULL;
cmsg = CMSG_NXTHDR(msgh, cmsg))
if (cmsg->cmsg_level == level && cmsg->cmsg_type == type)
- return (ptr = CMSG_DATA(cmsg));
+ return CMSG_DATA(cmsg);
return NULL;
}
diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c
index c5e985cdac..2d6c263582 100644
--- a/nhrpd/nhrp_peer.c
+++ b/nhrpd/nhrp_peer.c
@@ -755,10 +755,9 @@ static void nhrp_peer_forward(struct nhrp_peer *p,
if ((type == NHRP_EXTENSION_REVERSE_TRANSIT_NHS)
== (packet_types[hdr->type].type == PACKET_REPLY)) {
/* Check NHS list for forwarding loop */
- while ((cie = nhrp_cie_pull(&extpl, pp->hdr,
- &cie_nbma,
- &cie_protocol))
- != NULL) {
+ while (nhrp_cie_pull(&extpl, pp->hdr,
+ &cie_nbma,
+ &cie_protocol) != NULL) {
if (sockunion_same(&p->vc->remote.nbma,
&cie_nbma))
goto err;
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index b4690cfa42..a8dfcbb36b 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -670,8 +670,7 @@ static int ospf_abr_translate_nssa(struct ospf_area *area, struct ospf_lsa *lsa)
* originate translated LSA
*/
- if ((new = ospf_translated_nssa_originate(area->ospf, lsa))
- == NULL) {
+ if (ospf_translated_nssa_originate(area->ospf, lsa) == NULL) {
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
"ospf_abr_translate_nssa(): Could not translate "
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index dffcb930e4..a16fb81ce3 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -158,12 +158,12 @@ const char *ospf_timeval_dump(struct timeval *t, char *buf, size_t size)
#define HOUR_IN_SECONDS (60*MINUTE_IN_SECONDS)
#define DAY_IN_SECONDS (24*HOUR_IN_SECONDS)
#define WEEK_IN_SECONDS (7*DAY_IN_SECONDS)
- unsigned long w, d, h, m, s, ms, us;
+ unsigned long w, d, h, m, ms, us;
if (!t)
return "inactive";
- w = d = h = m = s = ms = us = 0;
+ w = d = h = m = ms = 0;
memset(buf, 0, size);
us = t->tv_usec;
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index a989b8468c..b042a06372 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -1557,8 +1557,8 @@ struct ospf_lsa *ospf_opaque_lsa_install(struct ospf_lsa *lsa, int rt_recalc)
ospf_lsa_unlock(&oipi->lsa);
oipi->lsa = ospf_lsa_lock(lsa);
}
- /* Register the new lsa entry and get its control info. */
- else if ((oipi = register_opaque_lsa(lsa)) == NULL) {
+ /* Register the new lsa entry */
+ else if (register_opaque_lsa(lsa) == NULL) {
flog_warn(EC_OSPF_LSA,
"ospf_opaque_lsa_install: register_opaque_lsa() ?");
goto out;
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 64013435f6..d415256652 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -1002,7 +1002,6 @@ static int ospf_distribute_list_update_timer(struct thread *thread)
void ospf_distribute_list_update(struct ospf *ospf, int type,
unsigned short instance)
{
- struct route_table *rt;
struct ospf_external *ext;
void **args = XCALLOC(MTYPE_OSPF_DIST_ARGS, sizeof(void *) * 2);
@@ -1011,7 +1010,7 @@ void ospf_distribute_list_update(struct ospf *ospf, int type,
/* External info does not exist. */
ext = ospf_external_lookup(ospf, type, instance);
- if (!ext || !(rt = EXTERNAL_INFO(ext))) {
+ if (!ext || !EXTERNAL_INFO(ext)) {
XFREE(MTYPE_OSPF_DIST_ARGS, args);
return;
}
diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c
index 226f722937..4bd160ddbc 100644
--- a/zebra/ipforward_proc.c
+++ b/zebra/ipforward_proc.c
@@ -34,9 +34,7 @@ static const char proc_net_snmp[] = "/proc/net/snmp";
static void dropline(FILE *fp)
{
- int c;
-
- while ((c = getc(fp)) != '\n')
+ while (getc(fp) != '\n')
;
}
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 7b8af4e6b7..8c719f4b6a 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -1532,10 +1532,8 @@ DEFPY (show_route,
if (vrf_all) {
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- struct route_table *route_table;
-
if ((zvrf = vrf->info) == NULL
- || (route_table = zvrf->table[afi][SAFI_UNICAST]) == NULL)
+ || (zvrf->table[afi][SAFI_UNICAST] == NULL))
continue;
if (table_all)