summaryrefslogtreecommitdiff
path: root/res/res_hep.c
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2016-06-08 12:26:29 -0500
committerMatt Jordan <mjordan@digium.com>2016-06-08 12:32:02 -0500
commit7f5ca67e5fbc6d4e39a8f1f881faea568770819f (patch)
tree3f1d4f96af64084396d54c730ef9fedd62852f19 /res/res_hep.c
parent5164e1fd859fcd884a4b9edef7cde3b6e1efc87a (diff)
res_hep_{pjsip|rtcp}: Decline module loads if res_hep had not loaded
A crash can occur in res_hep_pjsip or res_hep_rtcp if res_hep has not loaded and does not have a configuration file. Previously when this occurred, checks were put in to see if the configuration was loaded successfully. While this is a good idea - and has been added to the offending function in res_hep - the reality is res_hep_pjsip and res_hep_rtcp have no business running if res_hep isn't also running. As such, this patch also adds a function to res_hep that returns whether or not it successfully loaded. Oddly enough, ast_module_check returns "everything is peachy" even if a module declined its load - so it cannot be solely relied on. res_hep_pjsip and res_hep_rtcp now also check this function to see if they should continue to load; if it fails, they decline their load as well. ASTERISK-26096 #close Change-Id: I007e535fcc2e51c2ca48534f48c5fc2ac38935ea
Diffstat (limited to 'res/res_hep.c')
-rw-r--r--res/res_hep.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/res/res_hep.c b/res/res_hep.c
index 45201359d..e79f2b67a 100644
--- a/res/res_hep.c
+++ b/res/res_hep.c
@@ -409,9 +409,21 @@ enum hep_uuid_type hepv3_get_uuid_type(void)
{
RAII_VAR(struct module_config *, config, ao2_global_obj_ref(global_config), ao2_cleanup);
+ if (!config) {
+ /* Well, that's unfortunate. Return something. */
+ return HEP_UUID_TYPE_CALL_ID;
+ }
+
return config->general->uuid_type;
}
+int hepv3_is_loaded(void)
+{
+ RAII_VAR(struct module_config *, config, ao2_global_obj_ref(global_config), ao2_cleanup);
+
+ return (config != NULL) ? 1 : 0;
+}
+
struct hepv3_capture_info *hepv3_create_capture_info(const void *payload, size_t len)
{
struct hepv3_capture_info *info;