mirror of https://github.com/sipwise/kamailio.git
* refresh patches * remove already applied patches Change-Id: I16f7163dc5da46dadfefb3a343727e51020bff3bmr9.5.6
parent
3d095b202c
commit
ed771f717c
@ -1,47 +0,0 @@
|
||||
From 680d98caccc0216f43c2b5de83935dbc4853ab9d Mon Sep 17 00:00:00 2001
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Fri, 13 Aug 2021 08:57:10 +0200
|
||||
Subject: [PATCH] core: ip addr - use POSIX INET6_ADDRSTRLEN and
|
||||
INET_ADDRSTRLEN to define sizes
|
||||
|
||||
- set the values of IP4_MAX_STR_SIZE and IP6_MAX_STR_SIZE based on them,
|
||||
if defined, or to 15 and 45
|
||||
- cope with IPv6 with IPv4 tunneling representation (RFC 4291 section 2.2)
|
||||
- cover the requirements of using inet_ntop()
|
||||
- GH #2823
|
||||
|
||||
(cherry picked from commit 22a72f3a7725d56f00e22bdc52d44bd53da7c091)
|
||||
---
|
||||
src/core/ip_addr.h | 16 ++++++++++++++--
|
||||
1 file changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/core/ip_addr.h b/src/core/ip_addr.h
|
||||
index 546c822423..132f653255 100644
|
||||
--- a/src/core/ip_addr.h
|
||||
+++ b/src/core/ip_addr.h
|
||||
@@ -510,8 +510,20 @@ int hostent2su(union sockaddr_union* su,
|
||||
|
||||
|
||||
/* maximum size of a str returned by ip_addr2str */
|
||||
-#define IP6_MAX_STR_SIZE 39 /*1234:5678:9012:3456:7890:1234:5678:9012*/
|
||||
-#define IP4_MAX_STR_SIZE 15 /*123.456.789.012*/
|
||||
+/* POSIX INET6_ADDRSTRLEN (RFC 4291 section 2.2) - IPv6 with IPv4 tunneling
|
||||
+ * (39): 1234:5678:9012:3456:7890:1234:5678:9012
|
||||
+ * (45): ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255 */
|
||||
+#ifdef INET6_ADDRSTRLEN
|
||||
+#define IP6_MAX_STR_SIZE (INET6_ADDRSTRLEN-1)
|
||||
+#else
|
||||
+#define IP6_MAX_STR_SIZE 45
|
||||
+#endif
|
||||
+/*123.456.789.123*/
|
||||
+#ifdef INET_ADDRSTRLEN
|
||||
+#define IP4_MAX_STR_SIZE (INET_ADDRSTRLEN-1)
|
||||
+#else
|
||||
+#define IP4_MAX_STR_SIZE 15
|
||||
+#endif
|
||||
|
||||
/* converts a raw ipv6 addr (16 bytes) to ascii */
|
||||
int ip6tosbuf(unsigned char* ip6, char* buff, int len);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
From: Andrii Pogrebennyk <andrii@ng-voice.com>
|
||||
Date: Sun, 28 Nov 2021 08:34:36 +0100
|
||||
Subject: db_redis: don't leave unconsumed redis replies in case of error on
|
||||
update
|
||||
|
||||
Execute db_redis_consume_replies on failed update same as in db_redis_insert:
|
||||
if db_redis_perform_update encounters an error it was leaving unconsumed data
|
||||
thus causing unexpected reply later on when reading from the same connection.
|
||||
|
||||
(cherry picked from commit bbd7b2ed5827252680e9d8949c193699da0a76b2)
|
||||
---
|
||||
src/modules/db_redis/redis_dbase.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c
|
||||
index 5258d57..ffe6ad7 100644
|
||||
--- a/src/modules/db_redis/redis_dbase.c
|
||||
+++ b/src/modules/db_redis/redis_dbase.c
|
||||
@@ -2292,6 +2292,7 @@ static int db_redis_perform_update(const db1_con_t* _h, km_redis_con_t *con, con
|
||||
|
||||
db_redis_key_free(&all_type_keys);
|
||||
db_redis_key_free(&new_type_keys);
|
||||
+ db_redis_consume_replies(con);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
@@ -2303,6 +2304,7 @@ error:
|
||||
db_redis_key_free(&type_keys);
|
||||
db_redis_key_free(&set_keys);
|
||||
db_redis_key_free(&new_type_keys);
|
||||
+ db_redis_consume_replies(con);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1,112 +0,0 @@
|
||||
From: Dmitry Wagin <dmitry.wagin@ya.ru>
|
||||
Date: Tue, 15 Jun 2021 15:58:12 +0300
|
||||
Subject: nathelper: fix_nated_sdp added ignoring RFC3605-param if omitted
|
||||
|
||||
- doesn't throw an error while "a=rtcp" param is omitted (RFC1889 behavior) or address is omitted
|
||||
- replace_sdp_ip() returns 0 on omitted IP-address
|
||||
- added param can_omit to replace_sdp_ip()
|
||||
---
|
||||
src/modules/nathelper/nathelper.c | 37 ++++++++++++++++++-------------------
|
||||
1 file changed, 18 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c
|
||||
index 1392a0a..9e45a61 100644
|
||||
--- a/src/modules/nathelper/nathelper.c
|
||||
+++ b/src/modules/nathelper/nathelper.c
|
||||
@@ -1609,13 +1609,12 @@ static int is_rfc1918_f(struct sip_msg *msg, char *str1, char *str2)
|
||||
#define AOLDMEDPRT_LEN (sizeof(AOLDMEDPRT) - 1)
|
||||
|
||||
|
||||
-/* replace ip addresses in SDP and return umber of replacements */
|
||||
+/* replace ip addresses in SDP and return number of replacements */
|
||||
static inline int replace_sdp_ip(
|
||||
- struct sip_msg *msg, str *org_body, char *line, str *ip, int linelen)
|
||||
+ struct sip_msg *msg, str *org_body, char *line, str *ip, int linelen, int can_omit)
|
||||
{
|
||||
str body1, oldip, newip;
|
||||
str body = *org_body;
|
||||
- unsigned hasreplaced = 0;
|
||||
int pf, pf1 = 0;
|
||||
str body2;
|
||||
char *bodylimit = body.s + body.len;
|
||||
@@ -1631,10 +1630,17 @@ static inline int replace_sdp_ip(
|
||||
}
|
||||
body1 = body;
|
||||
for(;;) {
|
||||
- if(nh_extract_mediaip(&body1, &oldip, &pf, line, linelen) == -1)
|
||||
+ ret = nh_extract_mediaip(&body1, &oldip, &pf, line, linelen);
|
||||
+ if(ret == 0)
|
||||
break;
|
||||
- if(pf != AF_INET) {
|
||||
- LM_ERR("not an IPv4 address in '%s' SDP\n", line);
|
||||
+ if(ret == -1) {
|
||||
+ if(can_omit) {
|
||||
+ body2.s = body1.s + linelen;
|
||||
+ body2.len = bodylimit - body2.s;
|
||||
+ body1 = body2;
|
||||
+ continue;
|
||||
+ }
|
||||
+ LM_ERR("no `IP[4|6]' in `%s' field\n", line);
|
||||
return -1;
|
||||
}
|
||||
if(!pf1)
|
||||
@@ -1652,13 +1658,8 @@ static inline int replace_sdp_ip(
|
||||
return -1;
|
||||
}
|
||||
count += ret;
|
||||
- hasreplaced = 1;
|
||||
body1 = body2;
|
||||
}
|
||||
- if(!hasreplaced && linelen>=6 && memcmp("a=rtcp", line, 6)!=0) {
|
||||
- LM_ERR("can't extract '%s' IP from the SDP\n", line);
|
||||
- return -1;
|
||||
- }
|
||||
|
||||
return count;
|
||||
}
|
||||
@@ -1737,15 +1738,14 @@ static int ki_fix_nated_sdp_ip(sip_msg_t *msg, int level, str *ip)
|
||||
if(level & (FIX_MEDIP | FIX_ORGIP)) {
|
||||
|
||||
/* Iterate all a=rtcp and replace ips in them. rfc3605 */
|
||||
- ret = replace_sdp_ip(msg, &body, "a=rtcp", (ip && ip->len>0) ? ip : 0, 6);
|
||||
+ ret = replace_sdp_ip(msg, &body, "a=rtcp", (ip && ip->len>0) ? ip : 0, 6, 1);
|
||||
if(ret == -1)
|
||||
- LM_DBG("a=rtcp parameter does not exist. nothing to do.\n");
|
||||
- else
|
||||
- count += ret;
|
||||
+ return -1;
|
||||
+ count += ret;
|
||||
|
||||
if(level & FIX_MEDIP) {
|
||||
/* Iterate all c= and replace ips in them. */
|
||||
- ret = replace_sdp_ip(msg, &body, "c=", (ip && ip->len>0) ? ip : 0, 2);
|
||||
+ ret = replace_sdp_ip(msg, &body, "c=", (ip && ip->len>0) ? ip : 0, 2, 0);
|
||||
if(ret == -1)
|
||||
return -1;
|
||||
count += ret;
|
||||
@@ -1753,7 +1753,7 @@ static int ki_fix_nated_sdp_ip(sip_msg_t *msg, int level, str *ip)
|
||||
|
||||
if(level & FIX_ORGIP) {
|
||||
/* Iterate all o= and replace ips in them. */
|
||||
- ret = replace_sdp_ip(msg, &body, "o=", (ip && ip->len>0) ? ip : 0, 2);
|
||||
+ ret = replace_sdp_ip(msg, &body, "o=", (ip && ip->len>0) ? ip : 0, 2, 0);
|
||||
if(ret == -1)
|
||||
return -1;
|
||||
count += ret;
|
||||
@@ -1800,7 +1800,7 @@ static int nh_extract_mediaip(str *body, str *mediaip, int *pf, char *line,
|
||||
cp = cp1 + linelen;
|
||||
}
|
||||
if(cp1 == NULL)
|
||||
- return -1;
|
||||
+ return 0;
|
||||
|
||||
mediaip->s = cp1 + linelen;
|
||||
mediaip->len =
|
||||
@@ -1835,7 +1835,6 @@ static int nh_extract_mediaip(str *body, str *mediaip, int *pf, char *line,
|
||||
cp = eat_space_end(cp + len, mediaip->s + mediaip->len);
|
||||
}
|
||||
if(nextisip != 2 || mediaip->len == 0) {
|
||||
- LM_ERR("no `IP[4|6]' in `%s' field\n", line);
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
@ -1,110 +0,0 @@
|
||||
From: Victor Seva <vseva@sipwise.com>
|
||||
Date: Thu, 28 Oct 2021 15:54:39 +0200
|
||||
Subject: pv_headers: don't try to replace header
|
||||
|
||||
Multiple headers where not removed if new value was just one header
|
||||
---
|
||||
src/modules/pv_headers/pvh_func.c | 6 ----
|
||||
src/modules/pv_headers/pvh_hdr.c | 59 ---------------------------------------
|
||||
src/modules/pv_headers/pvh_hdr.h | 1 -
|
||||
3 files changed, 66 deletions(-)
|
||||
|
||||
diff --git a/src/modules/pv_headers/pvh_func.c b/src/modules/pv_headers/pvh_func.c
|
||||
index 7afc39d..01a7d3d 100644
|
||||
--- a/src/modules/pv_headers/pvh_func.c
|
||||
+++ b/src/modules/pv_headers/pvh_func.c
|
||||
@@ -276,12 +276,6 @@ int pvh_apply_headers(struct sip_msg *msg)
|
||||
}
|
||||
|
||||
if(!str_hash_case_get(&rm_hdrs, sub->name.s, sub->name.len)) {
|
||||
- if(!pvh_avp_is_null(sub) && xavi_count(&sub->name, &sub) == 1) {
|
||||
- LM_DBG("replace header[%s]: %s\n", sub->name.s, sub->val.v.s.s);
|
||||
- pvh_real_hdr_replace(msg, &sub->name, &sub->val.v.s);
|
||||
- pvh_str_hash_add_key(&rm_hdrs, &sub->name);
|
||||
- continue;
|
||||
- }
|
||||
LM_DBG("remove header[%s]: %s\n", sub->name.s, sub->val.v.s.s);
|
||||
pvh_real_hdr_del_by_name(msg, &sub->name);
|
||||
pvh_str_hash_add_key(&rm_hdrs, &sub->name);
|
||||
diff --git a/src/modules/pv_headers/pvh_hdr.c b/src/modules/pv_headers/pvh_hdr.c
|
||||
index d83a646..fbb471c 100644
|
||||
--- a/src/modules/pv_headers/pvh_hdr.c
|
||||
+++ b/src/modules/pv_headers/pvh_hdr.c
|
||||
@@ -131,65 +131,6 @@ int pvh_real_hdr_append(struct sip_msg *msg, str *hname, str *hvalue)
|
||||
return 1;
|
||||
}
|
||||
|
||||
-int pvh_real_hdr_replace(struct sip_msg *msg, str *hname, str *hvalue)
|
||||
-{
|
||||
- struct lump *anchor = NULL;
|
||||
- hdr_field_t *hf = NULL;
|
||||
- str new_h = STR_NULL;
|
||||
- int new = 1;
|
||||
-
|
||||
- if(hname->s == NULL || hvalue->s == NULL) {
|
||||
- LM_ERR("header name/value cannot be empty");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- for(hf = msg->headers; hf; hf = hf->next) {
|
||||
- if(hf->name.len == hname->len
|
||||
- && strncasecmp(hf->name.s, hname->s, hname->len) == 0) {
|
||||
- if(hf->body.len == hvalue->len
|
||||
- && strncasecmp(hf->body.s, hvalue->s, hvalue->len) == 0) {
|
||||
- return 1;
|
||||
- }
|
||||
- new = 0;
|
||||
- break;
|
||||
- }
|
||||
- if(!hf->next)
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if(hf == NULL) {
|
||||
- LM_ERR("unable to find header lump\n");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if(new == 0) {
|
||||
- if((anchor = del_lump(msg, hf->name.s - msg->buf, hf->len, 0)) == 0) {
|
||||
- LM_ERR("unable to delete header lump\n");
|
||||
- return -1;
|
||||
- }
|
||||
- } else {
|
||||
- anchor = anchor_lump(msg, hf->name.s + hf->len - msg->buf, 0, 0);
|
||||
- }
|
||||
-
|
||||
- if(anchor == 0) {
|
||||
- LM_ERR("unable to find header lump\n");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if(pvh_create_hdr_str(hname, hvalue, &new_h) <= 0)
|
||||
- return -1;
|
||||
-
|
||||
- if(insert_new_lump_after(anchor, new_h.s, new_h.len, 0) == 0) {
|
||||
- LM_ERR("cannot insert header lump\n");
|
||||
- pkg_free(new_h.s);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- LM_DBG("%s header: %.*s\n", new ? "append" : "replace", new_h.len, new_h.s);
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-
|
||||
int pvh_real_hdr_del_by_name(struct sip_msg *msg, str *hname)
|
||||
{
|
||||
hdr_field_t *hf = NULL;
|
||||
diff --git a/src/modules/pv_headers/pvh_hdr.h b/src/modules/pv_headers/pvh_hdr.h
|
||||
index 4f86953..a5ad415 100644
|
||||
--- a/src/modules/pv_headers/pvh_hdr.h
|
||||
+++ b/src/modules/pv_headers/pvh_hdr.h
|
||||
@@ -38,7 +38,6 @@ void pvh_hdrs_set_applied(struct sip_msg *msg);
|
||||
void pvh_hdrs_reset_flags(struct sip_msg *msg);
|
||||
|
||||
int pvh_real_hdr_append(struct sip_msg *msg, str *hname, str *hvalue);
|
||||
-int pvh_real_hdr_replace(struct sip_msg *msg, str *hname, str *hvalue);
|
||||
int pvh_real_hdr_del_by_name(struct sip_msg *msg, str *hname);
|
||||
int pvh_real_hdr_remove_display(struct sip_msg *msg, str *hname);
|
||||
int pvh_real_replace_reply_reason(struct sip_msg *msg, str *value);
|
||||
@ -1,35 +0,0 @@
|
||||
From: Victor Seva <vseva@sipwise.com>
|
||||
Date: Fri, 23 Jul 2021 15:56:11 +0200
|
||||
Subject: pv_headers: fix removal of all values on when using PV_IDX_ALL
|
||||
|
||||
$(x_hdr(whatever)[*]) = "hello" was just removing the first value
|
||||
|
||||
Change-Id: Icc170673aef64e335ef82d940b6b85c940dbde55
|
||||
|
||||
Change-Id: I3614396eccbbf616b1c53f8511c2a7b42e8ef2df
|
||||
---
|
||||
src/modules/pv_headers/pvh_xavp.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/modules/pv_headers/pvh_xavp.c b/src/modules/pv_headers/pvh_xavp.c
|
||||
index 7cba757..96fdc29 100644
|
||||
--- a/src/modules/pv_headers/pvh_xavp.c
|
||||
+++ b/src/modules/pv_headers/pvh_xavp.c
|
||||
@@ -618,7 +618,7 @@ int pvh_set_header(
|
||||
|
||||
if(val == NULL || (val->flags & PV_VAL_NULL)) {
|
||||
if(idxf == PV_IDX_ALL) {
|
||||
- cnt = xavi_rm_by_name(hname, 1, &xavi);
|
||||
+ cnt = xavi_rm_by_name(hname, 1, &avi);
|
||||
LM_DBG("removed %d values of %.*s=>%.*s, set $null\n", cnt,
|
||||
xavi->name.len, xavi->name.s, hname->len, hname->s);
|
||||
if(pvh_set_xavi(msg, &xavi_name, hname, NULL, SR_XTYPE_NULL, 0, 0)
|
||||
@@ -649,7 +649,7 @@ int pvh_set_header(
|
||||
goto err;
|
||||
} else if(idxf == PV_IDX_ALL) {
|
||||
if(hname_cnt > 1) {
|
||||
- cnt = xavi_rm_by_name(hname, 1, &xavi);
|
||||
+ cnt = xavi_rm_by_name(hname, 1, &avi);
|
||||
LM_DBG("removed %d values of %.*s=>%.*s\n", cnt, xavi->name.len,
|
||||
xavi->name.s, hname->len, hname->s);
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
From af926514ac3e70dff51408baf326b29bce4eecfc Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Tue, 27 Jul 2021 10:52:21 +0200
|
||||
Subject: [PATCH] pv_headers: pvh_set_header, remove values to set null when
|
||||
necessary
|
||||
|
||||
* fix pvh_set_xavi for SR_XTYPE_NULL
|
||||
---
|
||||
src/modules/pv_headers/pvh_xavp.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/modules/pv_headers/pvh_xavp.c b/src/modules/pv_headers/pvh_xavp.c
|
||||
index 96fdc292b0..b8e4f92e61 100644
|
||||
--- a/src/modules/pv_headers/pvh_xavp.c
|
||||
+++ b/src/modules/pv_headers/pvh_xavp.c
|
||||
@@ -375,7 +375,7 @@ int pvh_set_xavi(struct sip_msg *msg, str *xname, str *name, void *data,
|
||||
LM_DBG("br_xname: %.*s name: %.*s append:%d\n", br_xname.len, br_xname.s,
|
||||
name->len, name->s, append);
|
||||
memset(&xval, 0, sizeof(sr_xval_t));
|
||||
- if(data == NULL || SR_XTYPE_NULL) {
|
||||
+ if(data == NULL || type == SR_XTYPE_NULL) {
|
||||
xval.type = SR_XTYPE_NULL;
|
||||
} else if(type == SR_XTYPE_STR) {
|
||||
xval.type = SR_XTYPE_STR;
|
||||
@@ -618,9 +618,11 @@ int pvh_set_header(
|
||||
|
||||
if(val == NULL || (val->flags & PV_VAL_NULL)) {
|
||||
if(idxf == PV_IDX_ALL) {
|
||||
- cnt = xavi_rm_by_name(hname, 1, &avi);
|
||||
- LM_DBG("removed %d values of %.*s=>%.*s, set $null\n", cnt,
|
||||
- xavi->name.len, xavi->name.s, hname->len, hname->s);
|
||||
+ if(hname_cnt > 1) {
|
||||
+ cnt = xavi_rm_by_name(hname, 1, &avi);
|
||||
+ LM_DBG("removed %d values of %.*s=>%.*s, set $null\n", cnt,
|
||||
+ xavi->name.len, xavi->name.s, hname->len, hname->s);
|
||||
+ }
|
||||
if(pvh_set_xavi(msg, &xavi_name, hname, NULL, SR_XTYPE_NULL, 0, 0)
|
||||
< 0)
|
||||
goto err;
|
||||
--
|
||||
2.20.1
|
||||
|
||||
Loading…
Reference in new issue