summaryrefslogtreecommitdiff
path: root/pimd/pim_pim.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-10-20 08:36:37 -0700
committerDonald Sharp <sharpd@cumulusnetwroks.com>2016-05-25 20:38:34 -0400
commit77e390e59e924b05d40e40b60430560d0e88b426 (patch)
tree3f2c5dbd4edcefdc9a67bd45e32f25e59801c669 /pimd/pim_pim.c
parent8813406fe9d83b07aab640c27c5c8ede29ea7ada (diff)
pimd: Start handling of pim REGISTER packet type
This code starts the handling of the pim register type. No guarantees that it works correctly, just that it compiles and the start of the code is in there. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_pim.c')
-rw-r--r--pimd/pim_pim.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index a04a0afc80..5912709fe6 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -39,6 +39,7 @@
#include "pim_join.h"
#include "pim_assert.h"
#include "pim_msg.h"
+#include "pim_register.h"
static int on_pim_hello_send(struct thread *t);
static int pim_hello_send(struct interface *ifp,
@@ -206,8 +207,7 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len)
pim_version, pim_type, pim_msg_len, checksum);
}
- if (pim_type == PIM_MSG_TYPE_REGISTER ||
- pim_type == PIM_MSG_TYPE_REG_STOP ||
+ if (pim_type == PIM_MSG_TYPE_REG_STOP ||
pim_type == PIM_MSG_TYPE_BOOTSTRAP ||
pim_type == PIM_MSG_TYPE_GRAFT ||
pim_type == PIM_MSG_TYPE_GRAFT_ACK ||
@@ -221,11 +221,16 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len)
}
if (pim_type == PIM_MSG_TYPE_HELLO) {
- int result = pim_hello_recv(ifp,
- ip_hdr->ip_src,
- pim_msg + PIM_MSG_HEADER_LEN,
- pim_msg_len - PIM_MSG_HEADER_LEN);
- return result;
+ return pim_hello_recv(ifp,
+ ip_hdr->ip_src,
+ pim_msg + PIM_MSG_HEADER_LEN,
+ pim_msg_len - PIM_MSG_HEADER_LEN);
+ } else if (pim_type == PIM_MSG_TYPE_REGISTER) {
+ return pim_register_recv(ifp,
+ ip_hdr->ip_dst,
+ ip_hdr->ip_src,
+ pim_msg + PIM_MSG_HEADER_LEN,
+ pim_msg_len - PIM_MSG_HEADER_LEN);
}
neigh = pim_neighbor_find(ifp, ip_hdr->ip_src);
@@ -242,15 +247,18 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len)
ip_hdr->ip_src,
pim_msg + PIM_MSG_HEADER_LEN,
pim_msg_len - PIM_MSG_HEADER_LEN);
+ break;
case PIM_MSG_TYPE_ASSERT:
return pim_assert_recv(ifp, neigh,
ip_hdr->ip_src,
pim_msg + PIM_MSG_HEADER_LEN,
pim_msg_len - PIM_MSG_HEADER_LEN);
+ break;
default:
zlog_warn("%s %s: unsupported PIM message type=%d from %s on %s",
__FILE__, __PRETTY_FUNCTION__,
pim_type, src_str, ifp->name);
+ break;
}
return -1;