[pim] Move encoded source address length check to pim_parse_addr_source
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index b8f2581..82db37f 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -392,7 +392,7 @@
       /* this is a general query */
 
       /* log that general query should have the s_flag set */
-      zlog_warn("General IGMP query v%d from %s on %s: Router-Side Processing flag is clear",
+      zlog_warn("General IGMP query v%d from %s on %s: Suppress Router-Side Processing flag is clear",
 		query_version, from_str, ifp->name);
     }
     else {
diff --git a/pimd/pim_join.c b/pimd/pim_join.c
index 6b46759..aa3aa78 100644
--- a/pimd/pim_join.c
+++ b/pimd/pim_join.c
@@ -240,18 +240,6 @@
 	return -7;
       }
 
-	  /* 
-	    RFC 4601: 4.9.1  Encoded Source and Group Address Formats
-
-		Encoded-Source Address
-		(...)
-	    The mask length MUST be equal to the mask length in bits for the
-        given Address Family and Encoding Type (32 for IPv4 native and
-        128 for IPv6 native).  A router SHOULD ignore any messages
-        received with any other mask length.
-	  */
-	  if (msg_source_addr.prefixlen!=32) return;
-
       buf += addr_offset;
 
       recv_join(ifp, neigh, msg_holdtime,
@@ -271,18 +259,6 @@
 	return -8;
       }
 
-	  /* 
-	    RFC 4601: 4.9.1  Encoded Source and Group Address Formats
-
-		Encoded-Source Address
-		(...)
-	    The mask length MUST be equal to the mask length in bits for the
-        given Address Family and Encoding Type (32 for IPv4 native and
-        128 for IPv6 native).  A router SHOULD ignore any messages
-        received with any other mask length.
-	  */
-	  if (msg_source_addr.prefixlen!=32) return;
-
       buf += addr_offset;
 
       recv_prune(ifp, neigh, msg_holdtime,
diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c
index c578a70..fc48c88 100644
--- a/pimd/pim_tlv.c
+++ b/pimd/pim_tlv.c
@@ -559,6 +559,24 @@
     p->u.prefix4 = *(const struct in_addr *) addr;
     p->prefixlen = mask_len;
 
+    /* 
+       RFC 4601: 4.9.1  Encoded Source and Group Address Formats
+
+       Encoded-Source Address
+
+       The mask length MUST be equal to the mask length in bits for
+       the given Address Family and Encoding Type (32 for IPv4 native
+       and 128 for IPv6 native).  A router SHOULD ignore any messages
+       received with any other mask length.
+    */
+    if (p->prefixlen != 32) {
+      char src_str[100];
+      pim_inet4_dump("<src?>", p->u.prefix4, src_str, sizeof(src_str));
+      zlog_warn("%s: IPv4 bad source address mask: %s/%d",
+		__PRETTY_FUNCTION__, src_str, p->prefixlen);
+      return -4;
+    }
+
     addr += sizeof(struct in_addr);
 
     break;
@@ -569,7 +587,7 @@
       zlog_warn("%s: unknown source address encoding family=%d from %s on %s",
 		__PRETTY_FUNCTION__,
 		family, src_str, ifname);
-      return -4;
+      return -5;
     }
   }