From f9da597e5e4bb4d8103c6d29efa601922897941b Mon Sep 17 00:00:00 2001 From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:59:16 -0500 Subject: [PATCH] install: Update patches to target 22.1.0. * Remove patches merged in 22.1.0. * Slipstream merged but not yet released patches. * Enable EMPULSE in DAHDI builds, since it is typically needed/desired for E&M signaling, and there is little downside in it being enabled. PHREAKSCRIPT-59 #close --- ...c_fix_template_inheritance_overrides.patch | 69 ------------------- patches/config_c_fix_template_writing.patch | 25 ------- phreaknet.sh | 15 ++-- 3 files changed, 9 insertions(+), 100 deletions(-) delete mode 100644 patches/config_c_fix_template_inheritance_overrides.patch delete mode 100644 patches/config_c_fix_template_writing.patch diff --git a/patches/config_c_fix_template_inheritance_overrides.patch b/patches/config_c_fix_template_inheritance_overrides.patch deleted file mode 100644 index bbf4810..0000000 --- a/patches/config_c_fix_template_inheritance_overrides.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 177d8754ddc10737c0a679b1cfd4819b210ace52 Mon Sep 17 00:00:00 2001 -From: Naveen Albert -Date: Wed, 21 Dec 2022 21:27:15 +0000 -Subject: [PATCH] config.c: Make ast_variable_retrieve return last match. - -ast_variable_retrieve currently returns the first match -for a variable, as opposed to the last one. This is problematic -because modules that load config settings by explicitly -calling ast_variable_retrieve on a variable name (as opposed -to iterating through all the directives as specified) will -end up taking the first specified value, such as the default -value from the template rather than the actual effective value -in an individual config section, leading to the wrong config. - -This fixes this by making ast_variable_retrieve return the last -match, or the most recently overridden one, as the effective setting. -This is similar to what the -1 index in the AST_CONFIG function does. - -There is another function, ast_variable_find_last_in_list, that does -something similar. However, it's a slightly different API, and it -sees virtually no usage in Asterisk. ast_variable_retrieve is what -most things use so this is currently the relevant point of breakage. - -ASTERISK-30370 #close - -Change-Id: Ia681407275a557c1462f93832a4d45f31c580354 ---- - -diff --git a/main/config.c b/main/config.c -index 1074407..b7ecd81 100644 ---- a/main/config.c -+++ b/main/config.c -@@ -783,11 +783,19 @@ - const char *ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable) - { - struct ast_variable *v; -+ const char *match = NULL; -+ -+ /* We can't return as soon as we find a match, because if a config section overrides -+ * something specified in a template, then the actual effective value is the last -+ * one encountered, not the first one. -+ * (This is like using the -1 index for the AST_CONFIG function.) -+ * Also see ast_variable_find_last_in_list -+ */ - - if (category) { - for (v = ast_variable_browse(config, category); v; v = v->next) { - if (!strcasecmp(variable, v->name)) { -- return v->value; -+ match = v->value; - } - } - } else { -@@ -796,13 +804,13 @@ - for (cat = config->root; cat; cat = cat->next) { - for (v = cat->root; v; v = v->next) { - if (!strcasecmp(variable, v->name)) { -- return v->value; -+ match = v->value; - } - } - } - } - -- return NULL; -+ return match; - } - - const char *ast_variable_retrieve_filtered(struct ast_config *config, diff --git a/patches/config_c_fix_template_writing.patch b/patches/config_c_fix_template_writing.patch deleted file mode 100644 index 210ceb6..0000000 --- a/patches/config_c_fix_template_writing.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/main/config.c b/main/config.c -index e7ac4149a6..e81d3afced 100644 ---- a/main/config.c -+++ b/main/config.c -@@ -1533,13 +1533,19 @@ int ast_variable_delete(struct ast_category *category, const char *variable, con - int ast_variable_update(struct ast_category *category, const char *variable, - const char *value, const char *match, unsigned int object) - { -- struct ast_variable *cur, *prev=NULL, *newer=NULL; -+ struct ast_variable *cur, *prev=NULL, *newer=NULL, *matchvar = NULL; - - for (cur = category->root; cur; prev = cur, cur = cur->next) { - if (strcasecmp(cur->name, variable) || - (!ast_strlen_zero(match) && strcasecmp(cur->value, match))) - continue; -+ matchvar = cur; -+ } - -+ for (cur = category->root; cur; prev = cur, cur = cur->next) { -+ if (cur != matchvar) { -+ continue; -+ } - if (!(newer = ast_variable_new(variable, value, cur->file))) - return -1; - diff --git a/phreaknet.sh b/phreaknet.sh index 8c372a1..99549bd 100755 --- a/phreaknet.sh +++ b/phreaknet.sh @@ -242,6 +242,7 @@ SIP_CISCO=0 CHAN_SCCP=0 CHAN_DAHDI=0 DAHDI_OLD_DRIVERS=0 +EMPULSE=1 # Automatically enable EMPULSE, cause why not? DAHDI_WANPIPE=0 # wanpipe only needed for Sangoma cards DEVMODE=0 TEST_SUITE=0 @@ -1907,6 +1908,10 @@ install_dahdi() { if [ "$HEARPULSING" = "1" ]; then git_patch "hearpulsing-dahlin.diff" fi + if [ "$EMPULSE" = "1" ]; then + printf "Enabling EMPULSE for this build\n" + sed -i 's|/\* #define EMPULSE \*/|#define EMPULSE|g' include/dahdi/dahdi_config.h # Enable EMPULSE by default. Note that the * must be escaped for sed. + fi else echoerr "Skipping DAHDI Linux feature patches..." fi @@ -2309,13 +2314,11 @@ phreak_patches() { # $1 = $PATCH_DIR, $2 = $AST_SRC_DIR printf "Applying patches applicable to %s -> %d (~%s)\n" "$AST_ALT_VER" "$AST_MM_VER" "$AST_MAJOR_VER" ## merged into master, not yet in a release version (use asterisk_pr_if, e.g. asterisk_pr_if 399 210100 200600 182100) - asterisk_pr_if 901 220100 210600 182600 # astfd compiler fix - asterisk_pr_if 903 220100 210600 182600 # voicemail pager email fix - asterisk_pr_if 917 220100 210600 182600 # FreeBSD compilation fixes + asterisk_pr_if 961 220200 210700 201200 182700 # config.c: fix template inheritance/overrides + asterisk_pr_if 994 220200 210700 201200 182700 # FGD regression fix - ## Unmerged patches: remove once merged - git_patch "config_c_fix_template_inheritance_overrides.patch" # config.c: fix template inheritance/overrides - git_patch "config_c_fix_template_writing.patch" # config.c: fix template inheritance/overrides + ## Unmerged patches: remove or switch to asterisk_pr_if once merged + asterisk_pr_unconditional 245 # config.c: fix template inheritance/overrides asterisk_pr_unconditional 918 # config.c #tryinclude fixes asterisk_pr_unconditional 971 # config.c fix issues w/ whitespace in comments