summaryrefslogtreecommitdiff
path: root/pimd/pim6_mld.c
diff options
context:
space:
mode:
Diffstat (limited to 'pimd/pim6_mld.c')
-rw-r--r--pimd/pim6_mld.c130
1 files changed, 64 insertions, 66 deletions
diff --git a/pimd/pim6_mld.c b/pimd/pim6_mld.c
index fa699cca5e..1d84a9941b 100644
--- a/pimd/pim6_mld.c
+++ b/pimd/pim6_mld.c
@@ -19,7 +19,7 @@
#include "lib/jhash.h"
#include "lib/prefix.h"
#include "lib/checksum.h"
-#include "lib/thread.h"
+#include "lib/frrevent.h"
#include "termtable.h"
#include "pimd/pim6_mld.h"
@@ -45,7 +45,7 @@ DEFINE_MTYPE_STATIC(PIMD, GM_SG, "MLD (S,G)");
DEFINE_MTYPE_STATIC(PIMD, GM_GRP_PENDING, "MLD group query state");
DEFINE_MTYPE_STATIC(PIMD, GM_GSQ_PENDING, "MLD group/source query aggregate");
-static void gm_t_query(struct thread *t);
+static void gm_t_query(struct event *t);
static void gm_trigger_specific(struct gm_sg *sg);
static void gm_sg_timer_start(struct gm_if *gm_ifp, struct gm_sg *sg,
struct timeval expire_wait);
@@ -329,7 +329,7 @@ static void gm_expiry_calc(struct gm_query_timers *timers)
static void gm_sg_free(struct gm_sg *sg)
{
/* t_sg_expiry is handled before this is reached */
- THREAD_OFF(sg->t_sg_query);
+ EVENT_OFF(sg->t_sg_query);
gm_packet_sg_subs_fini(sg->subs_negative);
gm_packet_sg_subs_fini(sg->subs_positive);
XFREE(MTYPE_GM_SG, sg);
@@ -404,7 +404,7 @@ static void gm_sg_update(struct gm_sg *sg, bool has_expired)
gm_expiry_calc(&timers);
gm_sg_timer_start(gm_ifp, sg, timers.expire_wait);
- THREAD_OFF(sg->t_sg_query);
+ EVENT_OFF(sg->t_sg_query);
sg->n_query = gm_ifp->cur_lmqc;
sg->query_sbit = false;
gm_trigger_specific(sg);
@@ -443,7 +443,7 @@ static void gm_sg_update(struct gm_sg *sg, bool has_expired)
* another path.
*/
if (has_expired)
- THREAD_OFF(sg->t_sg_expire);
+ EVENT_OFF(sg->t_sg_expire);
assertf((!sg->t_sg_expire &&
!gm_packet_sg_subs_count(sg->subs_positive) &&
@@ -582,7 +582,7 @@ static void gm_sg_expiry_cancel(struct gm_sg *sg)
{
if (sg->t_sg_expire && PIM_DEBUG_GM_TRACE)
zlog_debug(log_sg(sg, "alive, cancelling expiry timer"));
- THREAD_OFF(sg->t_sg_expire);
+ EVENT_OFF(sg->t_sg_expire);
sg->query_sbit = true;
}
@@ -1029,9 +1029,9 @@ static void gm_handle_v1_leave(struct gm_if *gm_ifp,
* its own path too and won't hit this. This is really only triggered when a
* host straight up disappears.
*/
-static void gm_t_expire(struct thread *t)
+static void gm_t_expire(struct event *t)
{
- struct gm_if *gm_ifp = THREAD_ARG(t);
+ struct gm_if *gm_ifp = EVENT_ARG(t);
struct gm_packet_state *pkt;
zlog_info(log_ifp("general expiry timer"));
@@ -1048,8 +1048,8 @@ static void gm_t_expire(struct thread *t)
log_ifp("next general expiry in %" PRId64 "ms"),
remain_ms / 1000);
- thread_add_timer_tv(router->master, gm_t_expire, gm_ifp,
- &remain, &gm_ifp->t_expire);
+ event_add_timer_tv(router->master, gm_t_expire, gm_ifp,
+ &remain, &gm_ifp->t_expire);
return;
}
@@ -1103,7 +1103,7 @@ static void gm_handle_q_general(struct gm_if *gm_ifp,
gm_ifp->n_pending--;
if (!gm_ifp->n_pending)
- THREAD_OFF(gm_ifp->t_expire);
+ EVENT_OFF(gm_ifp->t_expire);
}
/* people might be messing with their configs or something */
@@ -1119,16 +1119,16 @@ static void gm_handle_q_general(struct gm_if *gm_ifp,
zlog_debug(
log_ifp("starting general timer @ 0: %pTVMu"),
&pend->expiry);
- thread_add_timer_tv(router->master, gm_t_expire, gm_ifp,
- &timers->expire_wait, &gm_ifp->t_expire);
+ event_add_timer_tv(router->master, gm_t_expire, gm_ifp,
+ &timers->expire_wait, &gm_ifp->t_expire);
} else if (PIM_DEBUG_GM_TRACE)
zlog_debug(log_ifp("appending general timer @ %u: %pTVMu"),
gm_ifp->n_pending, &pend->expiry);
}
-static void gm_t_sg_expire(struct thread *t)
+static void gm_t_sg_expire(struct event *t)
{
- struct gm_sg *sg = THREAD_ARG(t);
+ struct gm_sg *sg = EVENT_ARG(t);
struct gm_if *gm_ifp = sg->iface;
struct gm_packet_sg *item;
@@ -1208,15 +1208,15 @@ static void gm_sg_timer_start(struct gm_if *gm_ifp, struct gm_sg *sg,
if (sg->t_sg_expire) {
struct timeval remain;
- remain = thread_timer_remain(sg->t_sg_expire);
+ remain = event_timer_remain(sg->t_sg_expire);
if (timercmp(&remain, &expire_wait, <=))
return;
- THREAD_OFF(sg->t_sg_expire);
+ EVENT_OFF(sg->t_sg_expire);
}
- thread_add_timer_tv(router->master, gm_t_sg_expire, sg, &expire_wait,
- &sg->t_sg_expire);
+ event_add_timer_tv(router->master, gm_t_sg_expire, sg, &expire_wait,
+ &sg->t_sg_expire);
}
static void gm_handle_q_groupsrc(struct gm_if *gm_ifp,
@@ -1232,7 +1232,7 @@ static void gm_handle_q_groupsrc(struct gm_if *gm_ifp,
}
}
-static void gm_t_grp_expire(struct thread *t)
+static void gm_t_grp_expire(struct event *t)
{
/* if we're here, that means when we received the group-specific query
* there was one or more active S,G for this group. For *,G the timer
@@ -1240,7 +1240,7 @@ static void gm_t_grp_expire(struct thread *t)
* receive a report, so that work is left to gm_t_sg_expire and we
* shouldn't worry about it here.
*/
- struct gm_grp_pending *pend = THREAD_ARG(t);
+ struct gm_grp_pending *pend = EVENT_ARG(t);
struct gm_if *gm_ifp = pend->iface;
struct gm_sg *sg, *sg_start, sg_ref = {};
@@ -1269,7 +1269,7 @@ static void gm_t_grp_expire(struct thread *t)
* parallel. But if we received nothing for the *,G query,
* the S,G query is kinda irrelevant.
*/
- THREAD_OFF(sg->t_sg_expire);
+ EVENT_OFF(sg->t_sg_expire);
frr_each_safe (gm_packet_sg_subs, sg->subs_positive, item)
/* this will also drop the EXCLUDE S,G lists */
@@ -1316,11 +1316,11 @@ static void gm_handle_q_group(struct gm_if *gm_ifp,
if (pend) {
struct timeval remain;
- remain = thread_timer_remain(pend->t_expire);
+ remain = event_timer_remain(pend->t_expire);
if (timercmp(&remain, &timers->expire_wait, <=))
return;
- THREAD_OFF(pend->t_expire);
+ EVENT_OFF(pend->t_expire);
} else {
pend = XCALLOC(MTYPE_GM_GRP_PENDING, sizeof(*pend));
pend->grp = grp;
@@ -1329,8 +1329,8 @@ static void gm_handle_q_group(struct gm_if *gm_ifp,
}
monotime(&pend->query);
- thread_add_timer_tv(router->master, gm_t_grp_expire, pend,
- &timers->expire_wait, &pend->t_expire);
+ event_add_timer_tv(router->master, gm_t_grp_expire, pend,
+ &timers->expire_wait, &pend->t_expire);
if (PIM_DEBUG_GM_TRACE)
zlog_debug(log_ifp("*,%pPAs S,G timer started: %pTHD"), &grp,
@@ -1341,7 +1341,7 @@ static void gm_bump_querier(struct gm_if *gm_ifp)
{
struct pim_interface *pim_ifp = gm_ifp->ifp->info;
- THREAD_OFF(gm_ifp->t_query);
+ EVENT_OFF(gm_ifp->t_query);
if (pim_addr_is_any(pim_ifp->ll_lowest))
return;
@@ -1350,12 +1350,12 @@ static void gm_bump_querier(struct gm_if *gm_ifp)
gm_ifp->n_startup = gm_ifp->cur_qrv;
- thread_execute(router->master, gm_t_query, gm_ifp, 0);
+ event_execute(router->master, gm_t_query, gm_ifp, 0);
}
-static void gm_t_other_querier(struct thread *t)
+static void gm_t_other_querier(struct event *t)
{
- struct gm_if *gm_ifp = THREAD_ARG(t);
+ struct gm_if *gm_ifp = EVENT_ARG(t);
struct pim_interface *pim_ifp = gm_ifp->ifp->info;
zlog_info(log_ifp("other querier timer expired"));
@@ -1363,7 +1363,7 @@ static void gm_t_other_querier(struct thread *t)
gm_ifp->querier = pim_ifp->ll_lowest;
gm_ifp->n_startup = gm_ifp->cur_qrv;
- thread_execute(router->master, gm_t_query, gm_ifp, 0);
+ event_execute(router->master, gm_t_query, gm_ifp, 0);
}
static void gm_handle_query(struct gm_if *gm_ifp,
@@ -1466,13 +1466,12 @@ static void gm_handle_query(struct gm_if *gm_ifp,
if (IPV6_ADDR_CMP(&pkt_src->sin6_addr, &pim_ifp->ll_lowest) < 0) {
unsigned int other_ms;
- THREAD_OFF(gm_ifp->t_query);
- THREAD_OFF(gm_ifp->t_other_querier);
+ EVENT_OFF(gm_ifp->t_query);
+ EVENT_OFF(gm_ifp->t_other_querier);
other_ms = timers.qrv * timers.qqic_ms + timers.max_resp_ms / 2;
- thread_add_timer_msec(router->master, gm_t_other_querier,
- gm_ifp, other_ms,
- &gm_ifp->t_other_querier);
+ event_add_timer_msec(router->master, gm_t_other_querier, gm_ifp,
+ other_ms, &gm_ifp->t_other_querier);
}
if (len == sizeof(struct mld_v1_pkt)) {
@@ -1586,9 +1585,9 @@ static bool ip6_check_hopopts_ra(uint8_t *hopopts, size_t hopopt_len,
return false;
}
-static void gm_t_recv(struct thread *t)
+static void gm_t_recv(struct event *t)
{
- struct pim_instance *pim = THREAD_ARG(t);
+ struct pim_instance *pim = EVENT_ARG(t);
union {
char buf[CMSG_SPACE(sizeof(struct in6_pktinfo)) +
CMSG_SPACE(256) /* hop options */ +
@@ -1607,8 +1606,8 @@ static void gm_t_recv(struct thread *t)
ssize_t nread;
size_t pktlen;
- thread_add_read(router->master, gm_t_recv, pim, pim->gm_socket,
- &pim->t_gm_recv);
+ event_add_read(router->master, gm_t_recv, pim, pim->gm_socket,
+ &pim->t_gm_recv);
iov->iov_base = rxbuf;
iov->iov_len = sizeof(rxbuf);
@@ -1858,9 +1857,9 @@ static void gm_send_query(struct gm_if *gm_ifp, pim_addr grp,
}
}
-static void gm_t_query(struct thread *t)
+static void gm_t_query(struct event *t)
{
- struct gm_if *gm_ifp = THREAD_ARG(t);
+ struct gm_if *gm_ifp = EVENT_ARG(t);
unsigned int timer_ms = gm_ifp->cur_query_intv;
if (gm_ifp->n_startup) {
@@ -1868,15 +1867,15 @@ static void gm_t_query(struct thread *t)
gm_ifp->n_startup--;
}
- thread_add_timer_msec(router->master, gm_t_query, gm_ifp, timer_ms,
- &gm_ifp->t_query);
+ event_add_timer_msec(router->master, gm_t_query, gm_ifp, timer_ms,
+ &gm_ifp->t_query);
gm_send_query(gm_ifp, PIMADDR_ANY, NULL, 0, false);
}
-static void gm_t_sg_query(struct thread *t)
+static void gm_t_sg_query(struct event *t)
{
- struct gm_sg *sg = THREAD_ARG(t);
+ struct gm_sg *sg = EVENT_ARG(t);
gm_trigger_specific(sg);
}
@@ -1895,9 +1894,9 @@ static void gm_send_specific(struct gm_gsq_pending *pend_gsq)
XFREE(MTYPE_GM_GSQ_PENDING, pend_gsq);
}
-static void gm_t_gsq_pend(struct thread *t)
+static void gm_t_gsq_pend(struct event *t)
{
- struct gm_gsq_pending *pend_gsq = THREAD_ARG(t);
+ struct gm_gsq_pending *pend_gsq = EVENT_ARG(t);
gm_send_specific(pend_gsq);
}
@@ -1910,9 +1909,9 @@ static void gm_trigger_specific(struct gm_sg *sg)
sg->n_query--;
if (sg->n_query)
- thread_add_timer_msec(router->master, gm_t_sg_query, sg,
- gm_ifp->cur_query_intv_trig,
- &sg->t_sg_query);
+ event_add_timer_msec(router->master, gm_t_sg_query, sg,
+ gm_ifp->cur_query_intv_trig,
+ &sg->t_sg_query);
if (!IPV6_ADDR_SAME(&gm_ifp->querier, &pim_ifp->ll_lowest))
return;
@@ -1938,9 +1937,8 @@ static void gm_trigger_specific(struct gm_sg *sg)
pend_gsq->iface = gm_ifp;
gm_gsq_pends_add(gm_ifp->gsq_pends, pend_gsq);
- thread_add_timer_tv(router->master, gm_t_gsq_pend, pend_gsq,
- &gm_ifp->cfg_timing_fuzz,
- &pend_gsq->t_send);
+ event_add_timer_tv(router->master, gm_t_gsq_pend, pend_gsq,
+ &gm_ifp->cfg_timing_fuzz, &pend_gsq->t_send);
}
assert(pend_gsq->n_src < array_size(pend_gsq->srcs));
@@ -1949,7 +1947,7 @@ static void gm_trigger_specific(struct gm_sg *sg)
pend_gsq->n_src++;
if (pend_gsq->n_src == array_size(pend_gsq->srcs)) {
- THREAD_OFF(pend_gsq->t_send);
+ EVENT_OFF(pend_gsq->t_send);
gm_send_specific(pend_gsq);
pend_gsq = NULL;
}
@@ -2046,8 +2044,8 @@ static void gm_vrf_socket_incref(struct pim_instance *pim)
vrf->name);
}
- thread_add_read(router->master, gm_t_recv, pim, pim->gm_socket,
- &pim->t_gm_recv);
+ event_add_read(router->master, gm_t_recv, pim, pim->gm_socket,
+ &pim->t_gm_recv);
}
static void gm_vrf_socket_decref(struct pim_instance *pim)
@@ -2055,7 +2053,7 @@ static void gm_vrf_socket_decref(struct pim_instance *pim)
if (--pim->gm_socket_if_count)
return;
- THREAD_OFF(pim->t_gm_recv);
+ EVENT_OFF(pim->t_gm_recv);
close(pim->gm_socket);
pim->gm_socket = -1;
}
@@ -2128,17 +2126,17 @@ void gm_group_delete(struct gm_if *gm_ifp)
gm_packet_drop(pkt, false);
while ((pend_grp = gm_grp_pends_pop(gm_ifp->grp_pends))) {
- THREAD_OFF(pend_grp->t_expire);
+ EVENT_OFF(pend_grp->t_expire);
XFREE(MTYPE_GM_GRP_PENDING, pend_grp);
}
while ((pend_gsq = gm_gsq_pends_pop(gm_ifp->gsq_pends))) {
- THREAD_OFF(pend_gsq->t_send);
+ EVENT_OFF(pend_gsq->t_send);
XFREE(MTYPE_GM_GSQ_PENDING, pend_gsq);
}
while ((sg = gm_sgs_pop(gm_ifp->sgs))) {
- THREAD_OFF(sg->t_sg_expire);
+ EVENT_OFF(sg->t_sg_expire);
assertf(!gm_packet_sg_subs_count(sg->subs_negative), "%pSG",
&sg->sgaddr);
assertf(!gm_packet_sg_subs_count(sg->subs_positive), "%pSG",
@@ -2166,9 +2164,9 @@ void gm_ifp_teardown(struct interface *ifp)
if (PIM_DEBUG_GM_EVENTS)
zlog_debug(log_ifp("MLD stop"));
- THREAD_OFF(gm_ifp->t_query);
- THREAD_OFF(gm_ifp->t_other_querier);
- THREAD_OFF(gm_ifp->t_expire);
+ EVENT_OFF(gm_ifp->t_query);
+ EVENT_OFF(gm_ifp->t_other_querier);
+ EVENT_OFF(gm_ifp->t_expire);
frr_with_privs (&pimd_privs) {
struct ipv6_mreq mreq;
@@ -2211,7 +2209,7 @@ static void gm_update_ll(struct interface *ifp)
gm_ifp->cur_ll_lowest = pim_ifp->ll_lowest;
if (was_querier)
gm_ifp->querier = pim_ifp->ll_lowest;
- THREAD_OFF(gm_ifp->t_query);
+ EVENT_OFF(gm_ifp->t_query);
if (pim_addr_is_any(gm_ifp->cur_ll_lowest)) {
if (was_querier)
@@ -2232,7 +2230,7 @@ static void gm_update_ll(struct interface *ifp)
return;
gm_ifp->n_startup = gm_ifp->cur_qrv;
- thread_execute(router->master, gm_t_query, gm_ifp, 0);
+ event_execute(router->master, gm_t_query, gm_ifp, 0);
}
void gm_ifp_update(struct interface *ifp)