From: Alan T. DeKok Date: Fri, 10 Mar 2023 15:42:44 +0000 (-0500) Subject: move set of el / nr to proto_bfd_udp.c X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=017304d91ccd7b9999822100affe7996938c38aa;p=thirdparty%2Ffreeradius-server.git move set of el / nr to proto_bfd_udp.c in preparation for rework which allows packet injection --- diff --git a/src/listen/bfd/proto_bfd.h b/src/listen/bfd/proto_bfd.h index c4ac4ec9f00..4fe47eaa1df 100644 --- a/src/listen/bfd/proto_bfd.h +++ b/src/listen/bfd/proto_bfd.h @@ -51,7 +51,8 @@ typedef struct { fr_listen_t *listen; //!< associated listener int sockfd; //!< cached for laziness - fr_event_list_t *el; + fr_event_list_t *el; //!< event list + fr_network_t *nr; //!< network side of things struct sockaddr_storage remote_sockaddr; //!< cached for laziness socklen_t remote_salen; diff --git a/src/listen/bfd/proto_bfd_udp.c b/src/listen/bfd/proto_bfd_udp.c index cf9651038f4..93a7d30ada2 100644 --- a/src/listen/bfd/proto_bfd_udp.c +++ b/src/listen/bfd/proto_bfd_udp.c @@ -472,7 +472,7 @@ static fr_client_t *mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, * @param[in] el the event list * @param[in] nr context from the network side */ -static void mod_event_list_set(fr_listen_t *li, fr_event_list_t *el, UNUSED void *nr) +static void mod_event_list_set(fr_listen_t *li, fr_event_list_t *el, void *nr) { proto_bfd_udp_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_bfd_udp_t); proto_bfd_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_bfd_udp_thread_t); @@ -487,7 +487,11 @@ static void mod_event_list_set(fr_listen_t *li, fr_event_list_t *el, UNUSED void peer = fr_rb_iter_next_inorder(&iter)) { if (peer->inst != inst) continue; - bfd_session_start(peer, el, thread->sockfd); + peer->el = el; + peer->nr = (fr_network_t *) nr; + peer->sockfd = thread->sockfd; + + bfd_session_start(peer); } } diff --git a/src/listen/bfd/session.c b/src/listen/bfd/session.c index 0f8455ccb7c..b7f7ba5ac53 100644 --- a/src/listen/bfd/session.c +++ b/src/listen/bfd/session.c @@ -946,14 +946,11 @@ int bfd_session_init(proto_bfd_peer_t *session) return 0; } -void bfd_session_start(proto_bfd_peer_t *session, fr_event_list_t *el, int sockfd) +void bfd_session_start(proto_bfd_peer_t *session) { DEBUG("Starting BFD for %s", session->client.shortname); - fr_assert(!session->el); - - session->el = el; - session->sockfd = sockfd; + fr_assert(session->el); bfd_start_control(session); } diff --git a/src/listen/bfd/session.h b/src/listen/bfd/session.h index 2a83f636036..ff8d6a6b993 100644 --- a/src/listen/bfd/session.h +++ b/src/listen/bfd/session.h @@ -27,6 +27,6 @@ int bfd_session_init(proto_bfd_peer_t *session); -void bfd_session_start(proto_bfd_peer_t *session, fr_event_list_t *el, int sockfd); +void bfd_session_start(proto_bfd_peer_t *session); int bfd_session_process(proto_bfd_peer_t *session, bfd_packet_t *bfd);