summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2016-08-10 15:41:38 -0400
committerAlexei Gradinari <alex2grad@gmail.com>2016-08-15 10:08:43 -0400
commit403c794684a5a8afce2b490e5a40214f792794d4 (patch)
tree836769b33ed63c56b7fe673875319a1c0ef2d8b4 /main
parent5a5b949333ca9d5f2befc2c07fb5f376dbd05ec0 (diff)
core: Entity ID is not set or invalid
The Exchanging Device and Mailbox States could not working if the Entity ID (EID) is not set manually and can't be obtained from ethernet interface. This patch replaces debug message to warning and addes missing description about option 'entityid' to asterisk.conf.sample. With this patch the asterisk also: (1) decline loading the modules which won't work without EID: res_corosync and res_pjsip_publish_asterisk. (2) warn if EID is empty on loading next modules: pbx_dundi, res_xmpp Starting with v197 systemd/udev will automatically assign "predictable" names for all local Ethernet interfaces. This patch also addes some new ethernet prefixes "eno" and "ens". ASTERISK-26164 #close Change-Id: I72d712f1ad5b6f64571bb179c5cb12461e7c58c6
Diffstat (limited to 'main')
-rw-r--r--main/asterisk.c6
-rw-r--r--main/utils.c12
2 files changed, 13 insertions, 5 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 772c3dce9..b23ddfc55 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -3752,10 +3752,10 @@ static void ast_readconfig(void)
} else if (!strcasecmp(v->name, "entityid")) {
struct ast_eid tmp_eid;
if (!ast_str_to_eid(&tmp_eid, v->value)) {
- ast_verbose("Successfully set global EID to '%s'\n", v->value);
ast_eid_default = tmp_eid;
- } else
- ast_verbose("Invalid Entity ID '%s' provided\n", v->value);
+ } else {
+ ast_log(LOG_WARNING, "Invalid Entity ID '%s' provided\n", v->value);
+ }
} else if (!strcasecmp(v->name, "lightbackground")) {
ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_LIGHT_BACKGROUND);
} else if (!strcasecmp(v->name, "forceblackbackground")) {
diff --git a/main/utils.c b/main/utils.c
index bd74ee24d..1a034c101 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -2493,7 +2493,7 @@ void ast_set_default_eid(struct ast_eid *eid)
return;
}
for (x = 0; x < MAXIF; x++) {
- static const char *prefixes[] = { "eth", "em" };
+ static const char *prefixes[] = { "eth", "em", "eno", "ens" };
unsigned int i;
for (i = 0; i < ARRAY_LEN(prefixes); i++) {
@@ -2544,7 +2544,7 @@ void ast_set_default_eid(struct ast_eid *eid)
}
#endif
#endif
- ast_debug(1, "No ethernet interface found for seeding global EID. You will have to set it manually.\n");
+ ast_log(LOG_WARNING, "No ethernet interface found for seeding global EID. You will have to set it manually.\n");
}
int ast_str_to_eid(struct ast_eid *eid, const char *s)
@@ -2569,6 +2569,14 @@ int ast_eid_cmp(const struct ast_eid *eid1, const struct ast_eid *eid2)
return memcmp(eid1, eid2, sizeof(*eid1));
}
+int ast_eid_is_empty(const struct ast_eid *eid)
+{
+ struct ast_eid empty_eid;
+
+ memset(&empty_eid, 0, sizeof(empty_eid));
+ return memcmp(eid, &empty_eid, sizeof(empty_eid)) ? 0 : 1;
+}
+
int ast_file_is_readable(const char *filename)
{
#if defined(HAVE_EACCESS) || defined(HAVE_EUIDACCESS)