Modify the RP data structure to know how to get to it from here.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
{
int result;
- result = inet_pton(AF_INET, argv[0], &qpim_rp);
+ result = inet_pton(AF_INET, argv[0], &qpim_rp.rpf_addr.s_addr);
if (result <= 0) {
vty_out(vty, "%% Bad RP address specified: %s", argv[0]);
return CMD_WARNING;
}
+ if (pim_nexthop_lookup(&qpim_rp.source_nexthop, qpim_rp.rpf_addr) != 0) {
+ vty_out(vty, "%% No Path to RP address specified: %s", argv[0]);
+ return CMD_WARNING;
+ }
+
return CMD_SUCCESS;
}
"Rendevous Point"
"ip address of RP")
{
- qpim_rp.s_addr = 0;
+ qpim_rp.rpf_addr.s_addr = INADDR_NONE;
return CMD_SUCCESS;
}
#include "pim_time.h"
#include "pim_iface.h"
#include "pim_macro.h"
+#include "pim_rp.h"
/* GLOBAL VARS */
extern struct zebra_privs_t pimd_privs;
{
struct mfcctl mc;
struct pim_interface *pim_ifp = ifp->info;
+ struct in_addr rpg;
+ rpg = RP(msg->im_dst);
/*
* If the incoming interface is unknown OR
* the Interface type is SSM we don't need to
* do anything here
*/
- if ((qpim_rp.s_addr == INADDR_NONE) ||
+ if ((rpg.s_addr == INADDR_NONE) ||
(!pim_ifp) ||
(!PIM_I_am_DR(pim_ifp)) ||
(pim_ifp->itype == PIM_INTERFACE_SSM))
}
static int
-pim_mroute_msg_wholepkt (int fd, struct interface *ifp, const struct igmpmsg *msg,
+pim_mroute_msg_wholepkt (int fd, struct interface *ifp, const char *buf,
const char *src_str, const char *grp_str)
{
+ struct pim_interface *pim_ifp = ifp->info;
+ struct in_addr group;
+ struct in_addr rpg;
+ const struct ip *ip_hdr;
- if (qpim_rp.s_addr == INADDR_NONE) {
- if (PIM_DEBUG_PIM_TRACE) {
- zlog_debug("%s: Received WHOLEPKT with no RP configured to send it to",
- __PRETTY_FUNCTION__);
- }
+ ip_hdr = (const struct ip *)buf;
+
+ group = ip_hdr->ip_dst;
+
+ rpg = RP(group);
+
+ if ((rpg.s_addr == INADDR_NONE) ||
+ (!pim_ifp) ||
+ (!PIM_I_am_DR(pim_ifp)) ||
+ (pim_ifp->itype == PIM_INTERFACE_SSM)) {
+ return 0;
}
+ //pim_register_send(buf, rpg);
return 0;
}
return pim_mroute_msg_nocache(fd, ifp, msg, src_str, grp_str);
break;
case IGMPMSG_WHOLEPKT:
+ zlog_hexdump(buf, buf_size);
return pim_mroute_msg_wholepkt(fd, ifp, msg, src_str, grp_str);
break;
default:
* type of configuration.
* Note - Premature optimization might bite our patooeys' here.
*/
- if (I_am_RP(dest_addr) && (dest_addr.s_addr == qpim_rp.s_addr))
+ if (I_am_RP(dest_addr) && (dest_addr.s_addr == qpim_rp.rpf_addr.s_addr))
return 1;
if (if_lookup_exact_address (&dest_addr, AF_INET))
char sold[100];
char snew[100];
char rp[100];
- pim_inet4_dump("<rp?>", qpim_rp, rp, sizeof(rp));
+ pim_inet4_dump("<rp?>", qpim_rp.rpf_addr, rp, sizeof(rp));
pim_inet4_dump("<old?>", old, sold, sizeof(sold));
pim_inet4_dump("<new?>", new, snew, sizeof(snew));
zlog_debug("%s: %s for old %s new %s", __func__, rp, sold, snew );
}
- if (qpim_rp.s_addr == INADDR_NONE)
+ if (qpim_rp.rpf_addr.s_addr == INADDR_NONE)
return;
- if (new.s_addr == qpim_rp.s_addr)
+ if (new.s_addr == qpim_rp.rpf_addr.s_addr)
{
i_am_rp = 1;
return;
}
- if (old.s_addr == qpim_rp.s_addr)
+ if (old.s_addr == qpim_rp.rpf_addr.s_addr)
{
i_am_rp = 0;
return;
/*
* For staticly configured RP, it is always the qpim_rp
*/
- return(qpim_rp);
+ return(qpim_rp.rpf_addr);
}
/*
int
pim_rp_set_upstream_addr (struct in_addr *up, struct in_addr source)
{
- if ((qpim_rp.s_addr == INADDR_NONE) && (source.s_addr == 0xFFFFFFFF))
+ if ((qpim_rp.rpf_addr.s_addr == INADDR_NONE) && (source.s_addr == INADDR_ANY))
{
if (PIM_DEBUG_PIM_TRACE)
zlog_debug("%s: Received a (*,G) with no RP configured", __PRETTY_FUNCTION__);
return 0;
}
- *up = (source.s_addr == 0xFFFFFFFF) ? qpim_rp : source;
+ *up = (source.s_addr == INADDR_ANY) ? qpim_rp.rpf_addr : source;
return 1;
}
vty_out(vty, "%s%s", PIM_CMD_IP_MULTICAST_ROUTING, VTY_NEWLINE);
++writes;
}
- if (qpim_rp.s_addr) {
- vty_out(vty, "ip pim rp %s%s", inet_ntop(AF_INET, &qpim_rp, buffer, 32), VTY_NEWLINE);
+ if (qpim_rp.rpf_addr.s_addr != INADDR_NONE) {
+ vty_out(vty, "ip pim rp %s%s", inet_ntop(AF_INET, &qpim_rp.rpf_addr, buffer, 32), VTY_NEWLINE);
++writes;
}
int64_t qpim_mroute_del_events = 0;
int64_t qpim_mroute_del_last = 0;
struct list *qpim_static_route_list = 0;
-struct in_addr qpim_rp = { .s_addr = INADDR_NONE };
+struct pim_rpf qpim_rp = { .rpf_addr.s_addr = INADDR_NONE };
int32_t qpim_register_suppress_time = PIM_REGISTER_SUPPRESSION_TIME_DEFAULT;
int32_t qpim_register_probe_time = PIM_REGISTER_PROBE_TIME_DEFAULT;
int64_t qpim_mroute_del_events;
int64_t qpim_mroute_del_last;
struct list *qpim_static_route_list; /* list of routes added statically */
-extern struct in_addr qpim_rp;
+struct pim_rpf qpim_rp;
#define PIM_JP_HOLDTIME (qpim_t_periodic * 7 / 2)