};
typedef struct {
+ CONF_SECTION *server_cs; //!< what a hack...
dl_instance_t *proto_module; //!< The proto_* module for a listen section.
fr_app_t const *app; //!< Easy access to the exported struct.
} fr_virtual_listen_t;
if (DEBUG_ENABLED4) cf_log_debug(ci, "Loading %s listener into %p", cf_pair_value(namespace), out);
+ listen->server_cs = server;
+
if (dl_instance(ctx, &listen->proto_module, listen_cs, NULL, cf_pair_value(namespace), DL_TYPE_PROTO) < 0) {
cf_log_err(listen_cs, "Failed loading proto module");
return -1;
return 0;
}
+
/** Instantiate all the virtual servers
*
* @param[in] config section containing all the virtual servers.
for (i = 0; i < server_cnt; i++) {
fr_virtual_listen_t **listener;
size_t j, listen_cnt;
+ CONF_ITEM *ci;
+ CONF_SECTION *cs;
listener = virtual_servers[i]->listener;
listen_cnt = talloc_array_length(listener);
}
}
+ /*
+ * Print out warnings for unused "recv" and
+ * "send" sections.
+ */
+ cs = listener[0]->server_cs;
+ for (ci = cf_item_next(cs, NULL);
+ ci != NULL;
+ ci = cf_item_next(cs, ci)) {
+ char const *name;
+ CONF_SECTION *subcs;
+
+ if (!cf_item_is_section(ci)) continue;
+
+
+ subcs = cf_item_to_section(ci);
+ name = cf_section_name1(subcs);
+
+ if ((strcmp(name, "recv") != 0) &&
+ (strcmp(name, "send") != 0)) continue;
+
+ if (!cf_data_find(subcs, unlang_group_t, NULL)) {
+ if (check_config) {
+ cf_log_err(subcs, "%s %s { ... } section is unused",
+ name, cf_section_name2(subcs));
+ return -1;
+ }
+
+ cf_log_warn(subcs, "%s %s { ... } section is unused",
+ name, cf_section_name2(subcs));
+ }
+ }
}
return 0;
}
/*
- * Skip old-style virtual servers.
+ * Forbid old-style virtual servers.
*/
if (!cf_pair_find(cs, "namespace")) {
cf_log_err(cs, "server sections must set 'namesspace = ...'");