]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move set of el / nr to proto_bfd_udp.c
authorAlan T. DeKok <aland@freeradius.org>
Fri, 10 Mar 2023 15:42:44 +0000 (10:42 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 10 Mar 2023 22:16:56 +0000 (17:16 -0500)
in preparation for rework which allows packet injection

src/listen/bfd/proto_bfd.h
src/listen/bfd/proto_bfd_udp.c
src/listen/bfd/session.c
src/listen/bfd/session.h

index c4ac4ec9f0084ca22af2d3e48ae0015e7fbbdcde..4fe47eaa1dfe1c775efb75cfb69edd1c1ca8b4b5 100644 (file)
@@ -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;
index cf9651038f48203446186a49b99b0c4636cea2c5..93a7d30ada2709cb5ec34406579140e2a64dd46c 100644 (file)
@@ -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);
        }
 }
 
index 0f8455ccb7cc5a5bb1ee5240da3c556969f3f472..b7f7ba5ac53e900e17758fcc66c764edf0c1bef8 100644 (file)
@@ -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);
 }
index 2a83f636036d22617162529e266c96655b71c0ee..ff8d6a6b993e5ad2e4fb58b93d0f1fa5409c7347 100644 (file)
@@ -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);