Re: [sr-dev] [kamailio/kamailio] Makefile.defs: clang as default and lib for 64 bit on FreeBSD (#845)

2016-11-03 Thread Daniel-Constantin Mierla
Is this for all FreeBSD versions or only from a specific version on? Many 
server are running old versions of distros.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/845#issuecomment-258079890___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:76e2a0dd: rtpengine: init all struct to get rid of compile warnings

2016-11-03 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 76e2a0dd05aa1a6fb3148c231d57cd2278ced9d2
URL: 
https://github.com/kamailio/kamailio/commit/76e2a0dd05aa1a6fb3148c231d57cd2278ced9d2

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2016-11-03T08:47:01+01:00

rtpengine: init all struct to get rid of compile warnings

---

Modified: modules/rtpengine/rtpengine.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/76e2a0dd05aa1a6fb3148c231d57cd2278ced9d2.diff
Patch: 
https://github.com/kamailio/kamailio/commit/76e2a0dd05aa1a6fb3148c231d57cd2278ced9d2.patch

---

diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c
index a3787eb..6b46074 100644
--- a/modules/rtpengine/rtpengine.c
+++ b/modules/rtpengine/rtpengine.c
@@ -593,8 +593,7 @@ static inline int str_eq(const str *p, const char *q) {
 }
 
 static inline str str_prefix(const str *p, const char *q) {
-   str ret;
-   ret.s = NULL;
+   str ret = STR_NULL;
int l = strlen(q);
if (p->len < l)
return ret;


___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:66bb1a55: mi_fifo: close fifo stream in case of errors

2016-11-03 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 66bb1a55f4e1b6e8dbfd8fbc3c6625e356daa734
URL: 
https://github.com/kamailio/kamailio/commit/66bb1a55f4e1b6e8dbfd8fbc3c6625e356daa734

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2016-11-02T23:23:20+01:00

mi_fifo: close fifo stream in case of errors

---

Modified: modules/mi_fifo/fifo_fnc.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/66bb1a55f4e1b6e8dbfd8fbc3c6625e356daa734.diff
Patch: 
https://github.com/kamailio/kamailio/commit/66bb1a55f4e1b6e8dbfd8fbc3c6625e356daa734.patch

---

diff --git a/modules/mi_fifo/fifo_fnc.c b/modules/mi_fifo/fifo_fnc.c
index aa0df20..1d33bf2 100644
--- a/modules/mi_fifo/fifo_fnc.c
+++ b/modules/mi_fifo/fifo_fnc.c
@@ -108,15 +108,18 @@ FILE *mi_init_fifo_server(char *fifo_name, int 
mi_fifo_mode,
mi_fifo_write=open( fifo_name, O_WRONLY|O_NONBLOCK, 0);
if (mi_fifo_write<0) {
LM_ERR("fifo_write did not open: %s\n", strerror(errno));
+   fclose(fifo_stream);
return 0;
}
/* set read fifo blocking mode */
if ((opt=fcntl(mi_fifo_read, F_GETFL))==-1){
LM_ERR("fcntl(F_GETFL) failed: %s [%d]\n", strerror(errno), 
errno);
+   fclose(fifo_stream);
return 0;
}
if (fcntl(mi_fifo_read, F_SETFL, opt & (~O_NONBLOCK))==-1){
LM_ERR("cntl(F_SETFL) failed: %s [%d]\n", strerror(errno), 
errno);
+   fclose(fifo_stream);
return 0;
}
 
@@ -125,6 +128,7 @@ FILE *mi_init_fifo_server(char *fifo_name, int mi_fifo_mode,
reply_fifo_s = pkg_malloc(MAX_MI_FILENAME);
if ( mi_buf==NULL|| reply_fifo_s==NULL) {
LM_ERR("no more private memory\n");
+   fclose(fifo_stream);
return 0;
}
 
@@ -146,7 +150,7 @@ static int mi_fifo_check(int fd, char* fname)
 {
struct stat fst;
struct stat lst;
-   
+
if (fstat(fd, )<0){
LM_ERR("security: fstat on %s failed: %s\n", fname, 
strerror(errno));
return -1;
@@ -200,7 +204,7 @@ static FILE *mi_open_reply_pipe( char *pipe_name )
}
 
 tryagain:
-   /* open non-blocking to make sure that a broken client will not 
+   /* open non-blocking to make sure that a broken client will not
 * block the FIFO server forever */
fifofd=open( pipe_name, O_WRONLY | O_NONBLOCK );
if (fifofd==-1) {
@@ -225,7 +229,7 @@ static FILE *mi_open_reply_pipe( char *pipe_name )
return 0;
}
 
-   /* security checks: is this really a fifo?, is 
+   /* security checks: is this really a fifo?, is
 * it hardlinked? is it a soft link? */
if (mi_fifo_check(fifofd, pipe_name)<0)
goto error;
@@ -280,7 +284,7 @@ int mi_read_line( char *b, int max, FILE *stream, int *read)
kill(0, SIGTERM);
}
/* if we did not read whole line, our buffer is too small
-  and we cannot process the request; consume the remainder of 
+  and we cannot process the request; consume the remainder of
   request
*/
 


___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:f609a83e: mi_rpc: init structures to avoid access to invalid content in case of errors

2016-11-03 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: f609a83e58eccae409a5966a002edba389bbc372
URL: 
https://github.com/kamailio/kamailio/commit/f609a83e58eccae409a5966a002edba389bbc372

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2016-11-02T23:37:43+01:00

mi_rpc: init structures to avoid access to invalid content in case of errors

---

Modified: modules/mi_rpc/mi_rpc_mod.c

---

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

---

diff --git a/modules/mi_rpc/mi_rpc_mod.c b/modules/mi_rpc/mi_rpc_mod.c
index 32d444f..718aab8 100644
--- a/modules/mi_rpc/mi_rpc_mod.c
+++ b/modules/mi_rpc/mi_rpc_mod.c
@@ -496,25 +496,28 @@ static struct mi_root* mi_run_rpc(struct mi_root* 
cmd_tree, void* param)
struct binrpc_handle rpc_handle;
struct binrpc_response_handle resp_handle;
int i;
-   
+
str *fn;
struct mi_node *node;
char *command = NULL;
int param_count = 0;
char **parameters = NULL;
struct mi_root* result;
-   
+
int resp_type;
int resp_code;
char *resp;
 
-   /* response will be malloced by binrpc_response_to_text. 
+   /* response will be malloced by binrpc_response_to_text.
   We do not free it. It must remain after this call.
   It will be reused by subsequent calls */
static unsigned char *response = NULL;
static int resp_len = 0;
-   
-   if (binrpc_open_connection_url(_handle, rpc_url) != 0) 
+
+   memset(_handle, 0, sizeof(struct binrpc_handle));
+   memset(_handle, 0, sizeof(struct binrpc_response_handle));
+
+   if (binrpc_open_connection_url(_handle, rpc_url) != 0)
{
LM_ERR( "Open connect to %s failed\n", rpc_url);
result = init_mi_tree( 500, (char *)CONNECT_FAILED, 
strlen(CONNECT_FAILED) );
@@ -527,12 +530,12 @@ static struct mi_root* mi_run_rpc(struct mi_root* 
cmd_tree, void* param)
return( init_mi_tree( 400, MI_MISSING_PARM_S, 
MI_MISSING_PARM_LEN ));
 
fn = >value;
-   
+
/* find_rpc_exports needs 0 terminated strings */
command = pkg_malloc(fn->len+1);
 memcpy(command, fn->s, fn->len);
command[fn->len] = '\0';
-   
+
/* Count the parameters. */
node = node->next;
while (node) {
@@ -564,9 +567,9 @@ static struct mi_root* mi_run_rpc(struct mi_root* cmd_tree, 
void* param)
result = init_mi_tree( 500, (char *)FAILED, strlen(FAILED) );
goto end;
}
-   
+
resp_type = binrpc_get_response_type(_handle);
-   
+
/* If we already have a buffer make it NULL terminated to discard any 
previous content */
if (resp_len > 0)
response[0]='\0';
@@ -582,12 +585,12 @@ static struct mi_root* mi_run_rpc(struct mi_root* 
cmd_tree, void* param)
/* Some functions don't give a text answer; use 
a default */
result = init_mi_tree( 200, MI_OK_S, MI_OK_LEN 
);
break;
-   
+
case 1:
/* Valid failure */
binrpc_parse_error_response(_handle, _code, 
);
if (resp_len < strlen(resp) + 1)
-   { 
+   {
if (resp_len==0)
response = malloc(strlen(resp) + 1);
else
@@ -601,7 +604,7 @@ static struct mi_root* mi_run_rpc(struct mi_root* cmd_tree, 
void* param)
/* Some functions don't give a text answer; use 
a default */
result = init_mi_tree( resp_code, (char 
*)FAILED, strlen(FAILED) );
break;
-   
+
default:
result = init_mi_tree( 500, (char *)FAILED, 
strlen(FAILED) );
goto end;
@@ -610,7 +613,7 @@ static struct mi_root* mi_run_rpc(struct mi_root* cmd_tree, 
void* param)
 end:
if (param_count > 0)
{
-   for (i=0; i

[sr-dev] git:master:0cc0b643: lib/binrpc: memset addr variable to avoind uninitialized fields

2016-11-03 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 0cc0b643ee6442a13f257e3d72b826f257501204
URL: 
https://github.com/kamailio/kamailio/commit/0cc0b643ee6442a13f257e3d72b826f257501204

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2016-11-03T08:50:13+01:00

lib/binrpc: memset addr variable to avoind uninitialized fields

---

Modified: lib/binrpc/binrpc_api.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/0cc0b643ee6442a13f257e3d72b826f257501204.diff
Patch: 
https://github.com/kamailio/kamailio/commit/0cc0b643ee6442a13f257e3d72b826f257501204.patch

---

diff --git a/lib/binrpc/binrpc_api.c b/lib/binrpc/binrpc_api.c
index 9145758..30cc003 100644
--- a/lib/binrpc/binrpc_api.c
+++ b/lib/binrpc/binrpc_api.c
@@ -13,11 +13,11 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
  */
- 
+
 /**
  * send commands using binrpc
  *
@@ -67,7 +67,7 @@ static void (*internal_free)(void* ptr) = free;
 static char binrpc_last_errs[1024] = "";
 static int verbose = 0;
 
-char *binrpc_get_last_errs() 
+char *binrpc_get_last_errs()
 {
 return binrpc_last_errs;
 }
@@ -213,28 +213,29 @@ static int connect_tcpudp_socket(char* address, int port, 
int type)
struct sockaddr_in addr;
struct hostent* he;
int sock;
-   
+
sock=-1;
/* resolve destination */
he=gethostbyname(address);
if (he==0){
-   snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1, 
+   snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1,
"connect_tcpudp_socket: could not resolve %s", 
address);
goto error;
}
/* open socket*/
+   memset(, 0, sizeof(struct sockaddr_in));
addr.sin_family=he->h_addrtype;
addr.sin_port=htons(port);
memcpy(_addr.s_addr, he->h_addr_list[0], he->h_length);
-   
+
sock = socket(he->h_addrtype, type, 0);
if (sock==-1){
-   snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1, 
+   snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1,
"connect_tcpudp_socket: socket: %s", strerror(errno));
goto error;
}
if (connect(sock, (struct sockaddr*) , sizeof(struct 
sockaddr))!=0){
-   snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1, 
+   snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1,
"connect_tcpudp_socket: connect: %s", 
strerror(errno));
goto error;
}
@@ -246,7 +247,7 @@ static int connect_tcpudp_socket(char* address, int port, 
int type)
 
 /* on exit cleanup */
 static void cleanup(struct sockaddr_un* mysun)
-{  
+{
if (mysun->sun_path[0] != '\0') {
if (unlink(mysun->sun_path) < 0) {
fprintf(stderr, "ERROR: failed to delete %s: %s\n",
@@ -259,7 +260,7 @@ int binrpc_open_connection(struct binrpc_handle* handle, 
char* name, int port, i
char* reply_socket, char* sock_dir)
 {
struct sockaddr_un mysun;
-   
+
binrpc_last_errs[0] = '\0';
binrpc_last_errs[sizeof(binrpc_last_errs)-1] = '\0';  /* snprintf safe 
terminator */
 


___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:aeb9b5af: ctl: proper trim for long error messages to avoid out of bounds access

2016-11-03 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: aeb9b5af7099ef3f8d3df02dcde1617fe22e4e46
URL: 
https://github.com/kamailio/kamailio/commit/aeb9b5af7099ef3f8d3df02dcde1617fe22e4e46

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2016-11-02T23:18:00+01:00

ctl: proper trim for long error messages to avoid out of bounds access

---

Modified: modules/ctl/binrpc_run.c

---

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

---

diff --git a/modules/ctl/binrpc_run.c b/modules/ctl/binrpc_run.c
index 5bdd869..e0d480f 100644
--- a/modules/ctl/binrpc_run.c
+++ b/modules/ctl/binrpc_run.c
@@ -503,7 +503,7 @@ static int rpc_fault_prepare(struct binrpc_ctx* ctx, int 
code, char* fmt, ...)
}
va_start(ap, fmt);
len=vsnprintf(buf, MAX_FAULT_LEN, fmt, ap); /* ignore trunc. errors */
-   if ((len<0) || (len > MAX_FAULT_LEN))
+   if ((len<0) || (len >= MAX_FAULT_LEN))
len=MAX_FAULT_LEN-1;
va_end(ap);
 


___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] Makefile.defs: clang as default and lib for 64 bit on FreeBSD (#845)

2016-11-03 Thread Rick
You are right. I forgot that `clang` is the default only since FreeBSD 10.
For the lib dir I am not sure how long this is done. I will do some research.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/845#issuecomment-258087555___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] fix TLS client config selection based on dst ip and port (#842)

2016-11-03 Thread sergey-vb
It is interesting but not easy solution.

Because tls_lookup_cfg accepting only one ip and port...

Another solution can be in [MANAGE_BRANCH] route add next check condition:

```
if ($rP == "TLS") {
 $xavp(tls=>server_name) = $rd + ":" + $rp;
 $xavp(tls=>server_id) = $rd + ":" + $rp;
}
```

and in tls.cfg:

```
[client:10.1.23.19:5061]
verify_certificate = yes
ca_list = /etc/kamailio/CAs/ca1.pem
private_key = /etc/kamailio/CAs/client1.key
server_name = 10.1.23.19:5061
server_id = 10.1.23.19:5061
```
It works too.

After location check i have ruri like 9098@10.1.23.19:5061;transport=TLS

May bee this is the simplest solution...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/842#issuecomment-258091140___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio seg (#846)

2016-11-03 Thread Rick
When doing a dispatcher reload with kamcmd kamailio crashes.

```
# kamailio -v
version: kamailio 5.0.0-dev6 (x86_64/freebsd) 276ccc
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, 
DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, 
F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, 
USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, 
MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, select, kqueue.
id: 276ccc 
compiled on 17:39:46 Sep 29 2016 with clang 3.4
```

```
#0  0x0008098d32c3 in ds_avl_destroy (node_ptr=0x809ed2b40) at 
dispatch.c:3046
3046if(dest->uri.s!=NULL)
[New Thread 80286b400 (LWP 100148/)]
(gdb) bt
#0  0x0008098d32c3 in ds_avl_destroy (node_ptr=0x809ed2b40) at 
dispatch.c:3046
#1  0x0008098d95cb in ds_destroy_list () at dispatch.c:1000
#2  0x000809911ead in destroy () at dispatcher.c:593
#3  0x00508345 in destroy_modules () at sr_module.c:811
#4  0x00517ff7 in cleanup (show_status=1) at main.c:526
#5  0x0052011c in shutdown_children (sig=15, show_status=1) at 
main.c:668
#6  0x0051f094 in handle_sigs () at main.c:760
#7  0x00530859 in main_loop () at main.c:1748
#8  0x0053b530 in main (argc=15, argv=0x7fffeb38) at main.c:2632
Current language:  auto; currently minimal
```

```
Nov  3 10:10:17  kamailio[43234]: INFO:  [main.c:811]: 
sig_usr(): signal 15 received
Nov  3 10:10:17  kamailio[43233]: INFO:  [main.c:811]: 
sig_usr(): signal 15 received
Nov  3 10:10:17  kamailio[43232]: INFO:  [main.c:811]: 
sig_usr(): signal 15 received
Nov  3 10:10:17  kamailio[43231]: INFO:  [main.c:811]: 
sig_usr(): signal 15 received
Nov  3 10:10:17  kamailio[43230]: INFO:  [main.c:811]: 
sig_usr(): signal 15 received
Nov  3 10:10:17  kamailio[43228]: INFO:  [main.c:811]: 
sig_usr(): signal 15 received
Nov  3 10:10:17  kamailio[43227]: INFO:  [main.c:811]: 
sig_usr(): signal 15 received
Nov  3 10:10:17  kamailio[43226]: INFO:  [main.c:811]: 
sig_usr(): signal 15 received
Nov  3 10:10:17  kamailio[43225]: INFO:  [main.c:811]: 
sig_usr(): signal 15 received
Nov  3 10:10:17  kamailio[43224]: INFO:  [main.c:811]: 
sig_usr(): signal 15 received
Nov  3 10:10:17  kamailio[43229]: INFO:  [main.c:811]: 
sig_usr(): signal 15 received
Nov  3 10:10:17  kamailio[43223]: ALERT:  [main.c:738]: 
handle_sigs(): child process 43233 exited normally, status=0
Nov  3 10:10:17  kamailio[43223]: ALERT:  [main.c:738]: 
handle_sigs(): child process 43234 exited normally, status=0
Nov  3 10:10:17  kamailio[43223]: ALERT:  [main.c:738]: 
handle_sigs(): child process 43232 exited normally, status=0
Nov  3 10:10:17  kamailio[43223]: ALERT:  [main.c:738]: 
handle_sigs(): child process 43231 exited normally, status=0
Nov  3 10:10:17  kamailio[43223]: ALERT:  [main.c:738]: 
handle_sigs(): child process 43230 exited normally, status=0
Nov  3 10:10:17  kamailio[43223]: ALERT:  [main.c:738]: 
handle_sigs(): child process 43229 exited normally, status=0
Nov  3 10:10:17  kamailio[43223]: ALERT:  [main.c:738]: 
handle_sigs(): child process 43228 exited normally, status=0
Nov  3 10:10:17  kamailio[43223]: ALERT:  [main.c:738]: 
handle_sigs(): child process 43227 exited normally, status=0
Nov  3 10:10:17  kamailio[43223]: ALERT:  [main.c:738]: 
handle_sigs(): child process 43226 exited normally, status=0
Nov  3 10:10:17  kamailio[43223]: ALERT:  [main.c:738]: 
handle_sigs(): child process 43225 exited normally, status=0
Nov  3 10:10:17  kamailio[43223]: ALERT:  [main.c:738]: 
handle_sigs(): child process 43224 exited normally, status=0
Nov  3 10:10:17  kamailio[43223]: INFO:  [main.c:756]: 
handle_sigs(): terminating due to SIGCHLD
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio seg (#846)

2016-11-03 Thread Rick
This happens every time I do reload.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258093753___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread ng-voice GmbH
Hi Rick,

there should be a second core-dump for the crash? The BT shows the shutdown, 
not where the actual crash happened.
As I cannot reproduce the issue (works on my systems with the same version 
you're running), can you shed a bit more light about your configuration and 
your data?

Thanks,
Carsten


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258096181___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Rick
Sorry there is no other core-dump created. Sorry I forgot to tell about the 
system, it is kamailio build from git-source on a FreeBSD 10.3-RELEASE-p7 
machine.

I attached gdb to the ctl process and got the following:
```
(gdb) s
Single stepping until exit from function _kevent, 
which has no line number information.
0x000800fa4664 in __sysctl () from /lib/libc.so.7
(gdb) s
Single stepping until exit from function __sysctl, 
which has no line number information.

Program received signal SIGSEGV, Segmentation fault.
0x0008098ce9c8 in add_dest2list (id=2, uri=
  {s = 0x80299d05a "sip:192.168.1.1", len = 16}, flags=0, priority=0, 
attrs=0x7fff4ed0, list_idx=0, setn=0x7fff4f04) at dispatch.c:434
434 if(dp0->priority > dp->priority)
Current language:  auto; currently minimal
```

The dispatcher information is from database.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258099262___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] fix TLS client config selection based on dst ip and port (#842)

2016-11-03 Thread Daniel-Constantin Mierla
Closed #842.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/842#event-846118189___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] fix TLS client config selection based on dst ip and port (#842)

2016-11-03 Thread Daniel-Constantin Mierla
The prototype of tls_lookup_cfg() can be changed if needed, that's not a 
problem.

The solution with xavp is ok and available now, the one with new match 
attribute may be an alternative the config simpler.

Anyhow, I am closing this one, given there is a solution. If anyone considers 
to implement the match config option, then a new pr should be opened.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/842#issuecomment-258099664___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Daniel-Constantin Mierla
Output of 'bt full' is more useful. Also get: 'frame 0' + 'info locals'.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258101599___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Rick
Ok this is what I did, hope that is correct.

```
gdb /usr/local/sbin/kamailio /var/run/kamailio/kamailio.core
```

```
(gdb) bt full
#0  0x0008098d32c3 in ds_avl_destroy (node_ptr=0x809ed2b40) at 
dispatch.c:3046
node = (ds_set_t *) 0x809ee72d8
i = 2
dest = (ds_dest_t *) 0x1
#1  0x0008098d95cb in ds_destroy_list () at dispatch.c:1000
No locals.
#2  0x000809911ead in destroy () at dispatcher.c:593
No locals.
#3  0x00508345 in destroy_modules () at sr_module.c:811
t = (struct sr_module *) 0x80186fa50
foo = (struct sr_module *) 0x80186f5a0
#4  0x00517ff7 in cleanup (show_status=1) at main.c:526
memlog = 0
#5  0x0052011c in shutdown_children (sig=15, show_status=1) at 
main.c:668
No locals.
#6  0x0051f094 in handle_sigs () at main.c:760
chld = 0
chld_status = 0
memlog = 32767
#7  0x00530859 in main_loop () at main.c:1748
i = 8
pid = 43479
si = (struct socket_info *) 0x0
si_desc = "udp receiver child=7 
sock=5.159.56.124:5060\000\b\000\000\000\001", '\0' , 
"\020\177\000\000\230\177\000\000\030\177\000\000\017\000\000\000\000\000\000\000P\177\000\000��x\000\000\000\000\000U�\232\000\000\000\000\000\000\000\000\000\004\000\000"
nrprocs = 8
woneinit = 1
#8  0x0053b530 in main (argc=15, argv=0x7fffeb18) at main.c:2632
cfg_stream = (FILE *) 0x801206170
c = -1
r = 0
tmp = 0x7fffede9 ""
tmp_len = 32767
port = -5224
proto = 32767
options = 0x99b412 
":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:"
ret = -1
seed = 1396112342
rfd = 4
debug_save = 0
debug_flag = 0
dont_fork_cnt = 0
n_lst = (struct name_lst *) 0xf
p = 0x7fffeb18 "�\177"
st = {st_dev = 90, st_ino = 402609, st_mode = 16832, st_nlink = 2, 
st_uid = 986, st_gid = 986, st_rdev = 826095, st_atim = {tv_sec = 1462371141, 
tv_nsec = 922319000}, st_mtim = {
tv_sec = 1478165947, tv_nsec = 81501000}, st_ctim = {tv_sec = 1478165947, 
tv_nsec = 81501000}, st_size = 512, st_blocks = 8, st_blksize = 32768, st_flags 
= 0, st_gen = 0, st_lspare = 0, 
  st_birthtim = {tv_sec = 1462371141, tv_nsec = 922274000}}
Current language:  auto; currently minimal
```

```
(gdb) frame 0
#0  0x0008098d32c3 in ds_avl_destroy (node_ptr=0x809ed2b40) at 
dispatch.c:3046
3046if(dest->uri.s!=NULL)
```

```
(gdb) info locals
node = (ds_set_t *) 0x809ee72d8
i = 2
dest = (ds_dest_t *) 0x1
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258103621___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:e415c3a0: dialog: safety check of return pointer to dmq vars field

2016-11-03 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: e415c3a0493b15c19b8a7984ddaff0bfd170a5ed
URL: 
https://github.com/kamailio/kamailio/commit/e415c3a0493b15c19b8a7984ddaff0bfd170a5ed

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2016-11-03T11:17:38+01:00

dialog: safety check of return pointer to dmq vars field

---

Modified: modules/dialog/dlg_dmq.c

---

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

---

diff --git a/modules/dialog/dlg_dmq.c b/modules/dialog/dlg_dmq.c
index 0d47056..668bdbd 100644
--- a/modules/dialog/dlg_dmq.c
+++ b/modules/dialog/dlg_dmq.c
@@ -112,6 +112,7 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* 
resp, dmq_node_t* no
from_uri = {0,0}, to_uri = {0,0}, req_uri = {0,0};
unsigned int init_ts = 0, start_ts = 0, lifetime = 0;
unsigned int state = 1;
+   srjson_t *vj;
 
/* received dmq message */
LM_DBG("dmq message received\n");
@@ -256,13 +257,14 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, 
peer_reponse_t* resp, dmq_node_t* no
dlg->init_ts = init_ts;
dlg->start_ts = start_ts;
 
-   srjson_t *vj;
vj = srjson_GetObjectItem(, jdoc.root, "vars");
-   for(it=vj->child; it; it = it->next)
-   {
-   k.s = it->string;k.len = strlen(k.s);
-   v.s = it->valuestring;   v.len = strlen(v.s);
-   set_dlg_variable(dlg, , );
+   if(vj!=NULL) {
+   for(it=vj->child; it; it = it->next)
+   {
+   k.s = it->string;k.len = 
strlen(k.s);
+   v.s = it->valuestring;   v.len = 
strlen(v.s);
+   set_dlg_variable(dlg, , );
+   }
}
/* add profiles */
if(profiles.s!=NULL) {


___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Daniel-Constantin Mierla
It is needed from the ctl process core file, not from the shutdown core file. 
You have to enable core file per pid, otherwise it may get overwritten.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258116841___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Rick
Ok now I got two core files this one is the second one:

```
(gdb) bt full
#0  0x0008098ce9c8 in add_dest2list (id=2, uri={s = 0x80299c05a 
"sip:5.159.56.120", len = 16}, flags=0, priority=0, attrs=0x7fff4ed0, 
list_idx=1, setn=0x7fff4f04) at dispatch.c:434
dp = (ds_dest_t *) 0x809ee7810
sp = (ds_set_t *) 0x809ed33d8
dp0 = (ds_dest_t *) 0xc0c0c0c0
dp1 = (ds_dest_t *) 0x0
#1  0x0008098d7854 in ds_load_db () at dispatch.c:959
i = 0
id = 2
nr_rows = 5
setn = 1
flags = 0
priority = 0
nrcols = 5
dest_errs = 0
uri = {s = 0x80299c05a "sip:5.159.56.120", len = 16}
attrs = {s = 0x80299c06f "", len = 0}
res = (db1_res_t *) 0x801a214b8
values = (db_val_t *) 0x801a1e4b8
rows = (db_row_t *) 0x801a1e400
query_cols = {0x809b279f8, 0x809b27a08, 0x809b27a18, 0x809b27a28, 
0x809b27a38}
#2  0x0008098d904c in ds_reload_db () at dispatch.c:870
ret = 43520061
#3  0x000809912a20 in dispatcher_rpc_reload (rpc=0x804c01c48, 
ctx=0x7fff53e0) at dispatcher.c:1177
No locals.
#4  0x0008049bc475 in process_rpc_req (buf=0x802981034 
"�\003\024\016F.�\221\022dispatcher.reload", size=27, 
bytes_needed=0x7fff5948, sh=0x7fff58c0, saved_state=0x802991038) at 
binrpc_run.c:675
err = 0
val = {name = {s = 0x802982000 "", len = -43824}, type = 1, u = {strval 
= {s = 0x80298103d "dispatcher.reload", len = 17}, fval = 
1.6997468094767194e-313, intval = 43520061, end = 43520061}}
rpc_e = (rpc_export_t *) 0x801ab6578
f_ctx = {in = {ctx = {tlen = 20, cookie = 239480522, type = 0, flags = 
1, offset = 20, in_struct = 0, in_array = 0}, s = 0x80298104f "", end = 
0x80298104f "", record_no = 0, in_struct = 0}, out = {
pkt = {body = 0x802992000 "", end = 0x80299a000 "", crt = 0x802992000 ""}, 
structs = {next = 0x7fff5430, prev = 0x7fff5430}}, send_h = 
0x7fff58c0, method = 0x80298103d "dispatcher.reload", 
  gc = 0x0, replied = 0, err_code = 0, err_phrase = {s = 0x0, len = 0}}
ctx = (struct binrpc_parse_ctx *) 0x7fff53e0
#5  0x0008049d7a99 in handle_stream_read (s_c=0x802981000, idx=-1) at 
io_listener.c:511
bytes_free = 65535
bytes_read = 27
bytes_needed = 0
bytes_processed = 27
r = (struct stream_req *) 0x802981020
sh = {fd = 11, type = 0, from = {sa_in = {s = {sa_len = 186 '�', 
sa_family = 61 '=', sa_data = 
"k\000\000\000\000\000\000\020\230\002\b\000\000"}, sin = {sin_len = 186 '�', 
sin_family = 61 '=', 
sin_port = 107, sin_addr = {s_addr = 0}, sin_zero = 
"\000\020\230\002\b\000\000"}, sin6 = {sin6_len = 186 '�', sin6_family = 61 
'=', sin6_port = 107, sin6_flowinfo = 0, sin6_addr = {__u6_addr = {
__u6_addr8 = 
"\000\020\230\002\b\000\000\000\v\000\000\000\020\000\000", __u6_addr16 = 
{4096, 664, 8, 0, 11, 0, 16, 0}, __u6_addr32 = {4352, 8, 11, 16}}}, 
sin6_scope_id = 272}}, sa_un = {
  sun_len = 186 '�', sun_family = 61 '=', 
  sun_path = 
"k\000\000\000\000\000\000\020\230\002\b\000\000\000\v\000\000\000\020\000\000\000\020\001",
 '\0' , 
"\033\000\000\000\000\000\000\000\220��\001\b\000\000\000\234>k\000\000\000\000\000
 
_\177\000\000\000\000\000\210(�\t\b\000\000\000@Y���\177\000\000\f�\235\004\b\000\000\000\000"}},
 from_len = 0}
#6  0x0008049d2b35 in handle_io (fm=0x801ac1c78, events=1, idx=-1) at 
io_listener.c:706
ret = 8
#7  0x0008049cf66c in io_wait_loop_kqueue (h=0x804c11d80, t=10, repeat=0) 
at io_wait.h:1182
n = 1
r = 0
tspec = {tv_sec = 10, tv_nsec = 0}
fm = (struct fd_map *) 0x801ac1c78
orig_changes = 0
apply_changes = 0
revents = 1
#8  0x0008049c83b2 in io_listen_loop (fd_no=1, cs_lst=0x80283d700) at 
io_listener.c:293
max_fd_no = 199
poll_err = 0x0
poll_method = 6
cs = (struct ctrl_socket *) 0x0
type = 2
#9  0x0008049a6f12 in mod_child (rank=0) at ctl.c:320
rpc_handler = 1
pid = 0
cs = (struct ctrl_socket *) 0x801a33ff8
#10 0x00508a93 in init_mod_child (m=0x8018587e8, rank=0) at 
sr_module.c:921
No locals.
#11 0x005084ba in init_mod_child (m=0x801858e48, rank=0) at 
sr_module.c:918
No locals.
#12 0x005084ba in init_mod_child (m=0x80185a758, rank=0) at 
sr_module.c:918
No locals.
#13 0x005084ba in init_mod_child (m=0x80185ade0, rank=0) at 
sr_module.c:918
No locals.
#14 0x005084ba in init_mod_child (m=0x80185b5b0, rank=0) at 
sr_module.c:918
No locals.
#15 0x005084ba in init_mod_child (m=0x80185bdb0, rank=0) at 
sr_module.c:918
No locals.
#16 0x005084ba in init_mod_child (m=0x80185c510, rank=0) at 
sr_module.c:918
No locals.
#17 0x005084ba in init_mod_child (m=0x80185e008, rank=0) at 
sr_module.c:918
No locals.
#18 0x005084ba in init_mod_child (m=0x80185ee20, rank=0) at 

[sr-dev] git:master:0369e5ab: dispatcher: coherent indentation

2016-11-03 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 0369e5ab3811a09cf1b1615950401967217bfce4
URL: 
https://github.com/kamailio/kamailio/commit/0369e5ab3811a09cf1b1615950401967217bfce4

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2016-11-03T14:14:23+01:00

dispatcher: coherent indentation

---

Modified: modules/dispatcher/dispatch.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/0369e5ab3811a09cf1b1615950401967217bfce4.diff
Patch: 
https://github.com/kamailio/kamailio/commit/0369e5ab3811a09cf1b1615950401967217bfce4.patch


___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:a471e472: auth_ephemeral: re-ordered code so access to sip msg is done after NULL check

2016-11-03 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: a471e4723206cdce7e9e319af344145b92444698
URL: 
https://github.com/kamailio/kamailio/commit/a471e4723206cdce7e9e319af344145b92444698

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2016-11-03T12:55:31+01:00

auth_ephemeral: re-ordered code so access to sip msg is done after NULL check

---

Modified: modules/auth_ephemeral/authorize.c

---

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

---

diff --git a/modules/auth_ephemeral/authorize.c 
b/modules/auth_ephemeral/authorize.c
index 5725d7f..cae32fb 100644
--- a/modules/auth_ephemeral/authorize.c
+++ b/modules/auth_ephemeral/authorize.c
@@ -334,17 +334,17 @@ int autheph_www2(struct sip_msg *_m, char *_realm, char 
*_method)
return AUTH_ERROR;
}
 
-   if (_m->REQ_METHOD == METHOD_ACK || _m->REQ_METHOD == METHOD_CANCEL)
-   {
-   return AUTH_OK;
-   }
-
if(_m == NULL || _realm == NULL)
{
LM_ERR("invalid parameters\n");
return AUTH_ERROR;
}
 
+   if (_m->REQ_METHOD == METHOD_ACK || _m->REQ_METHOD == METHOD_CANCEL)
+   {
+   return AUTH_OK;
+   }
+
if (get_str_fparam(, _m, (fparam_t*)_realm) < 0)
{
LM_ERR("failed to get realm value\n");


___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:98f9cace: dispatcher: replaced some fields init with memset to 0

2016-11-03 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 98f9cace74adc33f42a6a6aca4d0adc1bcc81248
URL: 
https://github.com/kamailio/kamailio/commit/98f9cace74adc33f42a6a6aca4d0adc1bcc81248

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2016-11-03T14:31:16+01:00

dispatcher: replaced some fields init with memset to 0

- safer when adding new fields in structures

---

Modified: modules/dispatcher/dispatch.c
Modified: modules/dispatcher/dispatch.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/98f9cace74adc33f42a6a6aca4d0adc1bcc81248.diff
Patch: 
https://github.com/kamailio/kamailio/commit/98f9cace74adc33f42a6a6aca4d0adc1bcc81248.patch

---

diff --git a/modules/dispatcher/dispatch.c b/modules/dispatcher/dispatch.c
index e86c9c4..53b597d 100644
--- a/modules/dispatcher/dispatch.c
+++ b/modules/dispatcher/dispatch.c
@@ -206,7 +206,7 @@ int init_data(void)
LM_ERR("Out of memory\n");
return -1;
}
-   ds_lists[0] = ds_lists[1] = 0;
+   memset(ds_lists, 0, 2*sizeof(ds_set_t*));
 
 
p = (int*)shm_malloc(3*sizeof(int));
@@ -215,6 +215,7 @@ int init_data(void)
LM_ERR("Out of memory\n");
return -1;
}
+   memset(p, 0, 3*sizeof(int));
 
crt_idx = p;
next_idx = p+1;
@@ -588,10 +589,12 @@ int dp_init_weights(ds_set_t *dset)
 /*! \brief  compact destinations from sets for fast access */
 int reindex_dests( ds_set_t* node )
 {
+   int i=0;
+   int j=0;
+
if ( !node )
return 0;
 
-   int i=0;
for( ;i<2;++i)
{
int rc = reindex_dests( node->next[i] );
@@ -599,8 +602,6 @@ int reindex_dests( ds_set_t* node )
return rc;
}
 
-   int j;
-
ds_dest_t *dp = NULL, *dp0= NULL;
 
dp0 = (ds_dest_t*)shm_malloc(node->nr*sizeof(ds_dest_t));
@@ -3029,18 +3030,18 @@ ds_set_t* ds_avl_find( ds_set_t* node, int id )
  */
 void ds_avl_destroy( ds_set_t** node_ptr )
 {
+   ds_set_t *node=NULL;
+   ds_dest_t *dest=NULL;
+   int i=0;
 
if ( !node_ptr || !(*node_ptr) )
return;
 
-   ds_set_t* node = *node_ptr;
+   node = *node_ptr;
 
-   int i=0;
for( ;i<2;++i)
ds_avl_destroy( >next[i] );
 
-   ds_dest_t *dest = NULL;
-
for(dest = node->dlist; dest!= NULL; dest=dest->next)
{
if(dest->uri.s!=NULL)
@@ -3062,8 +3063,12 @@ static void avl_rebalance( ds_set_t** path_top, int 
target );
 
 ds_set_t* ds_avl_insert( ds_set_t** root, int id, int* setn )
 {
-   ds_set_t** rotation_top = root;
-   ds_set_t* node = *root;
+   ds_set_t** rotation_top;
+   ds_set_t* node;
+
+   rotation_top = root;
+   node = *root;
+
while (node && id != node->id) {
int next_step = (id > node->id);
if (!AVL_BALANCED(node)) rotation_top = root;
@@ -3072,8 +3077,8 @@ ds_set_t* ds_avl_insert( ds_set_t** root, int id, int* 
setn )
}
if (!node)
{
-   node = shm_malloc(sizeof(*node));
-   node->next[0] = node->next[1] = NULL;
+   node = shm_malloc(sizeof(ds_set_t));
+   memset(node, 0, sizeof(ds_set_t));
node->id = id;
node->longer = AVL_NEITHER;
*root = node;
@@ -3102,6 +3107,7 @@ static void avl_rebalance_path( ds_set_t* path, int id )
 static ds_set_t* avl_rotate_2( ds_set_t** path_top, int dir )
 {
ds_set_t *B, *C, *D, *E;
+
B = *path_top;
D = B->next[dir];
C = D->next[1-dir];
@@ -3111,12 +3117,14 @@ static ds_set_t* avl_rotate_2( ds_set_t** path_top, int 
dir )
B->next[dir] = C;
B->longer = AVL_NEITHER;
D->longer = AVL_NEITHER;
+
return E;
 }
 
 static ds_set_t* avl_rotate_3( ds_set_t** path_top, int dir, int third )
 {
ds_set_t *B, *F, *D, *C, *E;
+
B = *path_top;
F = B->next[dir];
D = F->next[1-dir];
@@ -3149,8 +3157,11 @@ static ds_set_t* avl_rotate_3( ds_set_t** path_top, int 
dir, int third )
 
 static void avl_rebalance( ds_set_t** path_top, int id )
 {
-   ds_set_t* path = *path_top;
+   ds_set_t* path;
int first, second, third;
+
+   path = *path_top;
+
if (AVL_BALANCED(path)) {
avl_rebalance_path(path, id);
return;
diff --git a/modules/dispatcher/dispatch.h b/modules/dispatcher/dispatch.h
index cbe965a..dedc6b5 100644
--- a/modules/dispatcher/dispatch.h
+++ b/modules/dispatcher/dispatch.h
@@ -180,7 +180,7 @@ typedef struct _ds_set
unsigned int wlist[100];
unsigned int rwlist[100];
struct _ds_set *next[2];
-   int longer:2;
+   int longer;
 } ds_set_t;
 #define AVL_LEFT 0
 #define AVL_RIGHT 1


___
sr-dev mailing list
sr-dev@lists.sip-router.org

Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Daniel-Constantin Mierla
The dp0 pointer ends up in an invalid value:

```
dp0 = (ds_dest_t *) 0xc0c0c0c0
```

Likely a buffer overflow or a mis-shifting of pointer values.

Can you grab the latest master branch and try again? I pushed some memset inits 
in dispatcher, likely not to solve the issue, but it's better to work on the 
last code base to hunt the problem.

Also, run kamailio with '-x qm' -- it will use the memory manager that is more 
friendly for debugging such issues.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258144317___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Rick
While I was try to test I am getting this with latest master:

```
# kamailio -c
loading modules under config path: /usr/local/lib64/kamailio/modules/
 0(67414) ERROR:  [sr_module.c:582]: load_module(): could not open module 
: 
/usr/local/lib64/kamailio/modules/alias_db.so: Undefined symbol 
"set_alias_to_pvar"
 0(67414) :  [cfg.y:3407]: yyerror_at(): parse error in config file 
/usr/local/etc/kamailio/kamailio-modules.cfg, line 86, column 12-24: failed to 
load module
 0(67414) ERROR:  [modparam.c:152]: set_mod_param_regex(): No module 
matching  found
 0(67414) :  [cfg.y:3410]: yyerror_at(): parse error in config file 
/usr/local/etc/kamailio/kamailio-modules.cfg, line 224, column 128: Can't set 
module parameter
 0(67414) ERROR:  [modparam.c:152]: set_mod_param_regex(): No module 
matching  found
 0(67414) :  [cfg.y:3410]: yyerror_at(): parse error in config file 
/usr/local/etc/kamailio/kamailio-modules.cfg, line 225, column 37: Can't set 
module parameter
 0(67414) ERROR:  [cfg.y:3270]: yyparse(): cfg. parser: failed to find 
command alias_db_lookup (params 1)
 0(67414) :  [cfg.y:3410]: yyerror_at(): parse error in config file 
/usr/local/etc/kamailio/kamailio-routing.cfg, line 679, column 36: unknown 
command, missing loadmodule?

ERROR: bad config file (8 errors)
 0(67414) INFO:  [sctp_core.c:53]: sctp_core_destroy(): SCTP API not 
initialized
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258168891___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Rick
the `inline int set_alias_to_pvar(struct sip_msg* _msg, str *alias, int no, 
void *p)` doesn't work for me with clang, when changed to `static inline int 
set_alias_to_pvar(struct sip_msg* _msg, str *alias, int no, void *p)` it works

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258174242___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Rick
With latest right now I didn't get a crash.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258176437___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Daniel-Constantin Mierla
If you get other issues not related to dispatcher, open a different item here, 
otherwise is not easy to track what's wrong on a topic.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258180438___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:45e94dca: alias_db: remove inline to function provided as parameter to another one

2016-11-03 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 45e94dca8e1fc2b7bae6cece0d3ac19fbc5e430d
URL: 
https://github.com/kamailio/kamailio/commit/45e94dca8e1fc2b7bae6cece0d3ac19fbc5e430d

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2016-11-03T16:45:16+01:00

alias_db: remove inline to function provided as parameter to another one

---

Modified: modules/alias_db/alookup.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/45e94dca8e1fc2b7bae6cece0d3ac19fbc5e430d.diff
Patch: 
https://github.com/kamailio/kamailio/commit/45e94dca8e1fc2b7bae6cece0d3ac19fbc5e430d.patch

---

diff --git a/modules/alias_db/alookup.c b/modules/alias_db/alookup.c
index 42c966a..fcb4b27 100644
--- a/modules/alias_db/alookup.c
+++ b/modules/alias_db/alookup.c
@@ -246,7 +246,7 @@ int alias_db_lookup(struct sip_msg* _msg, str table)
return alias_db_lookup_ex(_msg, table, flags);
 }
 
-inline int set_alias_to_pvar(struct sip_msg* _msg, str *alias, int no, void *p)
+int set_alias_to_pvar(struct sip_msg* _msg, str *alias, int no, void *p)
 {
pv_value_t val;
pv_spec_t *pvs=(pv_spec_t*)p;


___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Daniel-Constantin Mierla
Closed #846.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#event-846591847___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] dispatcher: kamcmd dispatcher.reload kamailio SIGCHLD (#846)

2016-11-03 Thread Daniel-Constantin Mierla
I removed the inline from the alias_db function, pushed the change to the 
master.

Given that the dispatcher is not exposing the issue, I am closing this one. If 
something new appears, then maybe is better to open a new item in the bug 
tracker.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/846#issuecomment-258182610___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] Presence: Fix startup inconsistency in presentity hash table (#809)

2016-11-03 Thread Emmanuel Schmidbauer
this commit broke presence for us. we use NSQ + presence, after a phone reboots 
and we send a NOTIFY with confirmed state, presence module sends a NOTIFY with 
terminated state.
please revert this commit. see the log and SIP packet below:

```
Nov  3 09:23:52 /usr/local/sbin/kamailio[26288]: INFO: 

Re: [sr-dev] [kamailio/kamailio] Presence: Fix startup inconsistency in presentity hash table (#809)

2016-11-03 Thread Daniel-Constantin Mierla
@eschmidbauer - is it affecting the runtime behaviour, because it should have 
been targeting only the startup procedure?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/809#issuecomment-258239094___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] Presence: Fix startup inconsistency in presentity hash table (#809)

2016-11-03 Thread Emmanuel Schmidbauer
@miconda yes, we are seeing this issue during runtime. not on startup
we reverted the commit and problem went away

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/809#issuecomment-258239715___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] Presence: Fix startup inconsistency in presentity hash table (#809)

2016-11-03 Thread lazedo
the problem with this commit is for expired column = 0 which is usually set on 
"early" state

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/809#issuecomment-258247287___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] Presence: Fix startup inconsistency in presentity hash table (#809)

2016-11-03 Thread Emmanuel Schmidbauer
@lazedo 
you can see that we sending expires=1 in our NSQ message and in nsq_pua.c
```C
struct json_object *ExpiresObj =  nsq_json_get_object(json_obj, 
BLF_JSON_EXPIRES);
if (ExpiresObj != NULL) {
expires = json_object_get_int(ExpiresObj);
if (expires > 0)
expires += (int)time(NULL);
}
```
you can see expires will be set to time + 1

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/809#issuecomment-258260016___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] Presence: Fix startup inconsistency in presentity hash table (#809)

2016-11-03 Thread lazedo
@eschmidbauer yep, but that's wrong by definition, we had the same problem. try 
sending `expires = 3600` , it will work. i'm ok with this commit, it could be 
improved if we were able to ignore the `0` which we interpret as `do not expire`
 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/809#issuecomment-258264871___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] Presence: Fix startup inconsistency in presentity hash table (#809)

2016-11-03 Thread Emmanuel Schmidbauer
it's not entirely clear to me what this PR fixes. What about adding a module 
parameter (default = enabled) to enable this code?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/809#issuecomment-258276622___
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev