summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_route.c4
-rw-r--r--bgpd/bgp_updgrp_packet.c2
-rw-r--r--bgpd/bgpd.c2
-rw-r--r--nhrpd/nhrp_route.c4
-rw-r--r--scripts/coccinelle/test_after_assert.cocci7
-rw-r--r--zebra/zebra_rnh.c3
6 files changed, 13 insertions, 9 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index c8e4ef1bb6..bcd87eb01b 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -122,8 +122,6 @@ struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi,
struct bgp_node *prn = NULL;
assert(table);
- if (!table)
- return NULL;
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)
|| (safi == SAFI_EVPN)) {
@@ -4908,8 +4906,6 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p,
#endif
assert(bgp_static);
- if (!bgp_static)
- return;
rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, NULL);
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index 89199d05cb..4dc9dfa39a 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -330,8 +330,6 @@ void bpacket_queue_remove_peer(struct peer_af *paf)
q = PAF_PKTQ(paf);
assert(q);
- if (!q)
- return;
LIST_REMOVE(paf, pkt_train);
paf->next_pkt_to_send = NULL;
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 006306b260..736f0fc057 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1200,8 +1200,6 @@ struct peer *peer_new(struct bgp *bgp)
/* bgp argument is absolutely required */
assert(bgp);
- if (!bgp)
- return NULL;
/* Allocate new peer. */
peer = XCALLOC(MTYPE_BGP_PEER, sizeof(struct peer));
diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c
index a23ac34745..ddb69a1aca 100644
--- a/nhrpd/nhrp_route.c
+++ b/nhrpd/nhrp_route.c
@@ -199,6 +199,10 @@ int nhrp_route_read(ZAPI_CALLBACK_ARGS)
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX))
return 0;
+ /* ignore our routes */
+ if (api.type == ZEBRA_ROUTE_NHRP)
+ return 0;
+
sockunion_family(&nexthop_addr) = AF_UNSPEC;
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP)) {
api_nh = &api.nexthops[0];
diff --git a/scripts/coccinelle/test_after_assert.cocci b/scripts/coccinelle/test_after_assert.cocci
new file mode 100644
index 0000000000..30596a89c2
--- /dev/null
+++ b/scripts/coccinelle/test_after_assert.cocci
@@ -0,0 +1,7 @@
+@@
+identifier i;
+@@
+
+assert(i);
+- if (!i)
+- return ...;
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index b538126632..35a4db3064 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -669,7 +669,8 @@ zebra_rnh_resolve_nexthop_entry(struct zebra_vrf *zvrf, afi_t afi,
zebra_route_string(re->type));
continue;
}
- if (!CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED)) {
+ if (!CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED) &&
+ !CHECK_FLAG(re->flags, ZEBRA_FLAG_FIB_OVERRIDE)) {
if (IS_ZEBRA_DEBUG_NHT_DETAILED)
zlog_debug(
"\tRoute Entry %s !selected",