]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add a new module flag to indicate that a build sum is present. Modules built
authorRussell Bryant <russell@russellbryant.com>
Thu, 6 Dec 2007 19:11:35 +0000 (19:11 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 6 Dec 2007 19:11:35 +0000 (19:11 +0000)
against older Asterisk 1.4 headers will now load properly with just a warning
indicating that they are old and may cause problems.
(patch by paravoid)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91501 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/module.h
main/loader.c

index b867f6517b052e11d2bd69d510b3016b236657fe..4c1e40b1dba8a2f335b16458142fb97152a7455d 100644 (file)
@@ -179,6 +179,7 @@ struct ast_module_user_list;
 enum ast_module_flags {
        AST_MODFLAG_DEFAULT = 0,
        AST_MODFLAG_GLOBAL_SYMBOLS = (1 << 0),
+       AST_MODFLAG_BUILDSUM = (1 << 1),
 };
 
 struct ast_module_info {
@@ -233,7 +234,7 @@ void ast_module_unref(struct ast_module *);
                AST_MODULE,                             \
                desc,                                   \
                keystr,                                 \
-               flags_to_set,                           \
+               flags_to_set | AST_MODFLAG_BUILDSUM,    \
                AST_BUILDOPT_SUM,                       \
        };                                              \
        static void  __attribute__ ((constructor)) __reg_module(void) \
@@ -261,7 +262,7 @@ const static __attribute__((unused)) struct ast_module_info *ast_module_info;
 #define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...) \
        static struct ast_module_info __mod_info = {            \
                .name = AST_MODULE,                             \
-               .flags = flags_to_set,                          \
+               .flags = flags_to_set | AST_MODFLAG_BUILDSUM,   \
                .description = desc,                            \
                .key = keystr,                                  \
                .buildopt_sum = AST_BUILDOPT_SUM,               \
index aa17fcb31ef49d5cd622d2c0fd5ccde9549fd831..d920c0c07434335e95596950c9038d8f346d129f 100644 (file)
@@ -616,8 +616,10 @@ static unsigned int inspect_module(const struct ast_module *mod)
                return 1;
        }
 
-       if (!ast_strlen_zero(mod->info->buildopt_sum) &&
-           strcmp(buildopt_sum, mod->info->buildopt_sum)) {
+       if (!ast_test_flag(mod->info, AST_MODFLAG_BUILDSUM)) {
+               ast_log(LOG_WARNING, "Module '%s' was not compiled against a recent version of Asterisk and may cause instability.\n", mod->resource);
+       } else if (!ast_strlen_zero(mod->info->buildopt_sum) &&
+                  strcmp(buildopt_sum, mod->info->buildopt_sum)) {
                ast_log(LOG_WARNING, "Module '%s' was not compiled with the same compile-time options as this version of Asterisk.\n", mod->resource);
                ast_log(LOG_WARNING, "Module '%s' will not be initialized as it may cause instability.\n", mod->resource);
                return 1;