aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-02-15 08:48:12 +0000
committerTimo Teräs <timo.teras@iki.fi>2017-02-15 08:48:12 +0000
commit18f604284e1509774560fac6b27efbbf2df96336 (patch)
tree5880ccb51f2fcf07d78fbcc9045f5a5749752d78 /main/asterisk
parent4b6668678f8ba39bb7e3cc8efb07bdf894e034b2 (diff)
downloadaports-18f604284e1509774560fac6b27efbbf2df96336.tar.bz2
aports-18f604284e1509774560fac6b27efbbf2df96336.tar.xz
main/asterisk: upgrade to 14.3.0
- rebase ASTERISK-24517 - remove upstreamed patch
Diffstat (limited to 'main/asterisk')
-rw-r--r--main/asterisk/APKBUILD28
-rw-r--r--main/asterisk/ASTERISK-24517.patch193
-rw-r--r--main/asterisk/fix-strerror_r.patch72
3 files changed, 108 insertions, 185 deletions
diff --git a/main/asterisk/APKBUILD b/main/asterisk/APKBUILD
index 47951f3a99..fd88ccebee 100644
--- a/main/asterisk/APKBUILD
+++ b/main/asterisk/APKBUILD
@@ -2,8 +2,8 @@
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=asterisk
-pkgver=14.2.1
-pkgrel=2
+pkgver=14.3.0
+pkgrel=0
pkgdesc="Asterisk: A Module Open Source PBX System"
pkgusers="asterisk"
pkggroups="asterisk"
@@ -29,7 +29,6 @@ _download="http://downloads.asterisk.org/pub/telephony/asterisk/releases"
source="$_download/asterisk-$pkgver.tar.gz
http://dev.alpinelinux.org/~tteras/asterisk-addon-mp3-r201.patch.gz
ASTERISK-24517.patch
- fix-strerror_r.patch
musl-mutex-init.patch
restore-multihomed-module.patch
@@ -227,28 +226,9 @@ sound_en() {
chown -R asterisk:asterisk "$subpkgdir"/var/*/asterisk
}
-md5sums="e65daf9b1d65b8047b2117f21587ab35 asterisk-14.2.1.tar.gz
-126dd4fba66f4cf9aa94dfd7034e0ec4 asterisk-addon-mp3-r201.patch.gz
-5f8eaac5d48c47033028abec56a881a5 ASTERISK-24517.patch
-b562be4a764d275dad87682642b56ee3 fix-strerror_r.patch
-1ca5e8326dc03c963a7ce5455d0f21ba musl-mutex-init.patch
-f7038bbe05b7a32e7408fea7b92f7fc8 restore-multihomed-module.patch
-4bdc82ba3d6bdfdedc71e5da2fde5ec2 asterisk.initd
-ed31d7ba37bcf8b0346dcf8593c395f0 asterisk.confd
-3e65172275684373e1a25c8a11224411 asterisk.logrotate"
-sha256sums="b28b5131233db6c89bb3356c703033ec8a393ae378e4aae169993b60a5877ea4 asterisk-14.2.1.tar.gz
-d32a5a695cee1699011d0e9ad02eb43af612def06f92017627194099edf98e3f asterisk-addon-mp3-r201.patch.gz
-98a49e7241e0c7a7dd814ed472aa1b3be9b1ee3f2966c286fd8a3e11c7c278ae ASTERISK-24517.patch
-546c0d60e08a17e7b888baada693a08608c3d4f54709e2959305c4a772bb8158 fix-strerror_r.patch
-a5205ed44b57a72934baf8cde543ddb179f277494181818905110bfdcccfe7d9 musl-mutex-init.patch
-c65bb73a276824ba8518aaa5f439e7fdbd10ba3b719bec9e848c55cfb8ca853a restore-multihomed-module.patch
-10454553733e6cc52c6e9db508768a638655d99c095c5b39fb043858c088f21f asterisk.initd
-d221148583b57f9c37d7160f2493f0d204ad11f7abb17e3a3534e108ad5452d7 asterisk.confd
-77b253b6db71460acf9a51e87ad4c8582027a46db01a4c50fb048bada58c19d1 asterisk.logrotate"
-sha512sums="cac5b9cb94f72cd2d60723ecf3cba15b2d19cbc29a5df6678481699f4f0344aa41d60cbce8bed8c863d5be7d3264c30bac3a90978b5b66ffde5652fa681c842f asterisk-14.2.1.tar.gz
+sha512sums="9a3ccbd7dfce18ae7c81f4d005362771443293f295b590242c8754b76a9d6ebd8d9d3d0c0aaef565dcfbf66f020e432a64bc0d65d3bb14220ae88ae0f2e37a69 asterisk-14.3.0.tar.gz
aacef3f4796fb1abd33266998b53909cb4b36e7cc5ad2f7bac68bdc43e9a9072d9a4e2e7e681bddfa31f3d04575eb248afe6ea95da780c67e4829c1e22adfe1b asterisk-addon-mp3-r201.patch.gz
-e0b43c8a0a7e041d5853f7508ebff747616d9745449ab4a5d28788fbe076f0e9d49dc7f9e818f5b55fd430c625d1d5ec8d8f7fe6f7c56315f16180ce405cf282 ASTERISK-24517.patch
-46f661b5056a571181adfd93a34c836e2df091e1bfd400e0c09794f43b097c4401f47bf8f4b620a1549fa90bf287b3018d803c102c6c7835a67c4c85ea5c2e76 fix-strerror_r.patch
+d9156e8a1d9848a8a65ad6cb91f23bcfb47b0e18f92a22f4ec8ae5aedbf8dd3a169ac151ff3aa1b7d595a687ade7ebb598d87cc575a0dd9b46549ede97064c2e ASTERISK-24517.patch
f72c2e04de80d3ed9ce841308101383a1655e6da7a3c888ad31fffe63d1280993e08aefcf8e638316d439c68b38ee05362c87503fca1f36343976a01af9d6eb1 musl-mutex-init.patch
935c25c7b1cdbd376056e20232a0e8c38dd32c344f50306d99930bf7cb37685c31329ead273b08ac9ab76daa9386adfb05b57440e46a39cb80e5542d65e8e3ed restore-multihomed-module.patch
cd5bd1c1d7db0a44b14eb10e6d098af0c6474c8fe1a57395090d6795ac00e9243d004b7d24eba2cfd5bd6d6407c271913e794551a8dfcf3cf93e89fc91349e12 asterisk.initd
diff --git a/main/asterisk/ASTERISK-24517.patch b/main/asterisk/ASTERISK-24517.patch
index 271676b528..e621d08d07 100644
--- a/main/asterisk/ASTERISK-24517.patch
+++ b/main/asterisk/ASTERISK-24517.patch
@@ -1,4 +1,4 @@
-From 40df0ee8bfa49a18eb5fa6b2e02715fa82da8a96 Mon Sep 17 00:00:00 2001
+From c61dd986239710223d5e59d265ab4589c598e4ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Thu, 2 Jun 2016 22:10:06 +0300
Subject: [PATCH] Implement internal abstraction for iostreams
@@ -24,17 +24,17 @@ Change-Id: Id916aef418b665ced6a7489aef74908b6e376e85
main/http.c | 105 +++----
main/iostream.c | 553 ++++++++++++++++++++++++++++++++++
main/manager.c | 142 ++++-----
- main/tcptls.c | 711 ++++++--------------------------------------
- main/utils.c | 62 ----
+ main/tcptls.c | 717 ++++++--------------------------------------
+ main/utils.c | 68 -----
res/res_http_post.c | 10 +-
- res/res_http_websocket.c | 116 ++++----
+ res/res_http_websocket.c | 116 ++++---
res/res_phoneprov.c | 2 +-
- 13 files changed, 997 insertions(+), 1098 deletions(-)
+ 13 files changed, 997 insertions(+), 1110 deletions(-)
create mode 100644 include/asterisk/iostream.h
create mode 100644 main/iostream.c
diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c
-index 2bb1d8b..129f29b 100644
+index 2bb1d8b535..129f29b924 100644
--- a/apps/app_externalivr.c
+++ b/apps/app_externalivr.c
@@ -152,10 +152,12 @@ struct gen_state {
@@ -255,10 +255,10 @@ index 2bb1d8b..129f29b 100644
static int unload_module(void)
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
-index 297981a..ac44f2d 100644
+index 709d5ab45c..dd660a5d71 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
-@@ -2543,7 +2543,7 @@ static struct sip_threadinfo *sip_threadinfo_create(struct ast_tcptls_session_in
+@@ -2545,7 +2545,7 @@ static struct sip_threadinfo *sip_threadinfo_create(struct ast_tcptls_session_in
}
ao2_t_ref(tcptls_session, +1, "tcptls_session ref for sip_threadinfo object");
th->tcptls_session = tcptls_session;
@@ -267,7 +267,7 @@ index 297981a..ac44f2d 100644
ao2_t_link(threadt, th, "Adding new tcptls helper thread");
ao2_t_ref(th, -1, "Decrementing threadinfo ref from alloc, only table ref remains");
return th;
-@@ -2566,8 +2566,7 @@ static int sip_tcptls_write(struct ast_tcptls_session_instance *tcptls_session,
+@@ -2568,8 +2568,7 @@ static int sip_tcptls_write(struct ast_tcptls_session_instance *tcptls_session,
ao2_lock(tcptls_session);
@@ -277,7 +277,7 @@ index 297981a..ac44f2d 100644
!(packet = ao2_alloc(sizeof(*packet), tcptls_packet_destructor)) ||
!(packet->data = ast_str_create(len))) {
goto tcptls_write_setup_error;
-@@ -2880,7 +2879,7 @@ static int sip_tcptls_read(struct sip_request *req, struct ast_tcptls_session_in
+@@ -2882,7 +2881,7 @@ static int sip_tcptls_read(struct sip_request *req, struct ast_tcptls_session_in
} else {
timeout = -1;
}
@@ -286,7 +286,7 @@ index 297981a..ac44f2d 100644
if (res < 0) {
ast_debug(2, "SIP TCP/TLS server :: ast_wait_for_input returned %d\n", res);
return -1;
-@@ -2889,7 +2888,7 @@ static int sip_tcptls_read(struct sip_request *req, struct ast_tcptls_session_in
+@@ -2891,7 +2890,7 @@ static int sip_tcptls_read(struct sip_request *req, struct ast_tcptls_session_in
return -1;
}
@@ -295,7 +295,7 @@ index 297981a..ac44f2d 100644
if (res < 0) {
if (errno == EAGAIN || errno == EINTR) {
continue;
-@@ -2950,18 +2949,8 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -2952,18 +2951,8 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
goto cleanup;
}
@@ -315,8 +315,8 @@ index 297981a..ac44f2d 100644
+ if (!(me = sip_threadinfo_create(tcptls_session, ast_iostream_get_ssl(tcptls_session->stream) ? AST_TRANSPORT_TLS : AST_TRANSPORT_TCP))) {
goto cleanup;
}
- ao2_t_ref(me, +1, "Adding threadinfo ref for tcp_helper_thread");
-@@ -2978,16 +2967,16 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+ me->threadid = pthread_self();
+@@ -2986,15 +2975,15 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
}
flags = 1;
@@ -326,7 +326,6 @@ index 297981a..ac44f2d 100644
goto cleanup;
}
- me->threadid = pthread_self();
- ast_debug(2, "Starting thread for %s server\n", tcptls_session->ssl ? "TLS" : "TCP");
+ ast_debug(2, "Starting thread for %s server\n", ast_iostream_get_ssl(tcptls_session->stream) ? "TLS" : "TCP");
@@ -336,7 +335,7 @@ index 297981a..ac44f2d 100644
fds[1].fd = me->alert_pipe[0];
fds[0].events = fds[1].events = POLLIN | POLLPRI;
-@@ -3007,9 +2996,9 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3014,9 +3003,9 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
* We cannot let the stream exclusively wait for data to arrive.
* We have to wake up the task to send outgoing messages.
*/
@@ -348,7 +347,7 @@ index 297981a..ac44f2d 100644
tcptls_session->client ? -1 : (authtimeout * 1000));
for (;;) {
-@@ -3017,7 +3006,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3024,7 +3013,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
if (!tcptls_session->client && req.authenticated && !authenticated) {
authenticated = 1;
@@ -357,7 +356,7 @@ index 297981a..ac44f2d 100644
ast_atomic_fetchadd_int(&unauth_sessions, -1);
}
-@@ -3028,7 +3017,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3035,7 +3024,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
}
if (timeout == 0) {
@@ -366,7 +365,7 @@ index 297981a..ac44f2d 100644
goto cleanup;
}
} else {
-@@ -3038,11 +3027,11 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3045,11 +3034,11 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
if (ast_str_strlen(tcptls_session->overflow_buf) == 0) {
res = ast_poll(fds, 2, timeout); /* polls for both socket and alert_pipe */
if (res < 0) {
@@ -380,7 +379,7 @@ index 297981a..ac44f2d 100644
goto cleanup;
}
}
-@@ -3067,14 +3056,14 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3074,14 +3063,14 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
memset(buf, 0, sizeof(buf));
@@ -397,7 +396,7 @@ index 297981a..ac44f2d 100644
res = sip_tcptls_read(&req, tcptls_session, authenticated, start);
if (res < 0) {
-@@ -3108,7 +3097,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3115,7 +3104,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
ao2_unlock(me);
if (packet) {
@@ -406,7 +405,7 @@ index 297981a..ac44f2d 100644
ast_log(LOG_WARNING, "Failure to write to tcp/tls socket\n");
}
ao2_t_ref(packet, -1, "tcptls packet sent, this is no longer needed");
-@@ -3120,7 +3109,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3127,7 +3116,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
}
}
@@ -415,7 +414,7 @@ index 297981a..ac44f2d 100644
cleanup:
if (tcptls_session && !tcptls_session->client && !authenticated) {
-@@ -29089,9 +29078,8 @@ static int sip_prepare_socket(struct sip_pvt *p)
+@@ -29101,9 +29090,8 @@ static int sip_prepare_socket(struct sip_pvt *p)
return s->fd;
}
if ((s->type & (AST_TRANSPORT_TCP | AST_TRANSPORT_TLS)) &&
@@ -427,7 +426,7 @@ index 297981a..ac44f2d 100644
}
if ((s->type & (AST_TRANSPORT_WS | AST_TRANSPORT_WSS))) {
return s->ws_session ? ast_websocket_fd(s->ws_session) : -1;
-@@ -29121,7 +29109,7 @@ static int sip_prepare_socket(struct sip_pvt *p)
+@@ -29133,7 +29121,7 @@ static int sip_prepare_socket(struct sip_pvt *p)
/* 1. check for existing threads */
ast_sockaddr_copy(&sa_tmp, sip_real_dst(p));
if ((tcptls_session = sip_tcp_locate(&sa_tmp))) {
@@ -436,7 +435,7 @@ index 297981a..ac44f2d 100644
if (s->tcptls_session) {
ao2_ref(s->tcptls_session, -1);
s->tcptls_session = NULL;
-@@ -29168,7 +29156,7 @@ static int sip_prepare_socket(struct sip_pvt *p)
+@@ -29180,7 +29168,7 @@ static int sip_prepare_socket(struct sip_pvt *p)
goto create_tcptls_session_fail;
}
@@ -445,7 +444,7 @@ index 297981a..ac44f2d 100644
/* client connections need to have the sip_threadinfo object created before
* the thread is detached. This ensures the alert_pipe is up before it will
-@@ -29970,8 +29958,7 @@ static int sip_send_keepalive(const void *data)
+@@ -29982,8 +29970,7 @@ static int sip_send_keepalive(const void *data)
if ((peer->socket.fd != -1) && (peer->socket.type == AST_TRANSPORT_UDP)) {
res = ast_sendto(peer->socket.fd, keepalive, sizeof(keepalive), 0, &peer->addr);
} else if ((peer->socket.type & (AST_TRANSPORT_TCP | AST_TRANSPORT_TLS)) &&
@@ -456,10 +455,10 @@ index 297981a..ac44f2d 100644
} else if (peer->socket.type == AST_TRANSPORT_UDP) {
res = ast_sendto(sipsock, keepalive, sizeof(keepalive), 0, &peer->addr);
diff --git a/configure.ac b/configure.ac
-index 66c8971..20bbf76 100644
+index 53bede497d..c30a89b0b1 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -815,10 +815,6 @@ AC_ARG_ENABLE([asteriskssl],
+@@ -821,10 +821,6 @@ AC_ARG_ENABLE([asteriskssl],
esac], [AST_ASTERISKSSL=yes])
AC_SUBST(AST_ASTERISKSSL)
@@ -472,7 +471,7 @@ index 66c8971..20bbf76 100644
# check if we have IP_PKTINFO constant defined
diff --git a/include/asterisk/iostream.h b/include/asterisk/iostream.h
new file mode 100644
-index 0000000..c641ffb
+index 0000000000..c641ffb373
--- /dev/null
+++ b/include/asterisk/iostream.h
@@ -0,0 +1,118 @@
@@ -595,7 +594,7 @@ index 0000000..c641ffb
+
+#endif /* _ASTERISK_IOSTREAM_H */
diff --git a/include/asterisk/tcptls.h b/include/asterisk/tcptls.h
-index 3c5f450..883cb92 100644
+index d19ec529a9..1e3a7524bf 100644
--- a/include/asterisk/tcptls.h
+++ b/include/asterisk/tcptls.h
@@ -57,20 +57,7 @@
@@ -620,8 +619,8 @@ index 3c5f450..883cb92 100644
/*! SSL support */
#define AST_CERTFILE "asterisk.pem"
-@@ -153,72 +140,10 @@ struct ast_tcptls_session_args {
- const char *name;
+@@ -157,72 +144,10 @@ struct ast_tcptls_session_args {
+ struct ast_tls_config *old_tls_cfg; /*!< copy of the SSL configuration to determine whether changes have been made */
};
-struct ast_tcptls_stream;
@@ -693,7 +692,7 @@ index 3c5f450..883cb92 100644
int client;
struct ast_sockaddr remote_address;
struct ast_tcptls_session_args *parent;
-@@ -228,20 +153,12 @@ struct ast_tcptls_session_instance {
+@@ -232,20 +157,12 @@ struct ast_tcptls_session_instance {
* extra data.
*/
struct ast_str *overflow_buf;
@@ -716,7 +715,7 @@ index 3c5f450..883cb92 100644
/*!
* \brief attempts to connect and start tcptls session, on error the tcptls_session's
* ref count is decremented, fd and file are closed, and NULL is returned.
-@@ -297,7 +214,4 @@ void ast_ssl_teardown(struct ast_tls_config *cfg);
+@@ -301,7 +218,4 @@ void ast_ssl_teardown(struct ast_tls_config *cfg);
*/
int ast_tls_read_conf(struct ast_tls_config *tls_cfg, struct ast_tcptls_session_args *tls_desc, const char *varname, const char *value);
@@ -725,7 +724,7 @@ index 3c5f450..883cb92 100644
-
#endif /* _ASTERISK_TCPTLS_H */
diff --git a/main/http.c b/main/http.c
-index da564da..8cb1c2f 100644
+index da564da203..8cb1c2f7ad 100644
--- a/main/http.c
+++ b/main/http.c
@@ -451,11 +451,13 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
@@ -960,7 +959,7 @@ index da564da..8cb1c2f 100644
}
diff --git a/main/iostream.c b/main/iostream.c
new file mode 100644
-index 0000000..46abc18
+index 0000000000..46abc18a5c
--- /dev/null
+++ b/main/iostream.c
@@ -0,0 +1,553 @@
@@ -1518,7 +1517,7 @@ index 0000000..46abc18
+#endif
+}
diff --git a/main/manager.c b/main/manager.c
-index 32322b8..8c3220e 100644
+index 9a7f4c80fc..e31e348d6a 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1551,8 +1551,7 @@ static void acl_change_stasis_unsubscribe(void)
@@ -1626,7 +1625,7 @@ index 32322b8..8c3220e 100644
break;
}
} else { /* HTTP session */
-@@ -5926,7 +5922,7 @@ static int process_events(struct mansession *s)
+@@ -5930,7 +5926,7 @@ static int process_events(struct mansession *s)
int ret = 0;
ao2_lock(s->session);
@@ -1635,7 +1634,7 @@ index 32322b8..8c3220e 100644
struct eventqent *eqe = s->session->last_ev;
while ((eqe = advance_event(eqe))) {
-@@ -6468,7 +6464,7 @@ static int get_input(struct mansession *s, char *output)
+@@ -6472,7 +6468,7 @@ static int get_input(struct mansession *s, char *output)
s->session->waiting_thread = pthread_self();
ao2_unlock(s->session);
@@ -1644,7 +1643,7 @@ index 32322b8..8c3220e 100644
ao2_lock(s->session);
s->session->waiting_thread = AST_PTHREADT_NULL;
-@@ -6486,7 +6482,7 @@ static int get_input(struct mansession *s, char *output)
+@@ -6490,7 +6486,7 @@ static int get_input(struct mansession *s, char *output)
}
ao2_lock(s->session);
@@ -1653,7 +1652,7 @@ index 32322b8..8c3220e 100644
if (res < 1) {
res = -1; /* error return */
} else {
-@@ -6619,13 +6615,12 @@ static void *session_do(void *data)
+@@ -6623,13 +6619,12 @@ static void *session_do(void *data)
struct mansession s = {
.tcptls_session = data,
};
@@ -1669,7 +1668,7 @@ index 32322b8..8c3220e 100644
ast_atomic_fetchadd_int(&unauth_sessions, -1);
goto done;
}
-@@ -6634,7 +6629,7 @@ static void *session_do(void *data)
+@@ -6638,7 +6633,7 @@ static void *session_do(void *data)
session = build_mansession(&ser_remote_address_tmp);
if (session == NULL) {
@@ -1678,7 +1677,7 @@ index 32322b8..8c3220e 100644
ast_atomic_fetchadd_int(&unauth_sessions, -1);
goto done;
}
-@@ -6642,20 +6637,10 @@ static void *session_do(void *data)
+@@ -6646,20 +6641,10 @@ static void *session_do(void *data)
/* here we set TCP_NODELAY on the socket to disable Nagle's algorithm.
* This is necessary to prevent delays (caused by buffering) as we
* write to the socket in bits and pieces. */
@@ -1702,7 +1701,7 @@ index 32322b8..8c3220e 100644
ao2_lock(session);
/* Hook to the tail of the event queue */
-@@ -6664,8 +6649,7 @@ static void *session_do(void *data)
+@@ -6668,8 +6653,7 @@ static void *session_do(void *data)
ast_mutex_init(&s.lock);
/* these fields duplicate those in the 'ser' structure */
@@ -1712,7 +1711,7 @@ index 32322b8..8c3220e 100644
ast_sockaddr_copy(&session->addr, &ser_remote_address_tmp);
s.session = session;
-@@ -6684,9 +6668,9 @@ static void *session_do(void *data)
+@@ -6688,9 +6672,9 @@ static void *session_do(void *data)
* We cannot let the stream exclusively wait for data to arrive.
* We have to wake up the task to send async events.
*/
@@ -1724,7 +1723,7 @@ index 32322b8..8c3220e 100644
ast_tvnow(), authtimeout * 1000);
astman_append(&s, "Asterisk Call Manager/%s\r\n", AMI_VERSION); /* welcome prompt */
-@@ -6695,7 +6679,7 @@ static void *session_do(void *data)
+@@ -6699,7 +6683,7 @@ static void *session_do(void *data)
break;
}
if (session->authenticated) {
@@ -1733,7 +1732,7 @@ index 32322b8..8c3220e 100644
}
}
/* session is over, explain why and terminate */
-@@ -7554,23 +7538,9 @@ static void xml_translate(struct ast_str **out, char *in, struct ast_variable *g
+@@ -7558,23 +7542,9 @@ static void xml_translate(struct ast_str **out, char *in, struct ast_variable *g
static void close_mansession_file(struct mansession *s)
{
@@ -1760,7 +1759,7 @@ index 32322b8..8c3220e 100644
} else {
ast_log(LOG_ERROR, "Attempted to close file/file descriptor on mansession without a valid file or file descriptor.\n");
}
-@@ -7579,17 +7549,20 @@ static void close_mansession_file(struct mansession *s)
+@@ -7583,17 +7553,20 @@ static void close_mansession_file(struct mansession *s)
static void process_output(struct mansession *s, struct ast_str **out, struct ast_variable *params, enum output_format format)
{
char *buf;
@@ -1787,7 +1786,7 @@ index 32322b8..8c3220e 100644
ast_log(LOG_WARNING, "mmap failed. Manager output was not processed\n");
} else {
if (format == FORMAT_XML || format == FORMAT_HTML) {
-@@ -7616,6 +7589,7 @@ static int generic_http_callback(struct ast_tcptls_session_instance *ser,
+@@ -7620,6 +7593,7 @@ static int generic_http_callback(struct ast_tcptls_session_instance *ser,
struct mansession s = { .session = NULL, .tcptls_session = ser };
struct mansession_session *session = NULL;
uint32_t ident;
@@ -1795,7 +1794,7 @@ index 32322b8..8c3220e 100644
int blastaway = 0;
struct ast_variable *v;
struct ast_variable *params = get_params;
-@@ -7671,17 +7645,17 @@ static int generic_http_callback(struct ast_tcptls_session_instance *ser,
+@@ -7675,17 +7649,17 @@ static int generic_http_callback(struct ast_tcptls_session_instance *ser,
}
s.session = session;
@@ -1818,7 +1817,7 @@ index 32322b8..8c3220e 100644
goto generic_callback_out;
}
-@@ -7821,9 +7795,9 @@ generic_callback_out:
+@@ -7825,9 +7799,9 @@ generic_callback_out:
if (blastaway) {
session_destroy(session);
} else {
@@ -1831,7 +1830,7 @@ index 32322b8..8c3220e 100644
}
unref_mansession(session);
}
-@@ -7848,6 +7822,7 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
+@@ -7852,6 +7826,7 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
struct message m = { 0 };
unsigned int idx;
size_t hdrlen;
@@ -1839,7 +1838,7 @@ index 32322b8..8c3220e 100644
time_t time_now = time(NULL);
unsigned long nonce = 0, nc;
-@@ -8026,17 +8001,17 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
+@@ -8030,17 +8005,17 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
ast_mutex_init(&s.lock);
s.session = session;
@@ -1862,7 +1861,7 @@ index 32322b8..8c3220e 100644
goto auth_callback_out;
}
-@@ -8087,7 +8062,7 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
+@@ -8091,7 +8066,7 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
m.headers[idx] = NULL;
}
@@ -1871,7 +1870,7 @@ index 32322b8..8c3220e 100644
http_header = ast_str_create(80);
out = ast_str_create(result_size * 2 + 512);
-@@ -8139,11 +8114,10 @@ auth_callback_out:
+@@ -8143,11 +8118,10 @@ auth_callback_out:
ast_free(out);
ao2_lock(session);
@@ -1887,12 +1886,12 @@ index 32322b8..8c3220e 100644
if (session->needdestroy) {
diff --git a/main/tcptls.c b/main/tcptls.c
-index 046501b..44b609f 100644
+index 513676c926..6530d87ca1 100644
--- a/main/tcptls.c
+++ b/main/tcptls.c
-@@ -49,506 +49,13 @@ ASTERISK_REGISTER_FILE()
- #include "asterisk/astobj2.h"
+@@ -51,512 +51,13 @@ ASTERISK_REGISTER_FILE()
#include "asterisk/pbx.h"
+ #include "asterisk/app.h"
-/*! ao2 object used for the FILE stream fopencookie()/funopen() cookie. */
-struct ast_tcptls_stream {
@@ -2242,13 +2241,19 @@ index 046501b..44b609f 100644
- SSL_get_error(stream->ssl, res));
- }
-
+-#if defined(OPENSSL_API_COMPAT) && OPENSSL_API_COMPAT >= 0x10100000L
+- if (!SSL_is_server(stream->ssl)) {
+-#else
- if (!stream->ssl->server) {
+-#endif
- /* For client threads, ensure that the error stack is cleared */
+-#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
- ERR_remove_thread_state(NULL);
-#else
- ERR_remove_state(0);
-#endif /* OPENSSL_VERSION_NUMBER >= 0x10000000L */
+-#endif /* !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L */
- }
-
- SSL_free(stream->ssl);
@@ -2400,7 +2405,7 @@ index 046501b..44b609f 100644
}
ast_free(i->overflow_buf);
ao2_cleanup(i->private_data);
-@@ -593,9 +100,7 @@ static void *handle_tcptls_connection(void *data)
+@@ -601,9 +102,7 @@ static void *handle_tcptls_connection(void *data)
{
struct ast_tcptls_session_instance *tcptls_session = data;
#ifdef DO_SSL
@@ -2411,7 +2416,7 @@ index 046501b..44b609f 100644
#endif
/* TCP/TLS connections are associated with external protocols, and
-@@ -610,123 +115,94 @@ static void *handle_tcptls_connection(void *data)
+@@ -618,123 +117,94 @@ static void *handle_tcptls_connection(void *data)
return NULL;
}
@@ -2604,7 +2609,7 @@ index 046501b..44b609f 100644
}
if (tcptls_session->parent->worker_fn) {
-@@ -774,7 +250,13 @@ void *ast_tcptls_server_root(void *data)
+@@ -782,7 +252,13 @@ void *ast_tcptls_server_root(void *data)
tcptls_session->overflow_buf = ast_str_create(128);
flags = fcntl(fd, F_GETFL);
fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
@@ -2619,7 +2624,7 @@ index 046501b..44b609f 100644
tcptls_session->parent = desc;
ast_sockaddr_copy(&tcptls_session->remote_address, &addr);
-@@ -1038,7 +520,7 @@ client_start_error:
+@@ -1046,7 +522,7 @@ client_start_error:
struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_session_args *desc)
{
@@ -2628,7 +2633,7 @@ index 046501b..44b609f 100644
struct ast_tcptls_session_instance *tcptls_session = NULL;
/* Do nothing if nothing has changed */
-@@ -1054,8 +536,8 @@ struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_s
+@@ -1062,8 +538,8 @@ struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_s
close(desc->accept_fd);
}
@@ -2639,7 +2644,7 @@ index 046501b..44b609f 100644
if (desc->accept_fd < 0) {
ast_log(LOG_ERROR, "Unable to allocate socket for %s: %s\n",
desc->name, strerror(errno));
-@@ -1081,7 +563,11 @@ struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_s
+@@ -1089,7 +565,11 @@ struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_s
tcptls_session->overflow_buf = ast_str_create(128);
tcptls_session->client = 1;
@@ -2652,7 +2657,7 @@ index 046501b..44b609f 100644
tcptls_session->parent = desc;
tcptls_session->parent->worker_fn = NULL;
ast_sockaddr_copy(&tcptls_session->remote_address,
-@@ -1172,24 +658,9 @@ error:
+@@ -1251,24 +731,9 @@ error:
void ast_tcptls_close_session_file(struct ast_tcptls_session_instance *tcptls_session)
{
@@ -2681,10 +2686,10 @@ index 046501b..44b609f 100644
ast_log(LOG_ERROR, "ast_tcptls_close_session_file invoked on session instance without file or file descriptor\n");
}
diff --git a/main/utils.c b/main/utils.c
-index 3dfc02c..f406dbe 100644
+index 14d529cf44..c72fdac923 100644
--- a/main/utils.c
+++ b/main/utils.c
-@@ -1429,68 +1429,6 @@ int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
+@@ -1429,74 +1429,6 @@ int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
return res;
}
@@ -2707,7 +2712,9 @@ index 3dfc02c..f406dbe 100644
-
- if (ferror(f) && errno != EINTR && errno != EAGAIN) {
- /* fatal error from fwrite() */
-- if (!feof(f)) {
+- if (errno == EPIPE) {
+- ast_debug(1, "fwrite() failed due to reading end being closed: EPIPE\n");
+- } else if (!feof(f)) {
- /* Don't spam the logs if it was just that the connection is closed. */
- ast_log(LOG_ERROR, "fwrite() returned error: %s\n", strerror(errno));
- }
@@ -2740,8 +2747,12 @@ index 3dfc02c..f406dbe 100644
- continue;
- }
- if (errno && !feof(f)) {
-- /* Don't spam the logs if it was just that the connection is closed. */
-- ast_log(LOG_ERROR, "fflush() returned error: %s\n", strerror(errno));
+- if (errno == EPIPE) {
+- ast_debug(1, "fflush() failed due to reading end being closed: EPIPE\n");
+- } else {
+- /* Don't spam the logs if it was just that the connection is closed. */
+- ast_log(LOG_ERROR, "fflush() returned error: %s\n", strerror(errno));
+- }
- }
- n = -1;
- break;
@@ -2754,7 +2765,7 @@ index 3dfc02c..f406dbe 100644
{
char *e;
diff --git a/res/res_http_post.c b/res/res_http_post.c
-index 37fc4fa..907ee56 100644
+index 37fc4fa091..907ee56fbd 100644
--- a/res/res_http_post.c
+++ b/res/res_http_post.c
@@ -213,7 +213,7 @@ static int find_sequence(char * inbuf, int inlen, char * matchbuf, int matchlen)
@@ -2796,7 +2807,7 @@ index 37fc4fa..907ee56 100644
fclose(f);
ast_http_error(ser, 400, "Bad Request", "Cannot find boundary marker in POST request.");
diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c
-index 8476e26..ce6430f 100644
+index 8476e26312..ce6430ff1d 100644
--- a/res/res_http_websocket.c
+++ b/res/res_http_websocket.c
@@ -88,8 +88,7 @@ ASTERISK_REGISTER_FILE()
@@ -3083,7 +3094,7 @@ index 8476e26..ce6430f 100644
return WS_OK;
}
diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c
-index 2e4f873..1b77b9f 100644
+index 2e4f873623..1b77b9f48b 100644
--- a/res/res_phoneprov.c
+++ b/res/res_phoneprov.c
@@ -950,7 +950,7 @@ static int phoneprov_callback(struct ast_tcptls_session_instance *ser, const str
@@ -3096,9 +3107,10 @@ index 2e4f873..1b77b9f 100644
} else {
struct extension *exten_iter;
--
-2.10.2
+2.11.1
-From e3dae763ee77485bcbcf8818d2b8c9570afe3013 Mon Sep 17 00:00:00 2001
+
+From b7469e205ee301966df8ec3d3ab3365ce874f3e5 Mon Sep 17 00:00:00 2001
From: Joshua Colp <jcolp@digium.com>
Date: Mon, 28 Nov 2016 13:36:18 +0000
Subject: [PATCH] iostream: Move include of asterisk.h
@@ -3131,9 +3143,10 @@ index 46abc18a5c..008888142b 100644
#include "asterisk/astobj2.h"
#include "asterisk/iostream.h"
--
-2.11.0
+2.11.1
+
-From bf6423a33678d95896cfb6325572dab3a23e6d6a Mon Sep 17 00:00:00 2001
+From e2ea88b2ea33f012b52df2afc4114375032caee7 Mon Sep 17 00:00:00 2001
From: Mark Michelson <mmichelson@digium.com>
Date: Tue, 6 Dec 2016 10:56:06 -0600
Subject: [PATCH] Iostreams: Correct off-by-one error.
@@ -3160,7 +3173,7 @@ Change-Id: Ib3c5f41e96833d0415cf000656ac368168add639
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/main/iostream.c b/main/iostream.c
-index a20a048964..22cd5985c4 100644
+index 008888142b..9fa39cce59 100644
--- a/main/iostream.c
+++ b/main/iostream.c
@@ -404,7 +404,7 @@ ssize_t ast_iostream_write(struct ast_iostream *stream, const void *buf, size_t
@@ -3196,9 +3209,10 @@ index a20a048964..22cd5985c4 100644
}
}
--
-2.11.0
+2.11.1
-From 503006123a9eecdaedf74295367af99578f021b7 Mon Sep 17 00:00:00 2001
+
+From 817d7d426ca8d6efb5b4e5dac25e8beabc5f8475 Mon Sep 17 00:00:00 2001
From: Mark Michelson <mmichelson@digium.com>
Date: Thu, 1 Dec 2016 16:49:03 -0600
Subject: [PATCH] http: Send headers and body in one write.
@@ -3229,10 +3243,10 @@ Change-Id: Idc2d2fb3d9b3db14b8631a1e302244fa18b0e518
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/main/http.c b/main/http.c
-index 9aff4d1676..5f57b1eb01 100644
+index 8cb1c2f7ad..4db81b5363 100644
--- a/main/http.c
+++ b/main/http.c
-@@ -454,6 +454,7 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
+@@ -456,6 +456,7 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
int content_length = 0;
int close_connection;
struct ast_str *server_header_field = ast_str_create(MAX_SERVER_NAME_LENGTH);
@@ -3240,7 +3254,7 @@ index 9aff4d1676..5f57b1eb01 100644
if (!ser || !server_header_field) {
/* The connection is not open. */
-@@ -504,6 +505,8 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
+@@ -506,6 +507,8 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
lseek(fd, 0, SEEK_SET);
}
@@ -3249,7 +3263,7 @@ index 9aff4d1676..5f57b1eb01 100644
/* send http header */
ast_iostream_printf(ser->stream,
"HTTP/1.1 %d %s\r\n"
-@@ -513,33 +516,25 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
+@@ -515,33 +518,25 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
"%s"
"%s"
"Content-Length: %d\r\n"
@@ -3293,9 +3307,10 @@ index 9aff4d1676..5f57b1eb01 100644
}
}
--
-2.11.0
+2.11.1
+
-From 149d8db96ce4390f52be84d5846b053e02e6b907 Mon Sep 17 00:00:00 2001
+From 2ff54904f63da2bcfafd101aa233614a099a722b Mon Sep 17 00:00:00 2001
From: Badalyan Vyacheslav <v.badalyan@open-bs.ru>
Date: Thu, 8 Dec 2016 18:34:28 +0000
Subject: [PATCH] Fix IO conversion bug
@@ -3309,10 +3324,10 @@ Change-Id: Id9f393ff25b009a6c4a6e40b95f561a9369e4585
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c
-index 106ba488be..84138234eb 100644
+index ce6430ff1d..80f965ec05 100644
--- a/res/res_http_websocket.c
+++ b/res/res_http_websocket.c
-@@ -490,7 +490,7 @@ const char * AST_OPTIONAL_API_NAME(ast_websocket_session_id)(struct ast_websocke
+@@ -492,7 +492,7 @@ const char * AST_OPTIONAL_API_NAME(ast_websocket_session_id)(struct ast_websocke
*/
static inline int ws_safe_read(struct ast_websocket *session, char *buf, int len, enum ast_websocket_opcode *opcode)
{
@@ -3322,5 +3337,5 @@ index 106ba488be..84138234eb 100644
char *rbuf = buf;
int sanity = 10;
--
-2.11.0
+2.11.1
diff --git a/main/asterisk/fix-strerror_r.patch b/main/asterisk/fix-strerror_r.patch
deleted file mode 100644
index 97894309bd..0000000000
--- a/main/asterisk/fix-strerror_r.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 3d7089121731a1122e1306e631adaf5004ac323c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Fri, 11 Nov 2016 08:29:40 +0200
-Subject: [PATCH] addons/chan_mobile: do not use strerror_r
-
-The two reasons why it might be used are that some systems do not
-implement strerror in thread safe manner, and that strerror_r returns
-the error code in the string in case there's no error message.
-
-However, all of asterisk elsewhere uses strerror() and assumes it
-to be thread safe. And in chan_mobile the errno is also explicitly
-printed so neither of the above reasons are valid.
-
-The reasoning to remove usage is that there are actually two versions
-of strerror_r: XSI and GNU. They are incompatible in their return
-value, and there's no easy way to figure out which one is being
-used. glibc gives you the GNU version if _GNU_SOURCE is defined,
-but the same feature test macro is needed for other symbols. On
-all other systems you assumedly get XSI symbol, and compilation warnings
-as well as non-working error printing.
-
-Thus the easiest solution is to just remove strerror_r and use
-strerror as rest of the code. Alternative is to introduce ast_strerror
-in separate translation unit so it can request the XSI symbol in
-glibc case, and replace all usage of strerror.
-
-Change-Id: I84d35225b5642d85d48bc35fdf399afbae28a91d
----
- addons/chan_mobile.c | 13 +++----------
- 1 file changed, 3 insertions(+), 10 deletions(-)
-
-diff --git a/addons/chan_mobile.c b/addons/chan_mobile.c
-index 64d53b7..8d13c96 100644
---- a/addons/chan_mobile.c
-+++ b/addons/chan_mobile.c
-@@ -3855,10 +3855,7 @@ static void *do_monitor_phone(void *data)
- }
-
- if ((at_msg = at_read_full(hfp->rsock, buf, sizeof(buf))) < 0) {
-- /* XXX gnu specific strerror_r is assummed here, this
-- * is not really safe. See the strerror(3) man page
-- * for more info. */
-- ast_debug(1, "[%s] error reading from device: %s (%d)\n", pvt->id, strerror_r(errno, buf, sizeof(buf)), errno);
-+ ast_debug(1, "[%s] error reading from device: %s (%d)\n", pvt->id, strerror(errno), errno);
- break;
- }
-
-@@ -3995,7 +3992,7 @@ static void *do_monitor_phone(void *data)
- ast_debug(1, "[%s] error parsing message\n", pvt->id);
- goto e_cleanup;
- case AT_READ_ERROR:
-- ast_debug(1, "[%s] error reading from device: %s (%d)\n", pvt->id, strerror_r(errno, buf, sizeof(buf)), errno);
-+ ast_debug(1, "[%s] error reading from device: %s (%d)\n", pvt->id, strerror(errno), errno);
- goto e_cleanup;
- default:
- break;
-@@ -4073,11 +4070,7 @@ static void *do_monitor_headset(void *data)
- continue;
-
- if ((at_msg = at_read_full(pvt->rfcomm_socket, buf, sizeof(buf))) < 0) {
-- if (strerror_r(errno, buf, sizeof(buf)))
-- ast_debug(1, "[%s] error reading from device\n", pvt->id);
-- else
-- ast_debug(1, "[%s] error reading from device: %s (%d)\n", pvt->id, buf, errno);
--
-+ ast_debug(1, "[%s] error reading from device: %s (%d)\n", pvt->id, strerror(errno), errno);
- goto e_cleanup;
- }
- ast_debug(1, "[%s] %s\n", pvt->id, buf);
---
-2.10.2
-