mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 04:36:45 +00:00
pimd: Add RP check code
Add the ability for the node to determine if it is the RP or not. Currently this only allows static RP's. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
8f5f5e91b6
commit
54b97c74fe
@ -20,11 +20,59 @@
|
||||
*/
|
||||
#include <zebra.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "network.h"
|
||||
|
||||
#include "pimd.h"
|
||||
#include "pim_str.h"
|
||||
#include "pim_rp.h"
|
||||
|
||||
static int i_am_rp = 0;
|
||||
|
||||
/*
|
||||
* Checks to see if we should elect ourself the actual RP
|
||||
*/
|
||||
void
|
||||
pim_rp_check_rp (struct in_addr old, struct in_addr new)
|
||||
{
|
||||
if (PIM_DEBUG_ZEBRA) {
|
||||
char sold[100];
|
||||
char snew[100];
|
||||
char rp[100];
|
||||
pim_inet4_dump("<rp?>", qpim_rp, 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 == 0)
|
||||
return;
|
||||
|
||||
if (new.s_addr == qpim_rp.s_addr)
|
||||
{
|
||||
i_am_rp = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (old.s_addr == qpim_rp.s_addr)
|
||||
{
|
||||
i_am_rp = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* I_am_RP(G) is true if the group-to-RP mapping indicates that
|
||||
* this router is the RP for the group.
|
||||
*
|
||||
* Since we only have static RP, all groups are part of this RP
|
||||
*/
|
||||
int
|
||||
pim_rp_i_am_rp (struct in_addr group)
|
||||
{
|
||||
return i_am_rp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the upstream IP address we want to talk to based upon
|
||||
* the rp configured and the source address
|
||||
|
@ -21,6 +21,8 @@
|
||||
#ifndef PIM_RP_H
|
||||
#define PIM_RP_H
|
||||
|
||||
void pim_rp_check_rp (struct in_addr old, struct in_addr new);
|
||||
int pim_rp_i_am_rp (struct in_addr group);
|
||||
int pim_rp_set_upstream_addr (struct in_addr *up, struct in_addr source);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user