]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add virtual_server_packet_type_by_cs
authorNick Porter <nick@portercomputing.co.uk>
Wed, 28 Jan 2026 10:16:58 +0000 (10:16 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Wed, 28 Jan 2026 10:26:42 +0000 (10:26 +0000)
To access the packet_type exported by the virtual server's process
module

src/lib/server/virtual_servers.c
src/lib/server/virtual_servers.h

index 857e7d313a81deeb23bdc370354315a3576b2d92..617cc7eb4f3491d38b0296074c7eb153b09edb59 100644 (file)
@@ -1008,6 +1008,21 @@ virtual_server_t const *virtual_server_by_child(CONF_ITEM const *ci)
        return cf_data_value(cd);
 }
 
+/** Return the packet type attribute for a virtual server specified by a config section
+ *
+ * @param[in] server_cs                to look for packet type attribute in.
+ * @return
+ *     - NULL on error.
+ *     - packet type dict attr on success.
+ */
+fr_dict_attr_t const *virtual_server_packet_type_by_cs(CONF_SECTION const *server_cs)
+{
+       virtual_server_t const *vs = virtual_server_from_cs(server_cs);
+
+       if (unlikely(!vs || !vs->process_module || !vs->process_module->packet_type)) return NULL;
+       return *vs->process_module->packet_type;
+}
+
 /** Wrapper for the config parser to allow pass1 resolution of virtual servers
  *
  */
index 11d190d0f20d44d76f8af6ffa85dba41542aed90..d80be1874c1f91241db2e4a3fdb3e899a22a2d5f 100644 (file)
@@ -91,6 +91,8 @@ virtual_server_t const        *virtual_server_find(char const *name) CC_HINT(nonnull);
 
 virtual_server_t const *virtual_server_by_child(CONF_ITEM const *ci) CC_HINT(nonnull);
 
+fr_dict_attr_t const   *virtual_server_packet_type_by_cs(CONF_SECTION const *server_cs);
+
 /** Additional validation rules for virtual server lookup
  *
  * This is used to ensure that the virtual server we find matches