]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: pi->peer assignment exists no need for null check
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 6 Apr 2019 23:53:55 +0000 (19:53 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 7 Apr 2019 00:10:52 +0000 (20:10 -0400)
The creation of a new `struct bgp_path_info` requires a legitimate
peer being passed in for creation.  There exists no code paths
where this is not true.  As such checking pi->peer for null convinces
SA that it might happen.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_route.c

index ad9d22a7a5d332e281b2cec675c8696410872938..555a08552227f030dcc8dc82bc08cfa0c54a6808 100644 (file)
@@ -1941,7 +1941,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
                                continue;
                        if (BGP_PATH_HOLDDOWN(pi1))
                                continue;
-                       if (pi1->peer && pi1->peer != bgp->peer_self)
+                       if (pi1->peer != bgp->peer_self)
                                if (pi1->peer->status != Established)
                                        continue;
 
@@ -1953,11 +1953,10 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_node *rn,
                                                continue;
                                        if (BGP_PATH_HOLDDOWN(pi2))
                                                continue;
-                                       if (pi2->peer
-                                           && pi2->peer != bgp->peer_self
+                                       if (pi2->peer != bgp->peer_self
                                            && !CHECK_FLAG(
-                                                      pi2->peer->sflags,
-                                                      PEER_STATUS_NSF_WAIT))
+                                                   pi2->peer->sflags,
+                                                   PEER_STATUS_NSF_WAIT))
                                                if (pi2->peer->status
                                                    != Established)
                                                        continue;