#include "pim_macro.h"
#include "pim_rp.h"
#include "pim_oil.h"
+#include "pim_register.h"
/* GLOBAL VARS */
extern struct zebra_privs_t pimd_privs;
const struct ip *ip_hdr;
struct pim_upstream *up;
- zlog_debug("%s:", __PRETTY_FUNCTION__);
ip_hdr = (const struct ip *)buf;
src = ip_hdr->ip_src;
return 0;
}
+ pim_ifp = up->rpf.source_nexthop.interface->info;
+
rpg = RP(group);
if ((rpg->rpf_addr.s_addr == INADDR_NONE) ||
(!pim_ifp) ||
(!PIM_I_am_DR(pim_ifp)) ||
(pim_ifp->itype == PIM_INTERFACE_SSM)) {
+ if (PIM_DEBUG_PIM_TRACE) {
+ zlog_debug("%s: Failed Check send packet", __PRETTY_FUNCTION__);
+ }
return 0;
}
- //pim_register_send(buf, rpg);
+ pim_register_send((const struct ip *)(buf + sizeof(struct ip)), rpg);
return 0;
}
#include "thread.h"
#include "pimd.h"
+#include "pim_mroute.h"
+#include "pim_iface.h"
+#include "pim_msg.h"
+#include "pim_pim.h"
#include "pim_str.h"
#include "pim_rp.h"
#include "pim_register.h"
return;
}
+void
+pim_register_send (const struct ip *ip_hdr, struct pim_rpf *rpg)
+{
+ unsigned char buffer[3000];
+ unsigned char *b1;
+ struct pim_interface *pinfo;
+ struct interface *ifp;
+ uint32_t plen;
+
+ ifp = rpg->source_nexthop.interface;
+ pinfo = (struct pim_interface *)ifp->info;
+ if (!pinfo) {
+ zlog_debug("%s: No pinfo!\n", __PRETTY_FUNCTION__);
+ return;
+ }
+
+ memset(buffer, 0, 3000);
+ b1 = buffer + PIM_MSG_REGISTER_LEN;
+
+ plen = ntohs(ip_hdr->ip_len);
+ memcpy(b1, (unsigned char *)ip_hdr, plen);
+
+ pim_msg_build_header(buffer, plen + PIM_MSG_HEADER_LEN, PIM_MSG_TYPE_REGISTER);
+
+ if (pim_msg_send(pinfo->pim_sock_fd,
+ rpg->rpf_addr,
+ buffer,
+ plen + PIM_MSG_REGISTER_LEN,
+ ifp->name)) {
+ if (PIM_DEBUG_PIM_TRACE) {
+ zlog_debug("%s: could not send PIM register message on interface %s",
+ __PRETTY_FUNCTION__, ifp->name);
+ }
+ return;
+ }
+}
+
/*
* 4.4.2 Receiving Register Messages at the RP
*
#define PIM_REGISTER_BORDER_BIT 0x80000000
#define PIM_REGISTER_NR_BIT 0x40000000
-#define PIM_MSG_REGISTER_LEN (4)
+#define PIM_MSG_REGISTER_LEN (8)
void pim_register_send_test_packet_start (struct in_addr source,
struct in_addr group,
struct in_addr src_addr,
uint8_t *tlv_buf, int tlv_buf_size);
+void pim_register_send (const struct ip *msg, struct pim_rpf *rpg);
+
#endif