mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
pimd: move all MSDP code to its own place
Guard MSDP code to compile only on IPv4 and remove all MSDP code from PIMv6. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
parent
6d759deea1
commit
d4da6316c7
|
@ -53,7 +53,9 @@ static void pim_instance_terminate(struct pim_instance *pim)
|
|||
|
||||
pim_oil_terminate(pim);
|
||||
|
||||
#if PIM_IPV == 4
|
||||
pim_msdp_exit(pim);
|
||||
#endif /* PIM_IPV == 4 */
|
||||
|
||||
close(pim->reg_sock);
|
||||
|
||||
|
@ -91,7 +93,9 @@ static struct pim_instance *pim_instance_init(struct vrf *vrf)
|
|||
pim->spt.switchover = PIM_SPT_IMMEDIATE;
|
||||
pim->spt.plist = NULL;
|
||||
|
||||
#if PIM_IPV == 4
|
||||
pim_msdp_init(pim, router->master);
|
||||
#endif /* PIM_IPV == 4 */
|
||||
pim_vxlan_init(pim);
|
||||
|
||||
snprintf(hash_name, sizeof(hash_name), "PIM %s RPF Hash", vrf->name);
|
||||
|
|
|
@ -150,7 +150,9 @@ struct pim_instance {
|
|||
|
||||
struct rb_pim_oil_head channel_oil_head;
|
||||
|
||||
#if PIM_IPV == 4
|
||||
struct pim_msdp msdp;
|
||||
#endif /* PIM_IPV == 4 */
|
||||
struct pim_vxlan_instance vxlan;
|
||||
|
||||
struct pim_autorp *autorp;
|
||||
|
@ -225,7 +227,4 @@ extern struct pim_router *router;
|
|||
|
||||
struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id);
|
||||
|
||||
extern bool pim_msdp_log_neighbor_events(const struct pim_instance *pim);
|
||||
extern bool pim_msdp_log_sa_events(const struct pim_instance *pim);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#include "pim_msdp_packet.h"
|
||||
#include "pim_msdp_socket.h"
|
||||
|
||||
// struct pim_msdp pim_msdp, *msdp = &pim_msdp;
|
||||
|
||||
static void pim_msdp_peer_listen(struct pim_msdp_peer *mp);
|
||||
static void pim_msdp_peer_cr_timer_setup(struct pim_msdp_peer *mp, bool start);
|
||||
static void pim_msdp_peer_ka_timer_setup(struct pim_msdp_peer *mp, bool start);
|
||||
|
@ -1468,6 +1466,25 @@ struct pim_msdp_mg_mbr *pim_msdp_mg_mbr_add(struct pim_instance *pim,
|
|||
return mbr;
|
||||
}
|
||||
|
||||
/* MSDP on RP needs to know if a source is registerable to this RP */
|
||||
static void pim_upstream_msdp_reg_timer(struct event *t)
|
||||
{
|
||||
struct pim_upstream *up = EVENT_ARG(t);
|
||||
struct pim_instance *pim = up->channel_oil->pim;
|
||||
|
||||
/* source is no longer active - pull the SA from MSDP's cache */
|
||||
pim_msdp_sa_local_del(pim, &up->sg);
|
||||
}
|
||||
|
||||
void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up)
|
||||
{
|
||||
EVENT_OFF(up->t_msdp_reg_timer);
|
||||
event_add_timer(router->master, pim_upstream_msdp_reg_timer, up, PIM_MSDP_REG_RXED_PERIOD,
|
||||
&up->t_msdp_reg_timer);
|
||||
|
||||
pim_msdp_sa_local_update(up);
|
||||
}
|
||||
|
||||
void pim_msdp_shutdown(struct pim_instance *pim, bool state)
|
||||
{
|
||||
struct pim_msdp_peer *peer;
|
||||
|
|
|
@ -235,8 +235,6 @@ struct pim_msdp {
|
|||
#define PIM_MSDP_PEER_READ_OFF(mp) event_cancel(&mp->t_read)
|
||||
#define PIM_MSDP_PEER_WRITE_OFF(mp) event_cancel(&mp->t_write)
|
||||
|
||||
#if PIM_IPV != 6
|
||||
// struct pim_msdp *msdp;
|
||||
struct pim_instance;
|
||||
void pim_msdp_init(struct pim_instance *pim, struct event_loop *master);
|
||||
void pim_msdp_exit(struct pim_instance *pim);
|
||||
|
@ -263,6 +261,8 @@ void pim_msdp_up_del(struct pim_instance *pim, pim_sgaddr *sg);
|
|||
enum pim_msdp_err pim_msdp_mg_del(struct pim_instance *pim,
|
||||
const char *mesh_group_name);
|
||||
|
||||
extern void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up);
|
||||
|
||||
/**
|
||||
* Allocates a new mesh group data structure under PIM instance.
|
||||
*/
|
||||
|
@ -341,53 +341,7 @@ void pim_msdp_peer_restart(struct pim_msdp_peer *mp);
|
|||
*/
|
||||
void pim_msdp_shutdown(struct pim_instance *pim, bool state);
|
||||
|
||||
#else /* PIM_IPV == 6 */
|
||||
static inline void pim_msdp_init(struct pim_instance *pim,
|
||||
struct event_loop *master)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void pim_msdp_exit(struct pim_instance *pim)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void pim_msdp_i_am_rp_changed(struct pim_instance *pim)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void pim_msdp_up_join_state_changed(struct pim_instance *pim,
|
||||
struct pim_upstream *xg_up)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void pim_msdp_up_del(struct pim_instance *pim, pim_sgaddr *sg)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void pim_msdp_sa_local_update(struct pim_upstream *up)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void pim_msdp_sa_local_del(struct pim_instance *pim,
|
||||
pim_sgaddr *sg)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int pim_msdp_config_write(struct pim_instance *pim,
|
||||
struct vty *vty)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool pim_msdp_peer_config_write(struct vty *vty,
|
||||
struct pim_instance *pim)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void pim_msdp_shutdown(struct pim_instance *pim, bool state)
|
||||
{
|
||||
}
|
||||
#endif /* PIM_IPV == 6 */
|
||||
extern bool pim_msdp_log_neighbor_events(const struct pim_instance *pim);
|
||||
extern bool pim_msdp_log_sa_events(const struct pim_instance *pim);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -709,7 +709,10 @@ int pim_register_recv(struct interface *ifp, pim_addr dest_addr,
|
|||
// inherited_olist(S,G,rpt)
|
||||
// This is taken care of by the kernel for us
|
||||
}
|
||||
|
||||
#if PIM_IPV == 4
|
||||
pim_upstream_msdp_reg_timer_start(upstream);
|
||||
#endif /* PIM_IPV == 4 */
|
||||
} else {
|
||||
if (PIM_DEBUG_PIM_REG) {
|
||||
if (!i_am_rp)
|
||||
|
|
|
@ -343,7 +343,9 @@ struct rp_info *pim_rp_find_match_group(struct pim_instance *pim,
|
|||
*/
|
||||
void pim_rp_refresh_group_to_rp_mapping(struct pim_instance *pim)
|
||||
{
|
||||
#if PIM_IPV == 4
|
||||
pim_msdp_i_am_rp_changed(pim);
|
||||
#endif /* PIM_IPV == 4 */
|
||||
pim_upstream_reeval_use_rpt(pim);
|
||||
}
|
||||
|
||||
|
@ -1030,7 +1032,9 @@ void pim_rp_check_on_if_add(struct pim_interface *pim_ifp)
|
|||
}
|
||||
|
||||
if (i_am_rp_changed) {
|
||||
#if PIM_IPV == 4
|
||||
pim_msdp_i_am_rp_changed(pim);
|
||||
#endif /* PIM_IPV == 4 */
|
||||
pim_upstream_reeval_use_rpt(pim);
|
||||
}
|
||||
}
|
||||
|
@ -1072,7 +1076,9 @@ void pim_i_am_rp_re_evaluate(struct pim_instance *pim)
|
|||
}
|
||||
|
||||
if (i_am_rp_changed) {
|
||||
#if PIM_IPV == 4
|
||||
pim_msdp_i_am_rp_changed(pim);
|
||||
#endif /* PIM_IPV == 4 */
|
||||
pim_upstream_reeval_use_rpt(pim);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,9 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
|
|||
{
|
||||
struct listnode *node, *nnode;
|
||||
struct pim_ifchannel *ch;
|
||||
#if PIM_IPV == 4
|
||||
bool notify_msdp = false;
|
||||
#endif /* PIM_IPV == 4 */
|
||||
|
||||
if (PIM_DEBUG_PIM_TRACE)
|
||||
zlog_debug(
|
||||
|
@ -206,12 +208,14 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
|
|||
if (up->join_state == PIM_UPSTREAM_JOINED) {
|
||||
pim_jp_agg_single_upstream_send(&up->rpf, up, 0);
|
||||
|
||||
#if PIM_IPV == 4
|
||||
if (pim_addr_is_any(up->sg.src)) {
|
||||
/* if a (*, G) entry in the joined state is being
|
||||
* deleted we
|
||||
* need to notify MSDP */
|
||||
notify_msdp = true;
|
||||
}
|
||||
#endif /* PIM_IPV == 4 */
|
||||
}
|
||||
|
||||
join_timer_stop(up);
|
||||
|
@ -221,7 +225,9 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
|
|||
if (!pim_addr_is_any(up->sg.src)) {
|
||||
if (pim->upstream_sg_wheel)
|
||||
wheel_remove_item(pim->upstream_sg_wheel, up);
|
||||
#if PIM_IPV == 4
|
||||
notify_msdp = true;
|
||||
#endif /* PIM_IPV == 4 */
|
||||
}
|
||||
|
||||
pim_mroute_del(up->channel_oil, __func__);
|
||||
|
@ -241,9 +247,11 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
|
|||
|
||||
rb_pim_upstream_del(&pim->upstream_head, up);
|
||||
|
||||
#if PIM_IPV == 4
|
||||
if (notify_msdp) {
|
||||
pim_msdp_up_del(pim, &up->sg);
|
||||
}
|
||||
#endif /* PIM_IPV == 4 */
|
||||
|
||||
/* When RP gets deleted, pim_rp_del() deregister addr with Zebra NHT
|
||||
* and assign up->upstream_addr as INADDR_ANY.
|
||||
|
@ -723,7 +731,9 @@ void pim_upstream_switch(struct pim_instance *pim, struct pim_upstream *up,
|
|||
if (old_state != PIM_UPSTREAM_JOINED) {
|
||||
int old_fhr = PIM_UPSTREAM_FLAG_TEST_FHR(up->flags);
|
||||
|
||||
#if PIM_IPV == 4
|
||||
pim_msdp_up_join_state_changed(pim, up);
|
||||
#endif /* PIM_IPV == 4 */
|
||||
if (pim_upstream_could_register(up)) {
|
||||
PIM_UPSTREAM_FLAG_SET_FHR(up->flags);
|
||||
if (!old_fhr
|
||||
|
@ -753,8 +763,10 @@ void pim_upstream_switch(struct pim_instance *pim, struct pim_upstream *up,
|
|||
if (!pim_addr_is_any(up->sg.src))
|
||||
up->sptbit = PIM_UPSTREAM_SPTBIT_FALSE;
|
||||
|
||||
#if PIM_IPV == 4
|
||||
if (old_state == PIM_UPSTREAM_JOINED)
|
||||
pim_msdp_up_join_state_changed(pim, up);
|
||||
#endif /* PIM_IPV == 4 */
|
||||
|
||||
if (old_state != new_state) {
|
||||
old_use_rpt =
|
||||
|
@ -1424,8 +1436,10 @@ struct pim_upstream *pim_upstream_keep_alive_timer_proc(
|
|||
*/
|
||||
}
|
||||
|
||||
#if PIM_IPV == 4
|
||||
/* source is no longer active - pull the SA from MSDP's cache */
|
||||
pim_msdp_sa_local_del(pim, &up->sg);
|
||||
#endif /* PIM_IPV == 4 */
|
||||
|
||||
/* JoinDesired can change when KAT is started or stopped */
|
||||
pim_upstream_update_join_desired(pim, up);
|
||||
|
@ -1493,32 +1507,15 @@ void pim_upstream_keep_alive_timer_start(struct pim_upstream *up, uint32_t time)
|
|||
event_add_timer(router->master, pim_upstream_keep_alive_timer, up, time,
|
||||
&up->t_ka_timer);
|
||||
|
||||
#if PIM_IPV == 4
|
||||
/* any time keepalive is started against a SG we will have to
|
||||
* re-evaluate our active source database */
|
||||
pim_msdp_sa_local_update(up);
|
||||
#endif /* PIM_IPV == 4 */
|
||||
/* JoinDesired can change when KAT is started or stopped */
|
||||
pim_upstream_update_join_desired(up->pim, up);
|
||||
}
|
||||
|
||||
/* MSDP on RP needs to know if a source is registerable to this RP */
|
||||
static void pim_upstream_msdp_reg_timer(struct event *t)
|
||||
{
|
||||
struct pim_upstream *up = EVENT_ARG(t);
|
||||
struct pim_instance *pim = up->channel_oil->pim;
|
||||
|
||||
/* source is no longer active - pull the SA from MSDP's cache */
|
||||
pim_msdp_sa_local_del(pim, &up->sg);
|
||||
}
|
||||
|
||||
void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up)
|
||||
{
|
||||
EVENT_OFF(up->t_msdp_reg_timer);
|
||||
event_add_timer(router->master, pim_upstream_msdp_reg_timer, up,
|
||||
PIM_MSDP_REG_RXED_PERIOD, &up->t_msdp_reg_timer);
|
||||
|
||||
pim_msdp_sa_local_update(up);
|
||||
}
|
||||
|
||||
/*
|
||||
* 4.2.1 Last-Hop Switchover to the SPT
|
||||
*
|
||||
|
|
|
@ -350,7 +350,6 @@ int pim_upstream_inherited_olist(struct pim_instance *pim,
|
|||
int pim_upstream_empty_inherited_olist(struct pim_upstream *up);
|
||||
|
||||
void pim_upstream_find_new_rpf(struct pim_instance *pim);
|
||||
void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up);
|
||||
|
||||
void pim_upstream_init(struct pim_instance *pim);
|
||||
void pim_upstream_terminate(struct pim_instance *pim);
|
||||
|
|
Loading…
Reference in a new issue