[Home]

Summary:ASTERISK-09195: ast_register_application and loader misalignment
Reporter:Anthony LaMantia-2 (anthonyl)Labels:
Date Opened:2007-04-05 02:09:57Date Closed:2011-06-07 14:08:08
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Howdy,

in side load_dynamic_module() in loader.c the following is called after dlopen() to make sure that ast_register_application was called properly




       if (resource_being_loaded != (mod = AST_LIST_LAST(&module_list))) {
               ast_log(LOG_WARNING, "Module '%s' did not register itself during load\n", resource_in);
               /* no, it did not, so close it and return */
               while (!dlclose(lib));
               /* note that the module's destructor will call ast_module_unregister(),
                  which will free the structure we allocated in resource_being_loaded */
               return NULL;
       }



as you can see it checks the end of the list, there is a slight problem with this check as in ast_register_application() (located inside of pbx.c)

the following is preformed

       /* Store in alphabetical order */
       AST_RWLIST_TRAVERSE_SAFE_BEGIN(&apps, cur, list) {
               if (strcasecmp(tmp->name, cur->name) < 0) {
                       AST_RWLIST_INSERT_BEFORE_CURRENT(&apps, tmp, list);
                       break;
               }
       }


there are cases where the application wont be placed at the end of the list and this the check in loader.c failing..

a firend of mine was trying to install a application and it failed to load and this point, after investigating my self i found that this was the problem.
Comments:By: Joshua C. Colp (jcolp) 2007-04-05 09:34:02

This logic is incorrect. load_dynamic_module is checking whether the *module* registered itself (which is what happens if the module has been updated to use the new loader stuff). It is NOT checking whether an application was registered. Check to make sure the module is using the newer loader stuff, if not you'll see the "Module <blah> did not register itself during load" warning.