]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Only debug in the unusual case
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 10 Feb 2017 20:14:16 +0000 (15:14 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 24 Feb 2017 15:03:40 +0000 (10:03 -0500)
When receiving a J/P packet, only check to see if we should
log when the J/P packet is not for us.

Very slight performance improvement additionally

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

index 3caac4cda697a5d4b1594a4e096af46311e9f13e..0b5baf9756490cf4b0d2abea995aadeb3a65f37f 100644 (file)
@@ -678,12 +678,13 @@ static void check_recv_upstream(int is_join,
   pim_upstream_join_timer_decrease_to_t_override("Prune(S,G)", up);
 }
 
-static int nonlocal_upstream(int is_join,
-                            struct interface *recv_ifp,
-                            struct in_addr upstream,
-                            struct prefix_sg *sg,
-                            uint8_t source_flags,
-                            uint16_t holdtime)
+static int
+nonlocal_upstream(int is_join,
+                  struct interface *recv_ifp,
+                  struct in_addr upstream,
+                  struct prefix_sg *sg,
+                  uint8_t source_flags,
+                  uint16_t holdtime)
 {
   struct pim_interface *recv_pim_ifp;
   int is_local; /* boolean */
@@ -692,27 +693,26 @@ static int nonlocal_upstream(int is_join,
   zassert(recv_pim_ifp);
 
   is_local = (upstream.s_addr == recv_pim_ifp->primary_address.s_addr);
-  
+
+  if (is_local)
+    return 0;
+
   if (PIM_DEBUG_PIM_TRACE_DETAIL) {
     char up_str[INET_ADDRSTRLEN];
     pim_inet4_dump("<upstream?>", upstream, up_str, sizeof(up_str));
-    zlog_warn("%s: recv %s (S,G)=%s to %s upstream=%s on %s",
-             __PRETTY_FUNCTION__,
-             is_join ? "join" : "prune",
-             pim_str_sg_dump (sg),
-             is_local ? "local" : "non-local",
-             up_str, recv_ifp->name);
+    zlog_warn("%s: recv %s (S,G)=%s to non-local upstream=%s on %s",
+              __PRETTY_FUNCTION__,
+              is_join ? "join" : "prune",
+              pim_str_sg_dump (sg),
+              up_str, recv_ifp->name);
   }
 
-  if (is_local)
-    return 0;
-
   /*
-    Since recv upstream addr was not directed to our primary
-    address, check if we should react to it in any way.
-  */
+   * Since recv upstream addr was not directed to our primary
+   * address, check if we should react to it in any way.
+   */
   check_recv_upstream(is_join, recv_ifp, upstream, sg,
-                     source_flags, holdtime);
+                      source_flags, holdtime);
 
   return 1; /* non-local */
 }