++pim_ifp->pim_ifstat_prune_recv;
- if ((source_flags & PIM_RPT_BIT_MASK)
- && (source_flags & PIM_WILDCARD_BIT_MASK)) {
+ if (CHECK_FLAG(source_flags, PIM_WILDCARD_BIT_MASK)) {
+ /* As per RFC 7761 Section 4.9.1:
+ * The RPT (or Rendezvous Point Tree) bit is a 1-bit value for
+ * use with PIM Join/Prune messages (see Section 4.9.5.1). If
+ * the WC bit is 1, the RPT bit MUST be 1.
+ */
+ if (!CHECK_FLAG(source_flags, PIM_RPT_BIT_MASK)) {
+ if (PIM_DEBUG_PIM_J_P)
+ zlog_debug(
+ "Discarding (*,G)=%pSG prune since WC bit is set but RPT bit is unset",
+ sg);
+
+ return;
+ }
+
/*
* RFC 4601 Section 4.5.2:
* Received Prune(*,G) messages are processed even if the