[sr-dev] git:5.2:8f72e21b: sipcapture: fix inaccessible HEP chunks

Henning Westerholt hw at skalatan.de
Fri Feb 21 17:21:12 CET 2020


Module: kamailio
Branch: 5.2
Commit: 8f72e21b5f68c4dd467e3a109b1d7b1ee6091872
URL: https://github.com/kamailio/kamailio/commit/8f72e21b5f68c4dd467e3a109b1d7b1ee6091872

Author: Bastian Triller <bastian.triller at gmail.com>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-02-21T17:20:03+01:00

sipcapture: fix inaccessible HEP chunks

Chunk types 1 , 2  and 3  were not accessible.
$hep(...) pseudovariable didn't return HEP chunks of type:
* 1 (IP protocol family) returned HEP version
  (accessible via $hep(version))
* 2 (IP protocol ID) returned HEP message source IP
* 3 (IPv4 source address) returned HEP message destination IP

This removes keys src_ip and dst_ip. Use $si resp. $Ri instead.

(cherry picked from commit 459ccabe9e3975dd5a90135ab96f3cccdf4ffdbe)

---

Modified: src/modules/sipcapture/sipcapture.c

---

Diff:  https://github.com/kamailio/kamailio/commit/8f72e21b5f68c4dd467e3a109b1d7b1ee6091872.diff
Patch: https://github.com/kamailio/kamailio/commit/8f72e21b5f68c4dd467e3a109b1d7b1ee6091872.patch

---

diff --git a/src/modules/sipcapture/sipcapture.c b/src/modules/sipcapture/sipcapture.c
index f880ec4457..2050026808 100644
--- a/src/modules/sipcapture/sipcapture.c
+++ b/src/modules/sipcapture/sipcapture.c
@@ -3049,14 +3049,6 @@ static int pv_parse_hep_name(pv_spec_p sp, str *in)
 					else
 						goto error;
 				} break;
-		case 6: {
-					if(!strncmp(in->s, "src_ip", 6))
-						sp->pvp.pvn.u.isname.name.n = 2;
-					else if(!strncmp(in->s, "dst_ip", 6))
-						sp->pvp.pvn.u.isname.name.n = 3;
-					else
-						goto error;
-				} break;
 		case 7: {
 					if(!strncmp(in->s, "version", 7))
 						sp->pvp.pvn.u.isname.name.n = 0;
@@ -3079,27 +3071,12 @@ static int pv_parse_hep_name(pv_spec_p sp, str *in)
 
 static int pv_get_hep(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
 {
-	static char sc_buf_ip[IP_ADDR_MAX_STR_SIZE + 12];
-	int sc_buf_ip_len;
-
 	if(param == NULL)
 		return -1;
 
 	switch(param->pvn.u.isname.name.n) {
 		case 0:
 			return pv_get_uintval(msg, param, res, hep_version(msg));
-		case 1:
-			return pv_get_uintval(msg, param, res, hep_version(msg));
-		case 2:
-			sc_buf_ip_len = ip_addr2sbuf(
-					&msg->rcv.src_ip, sc_buf_ip, sizeof(sc_buf_ip) - 1);
-			sc_buf_ip[sc_buf_ip_len] = 0;
-			return pv_get_strlval(msg, param, res, sc_buf_ip, sc_buf_ip_len);
-		case 3:
-			sc_buf_ip_len = ip_addr2sbuf(
-					&msg->rcv.dst_ip, sc_buf_ip, sizeof(sc_buf_ip) - 1);
-			sc_buf_ip[sc_buf_ip_len] = 0;
-			return pv_get_strlval(msg, param, res, sc_buf_ip, sc_buf_ip_len);
 		default:
 			return hepv3_get_chunk(msg, msg->buf, msg->len,
 					param->pvn.u.isname.name.n, param, res);




More information about the sr-dev mailing list