summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetwroks.com>2016-06-23 20:42:19 -0400
committerDonald Sharp <sharpd@cumulusnetwroks.com>2016-06-23 20:42:19 -0400
commit83d8ff0074871c557555cd8448bb8cf1b0e6f923 (patch)
tree0a3ff9a866b821bd820b285b48a887dcb1ca3c7d
parent09c02cc3c0dd6fcadd57ba085f263a174a75dc50 (diff)
pimd: Fix register receive pointer arithmetic
When receiving the register packet from another pim neighbor at the RP, we were adding an incorrect amount of bytes to find the start of the ip_hdr of the encapsulated data. This commit fixes this issue. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--pimd/pim_register.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/pimd/pim_register.c b/pimd/pim_register.c
index 75c1ba8717..07f9652fe8 100644
--- a/pimd/pim_register.c
+++ b/pimd/pim_register.c
@@ -193,11 +193,18 @@ pim_register_recv (struct interface *ifp,
* We need to know the inner source and dest
*/
bits = (uint32_t *)tlv_buf;
- ip_hdr = (struct ip *)(tlv_buf + PIM_MSG_REGISTER_LEN);
+
+ /*
+ * tlv_buf points to the start of the |B|N|... Reserved
+ * Line above. So we need to add 4 bytes to get to the
+ * start of the actual Encapsulated data.
+ */
+#define PIM_MSG_REGISTER_BIT_RESERVED_LEN 4
+ ip_hdr = (struct ip *)(tlv_buf + PIM_MSG_REGISTER_BIT_RESERVED_LEN);
//hlen = (ip_hdr->ip_hl << 2) | PIM_MSG_REGISTER_LEN;
//msg = (uint8_t *)tlv_buf + hlen;
- group = ip_hdr->ip_src;
- source = ip_hdr->ip_dst;
+ source = ip_hdr->ip_src;
+ group = ip_hdr->ip_dst;
if (I_am_RP (group) && (dest_addr.s_addr == ((RP (group))->rpf_addr.s_addr))) {
sentRegisterStop = 0;