pimd: Allow the keepalive time to be per vrf.

Allow the keepalive period to be per vrf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-07-12 21:16:00 -04:00
parent 9fb302f41d
commit 19b807ca17
10 changed files with 22 additions and 21 deletions

View File

@ -5161,7 +5161,7 @@ DEFUN (ip_pim_keep_alive,
"Seconds\n") "Seconds\n")
{ {
PIM_DECLVAR_CONTEXT(vrf, pim); PIM_DECLVAR_CONTEXT(vrf, pim);
qpim_keep_alive_time = atoi(argv[3]->arg); pim->keep_alive_time = atoi(argv[3]->arg);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -5175,7 +5175,7 @@ DEFUN (no_ip_pim_keep_alive,
"Seconds\n") "Seconds\n")
{ {
PIM_DECLVAR_CONTEXT(vrf, pim); PIM_DECLVAR_CONTEXT(vrf, pim);
qpim_keep_alive_time = PIM_KEEPALIVE_PERIOD; pim->keep_alive_time = PIM_KEEPALIVE_PERIOD;
return CMD_SUCCESS; return CMD_SUCCESS;
} }

View File

@ -844,7 +844,7 @@ void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr,
PIM_UPSTREAM_FLAG_MASK_SRC_LHR, PIM_UPSTREAM_FLAG_MASK_SRC_LHR,
__PRETTY_FUNCTION__); __PRETTY_FUNCTION__);
pim_upstream_keep_alive_timer_start( pim_upstream_keep_alive_timer_start(
ch->upstream, qpim_keep_alive_time); ch->upstream, pim_ifp->pim->keep_alive_time);
} }
break; break;
case PIM_IFJOIN_JOIN: case PIM_IFJOIN_JOIN:

View File

@ -74,6 +74,10 @@ static struct pim_instance *pim_instance_init(struct vrf *vrf)
pim_if_init(pim); pim_if_init(pim);
pim->keep_alive_time = PIM_KEEPALIVE_PERIOD;
pim->rp_keep_alive_time = PIM_RP_KEEPALIVE_PERIOD;
pim->vrf_id = vrf->vrf_id; pim->vrf_id = vrf->vrf_id;
pim->vrf = vrf; pim->vrf = vrf;

View File

@ -88,6 +88,9 @@ struct pim_instance {
struct list *ssmpingd_list; struct list *ssmpingd_list;
struct in_addr ssmpingd_group_addr; struct in_addr ssmpingd_group_addr;
unsigned int keep_alive_time;
unsigned int rp_keep_alive_time;
}; };
void pim_vrf_init(void); void pim_vrf_init(void);

View File

@ -204,7 +204,7 @@ static int pim_mroute_msg_nocache(int fd, struct interface *ifp,
} }
PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up->flags); PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up->flags);
pim_upstream_keep_alive_timer_start(up, qpim_keep_alive_time); pim_upstream_keep_alive_timer_start(up, pim_ifp->pim->keep_alive_time);
up->channel_oil->cc.pktcnt++; up->channel_oil->cc.pktcnt++;
PIM_UPSTREAM_FLAG_SET_FHR(up->flags); PIM_UPSTREAM_FLAG_SET_FHR(up->flags);
@ -258,7 +258,7 @@ static int pim_mroute_msg_wholepkt(int fd, struct interface *ifp,
return 0; return 0;
} }
pim_upstream_keep_alive_timer_start( pim_upstream_keep_alive_timer_start(
up, qpim_keep_alive_time); up, pim_ifp->pim->keep_alive_time);
pim_upstream_inherited_olist(pim_ifp->pim, up); pim_upstream_inherited_olist(pim_ifp->pim, up);
pim_upstream_switch(pim_ifp->pim, up, pim_upstream_switch(pim_ifp->pim, up,
PIM_UPSTREAM_JOINED); PIM_UPSTREAM_JOINED);
@ -507,7 +507,7 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
up->sptbit = PIM_UPSTREAM_SPTBIT_TRUE; up->sptbit = PIM_UPSTREAM_SPTBIT_TRUE;
} }
pim_upstream_keep_alive_timer_start( pim_upstream_keep_alive_timer_start(
up, qpim_keep_alive_time); up, pim_ifp->pim->keep_alive_time);
pim_upstream_inherited_olist(pim_ifp->pim, up); pim_upstream_inherited_olist(pim_ifp->pim, up);
pim_mroute_msg_wholepkt(fd, ifp, buf); pim_mroute_msg_wholepkt(fd, ifp, buf);
} }
@ -530,7 +530,7 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
return -2; return -2;
} }
PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up->flags); PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up->flags);
pim_upstream_keep_alive_timer_start(up, qpim_keep_alive_time); pim_upstream_keep_alive_timer_start(up, pim_ifp->pim->keep_alive_time);
up->channel_oil = oil; up->channel_oil = oil;
up->channel_oil->cc.pktcnt++; up->channel_oil->cc.pktcnt++;
pim_register_join(up); pim_register_join(up);
@ -978,7 +978,7 @@ void pim_mroute_update_counters(struct channel_oil *c_oil)
c_oil->cc.oldwrong_if = c_oil->cc.wrong_if; c_oil->cc.oldwrong_if = c_oil->cc.wrong_if;
if (!c_oil->installed) { if (!c_oil->installed) {
c_oil->cc.lastused = 100 * qpim_keep_alive_time; c_oil->cc.lastused = 100 * pim->keep_alive_time;
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
struct prefix_sg sg; struct prefix_sg sg;

View File

@ -417,10 +417,10 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
|| (SwitchToSptDesired(pim_ifp->pim, &sg))) { || (SwitchToSptDesired(pim_ifp->pim, &sg))) {
if (sentRegisterStop) { if (sentRegisterStop) {
pim_upstream_keep_alive_timer_start( pim_upstream_keep_alive_timer_start(
upstream, qpim_rp_keep_alive_time); upstream, pim_ifp->pim->rp_keep_alive_time);
} else { } else {
pim_upstream_keep_alive_timer_start( pim_upstream_keep_alive_timer_start(
upstream, qpim_keep_alive_time); upstream, pim_ifp->pim->keep_alive_time);
} }
} }

View File

@ -541,7 +541,7 @@ void pim_upstream_switch(struct pim_instance *pim, struct pim_upstream *up,
&& PIM_UPSTREAM_FLAG_TEST_SRC_STREAM( && PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(
up->flags)) { up->flags)) {
pim_upstream_keep_alive_timer_start( pim_upstream_keep_alive_timer_start(
up, qpim_keep_alive_time); up, pim->keep_alive_time);
pim_register_join(up); pim_register_join(up);
} }
} else { } else {
@ -1664,9 +1664,9 @@ static void pim_upstream_sg_running(void *arg)
PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up->flags); PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up->flags);
pim_upstream_fhr_kat_start(up); pim_upstream_fhr_kat_start(up);
} }
pim_upstream_keep_alive_timer_start(up, qpim_keep_alive_time); pim_upstream_keep_alive_timer_start(up, pim->keep_alive_time);
} else if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(up->flags)) } else if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(up->flags))
pim_upstream_keep_alive_timer_start(up, qpim_keep_alive_time); pim_upstream_keep_alive_timer_start(up, pim->keep_alive_time);
if (up->sptbit != PIM_UPSTREAM_SPTBIT_TRUE) { if (up->sptbit != PIM_UPSTREAM_SPTBIT_TRUE) {
pim_upstream_set_sptbit(up, up->rpf.source_nexthop.interface); pim_upstream_set_sptbit(up, up->rpf.source_nexthop.interface);

View File

@ -178,9 +178,9 @@ int pim_global_config_write_worker(struct pim_instance *pim, struct vty *vty)
qpim_t_periodic); qpim_t_periodic);
++writes; ++writes;
} }
if (qpim_keep_alive_time != PIM_KEEPALIVE_PERIOD) { if (pim->keep_alive_time != PIM_KEEPALIVE_PERIOD) {
vty_out(vty, "%sip pim keep-alive-timer %d\n", spaces, vty_out(vty, "%sip pim keep-alive-timer %d\n", spaces,
qpim_keep_alive_time); pim->keep_alive_time);
++writes; ++writes;
} }
if (qpim_packet_process != PIM_DEFAULT_PACKET_PROCESS) { if (qpim_packet_process != PIM_DEFAULT_PACKET_PROCESS) {

View File

@ -58,8 +58,6 @@ int64_t qpim_rpf_cache_refresh_events = 0;
int64_t qpim_rpf_cache_refresh_last = 0; int64_t qpim_rpf_cache_refresh_last = 0;
int64_t qpim_scan_oil_events = 0; int64_t qpim_scan_oil_events = 0;
int64_t qpim_scan_oil_last = 0; int64_t qpim_scan_oil_last = 0;
unsigned int qpim_keep_alive_time = PIM_KEEPALIVE_PERIOD;
signed int qpim_rp_keep_alive_time = 0;
int64_t qpim_nexthop_lookups = 0; int64_t qpim_nexthop_lookups = 0;
int qpim_packet_process = PIM_DEFAULT_PACKET_PROCESS; int qpim_packet_process = PIM_DEFAULT_PACKET_PROCESS;
uint8_t qpim_ecmp_enable = 0; uint8_t qpim_ecmp_enable = 0;
@ -97,8 +95,6 @@ static void pim_free()
void pim_init() void pim_init()
{ {
qpim_rp_keep_alive_time = PIM_RP_KEEPALIVE_PERIOD;
if (!inet_aton(PIM_ALL_PIM_ROUTERS, &qpim_all_pim_routers_addr)) { if (!inet_aton(PIM_ALL_PIM_ROUTERS, &qpim_all_pim_routers_addr)) {
zlog_err( zlog_err(
"%s %s: could not solve %s to group address: errno=%d: %s", "%s %s: could not solve %s to group address: errno=%d: %s",

View File

@ -142,8 +142,6 @@ int64_t qpim_rpf_cache_refresh_last;
int64_t qpim_scan_oil_events; int64_t qpim_scan_oil_events;
int64_t qpim_scan_oil_last; int64_t qpim_scan_oil_last;
int64_t qpim_nexthop_lookups; int64_t qpim_nexthop_lookups;
extern unsigned int qpim_keep_alive_time;
extern signed int qpim_rp_keep_alive_time;
extern int qpim_packet_process; extern int qpim_packet_process;
extern uint8_t qpim_ecmp_enable; extern uint8_t qpim_ecmp_enable;
extern uint8_t qpim_ecmp_rebalance_enable; extern uint8_t qpim_ecmp_rebalance_enable;