summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-11-23 11:07:05 +0200
committerGitHub <noreply@github.com>2022-11-23 11:07:05 +0200
commit89f74214e7d109f7ff48c9666dab65b741636a09 (patch)
tree762cd2abdb39cde081f6d24ab2fc27cb842dc425
parent2387dca4dcf35c7adf936c94816f5ab8f92fb550 (diff)
parenta23a485cbff96fc3cfca50a309977fd5dea06639 (diff)
Merge pull request #12355 from mobash-rasool/pim6-conformance
pim6d, pimd: RFC conformance - Discard join/prune msg when WC bit is set but RPT bit is unset
-rw-r--r--pimd/pim_join.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/pimd/pim_join.c b/pimd/pim_join.c
index 8c7ae80d2b..e028b6aa77 100644
--- a/pimd/pim_join.c
+++ b/pimd/pim_join.c
@@ -72,8 +72,21 @@ static void recv_join(struct interface *ifp, struct pim_neighbor *neigh,
* If the RPT and WC are set it's a (*,G)
* and the source is the RP
*/
- 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 join since WC bit is set but RPT bit is unset",
+ sg);
+
+ return;
+ }
+
struct pim_rpf *rp = RP(pim_ifp->pim, sg->grp);
pim_addr rpf_addr;
@@ -127,8 +140,21 @@ static void recv_prune(struct interface *ifp, struct pim_neighbor *neigh,
++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