]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
process sending BFD packets
authorAlan T. DeKok <aland@freeradius.org>
Tue, 14 Mar 2023 21:04:39 +0000 (17:04 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 14 Mar 2023 21:10:41 +0000 (17:10 -0400)
where we don't have a request, but we do have a reply

src/process/bfd/all.mk
src/process/bfd/base.c

index 2c41aadd3ebabf11a4cdc3798d9522d9167f0cc5..e3eea5eb51ac7d1c8bb5c2bb9b03ee90644c1fbc 100644 (file)
@@ -5,6 +5,6 @@ TARGET          := $(TARGETNAME)$(L)
 endif
 
 SOURCES                := base.c
+SRC_CFLAGS     := -I$(top_builddir)/src/listen
 
 TGT_PREREQS    := libfreeradius-bfd$(L)
-
index 0080feb8d0074493bdeb25665c79d26051fc6503..af4207ebf1a5de8d398e6bb09654093a96c3e887 100644 (file)
@@ -24,6 +24,7 @@
 #include <freeradius-devel/server/protocol.h>
 #include <freeradius-devel/util/debug.h>
 #include <freeradius-devel/bfd/bfd.h>
+#include "bfd/session.h"
 
 static fr_dict_t const *dict_bfd;
 
@@ -226,6 +227,7 @@ static fr_process_state_t const process_state_reply[] = {
 static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 {
        fr_process_state_t const *state;
+       bfd_wrapper_t const *wrapper;
 
        PROCESS_TRACE;
 
@@ -234,8 +236,25 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc
 
        request->component = "bfd";
        request->module = NULL;
+
        fr_assert(request->dict == dict_bfd);
 
+       wrapper = (bfd_wrapper_t const *) request->packet->data;
+
+       /*
+        *      If there's no packet, we must be calling the "send" routine
+        */
+       if (wrapper->type == BFD_WRAPPER_SEND_PACKET) {
+               fr_assert(wrapper->type == BFD_WRAPPER_SEND_PACKET);
+
+               UPDATE_STATE(reply);
+
+               bfd_packet_debug(request, request->reply, &request->reply_pairs, false);
+               return state->send(p_result, mctx, request);
+       }
+
+       fr_assert(wrapper->type == BFD_WRAPPER_RECV_PACKET);
+
        UPDATE_STATE(packet);
 
        bfd_packet_debug(request, request->packet, &request->request_pairs, true);