Browse Source

core Make sure Kamailio doesn't crash if TCP is disabled and RPC core.tcp_list RPC command is issued

Olle E. Johansson 12 years ago
parent
commit
7bc2efb300
1 changed files with 5 additions and 0 deletions
  1. 5 0
      core_cmd.c

+ 5 - 0
core_cmd.c

@@ -765,6 +765,11 @@ static void core_tcp_list(rpc_t* rpc, void* c)
 	struct tcp_connection* con;
 	int i, len, timeout;
 
+	if (tcp_disable) {
+		rpc->fault(c, 500, "tcp support disabled");
+		return;
+	}
+
 	TCPCONN_LOCK;
 	for(i = 0; i < TCP_ID_HASH_SIZE; i++) {
 		for (con = tcpconn_id_hash[i]; con; con = con->id_next) {