kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
October 2023
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
15 participants
286 discussions
Start a n
N
ew thread
git:master:213e1910: core: added tcp_msg_data_timeout parameter
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 213e19108699ed4ea5c962caf673b0a60ce41480 URL:
https://github.com/kamailio/kamailio/commit/213e19108699ed4ea5c962caf673b0a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-10-16T08:57:32+02:00 core: added tcp_msg_data_timeout parameter - duration in seconds for how long to wait till data is received on a new tcp connection - default 20 --- Modified: src/core/cfg.lex Modified: src/core/cfg.y Modified: src/core/globals.h Modified: src/core/tcp_init.h Modified: src/core/tcp_main.c Modified: src/main.c --- Diff:
https://github.com/kamailio/kamailio/commit/213e19108699ed4ea5c962caf673b0a…
Patch:
https://github.com/kamailio/kamailio/commit/213e19108699ed4ea5c962caf673b0a…
--- diff --git a/src/core/cfg.lex b/src/core/cfg.lex index 44c62279b7d..872e4084c17 100644 --- a/src/core/cfg.lex +++ b/src/core/cfg.lex @@ -367,6 +367,7 @@ MAXSNDBUFFER maxsndbuffer SQL_BUFFER_SIZE sql_buffer_size MSG_RECV_MAX_SIZE msg_recv_max_size TCP_MSG_READ_TIMEOUT tcp_msg_read_timeout +TCP_MSG_DATA_TIMEOUT tcp_msg_data_timeout TCP_CHECK_TIMER tcp_check_timer CHILDREN children SOCKET socket @@ -855,6 +856,7 @@ IMPORTFILE "import_file" <INITIAL>{SQL_BUFFER_SIZE} { count(); yylval.strval=yytext; return SQL_BUFFER_SIZE; } <INITIAL>{MSG_RECV_MAX_SIZE} { count(); yylval.strval=yytext; return MSG_RECV_MAX_SIZE; } <INITIAL>{TCP_MSG_READ_TIMEOUT} { count(); yylval.strval=yytext; return TCP_MSG_READ_TIMEOUT; } +<INITIAL>{TCP_MSG_DATA_TIMEOUT} { count(); yylval.strval=yytext; return TCP_MSG_DATA_TIMEOUT; } <INITIAL>{TCP_CHECK_TIMER} { count(); yylval.strval=yytext; return TCP_CHECK_TIMER; } <INITIAL>{CHILDREN} { count(); yylval.strval=yytext; return CHILDREN; } <INITIAL>{SOCKET} { count(); yylval.strval=yytext; return SOCKET; } diff --git a/src/core/cfg.y b/src/core/cfg.y index a5e16e259e1..ed6764d09fb 100644 --- a/src/core/cfg.y +++ b/src/core/cfg.y @@ -423,6 +423,7 @@ extern char *default_routename; %token SQL_BUFFER_SIZE %token MSG_RECV_MAX_SIZE %token TCP_MSG_READ_TIMEOUT +%token TCP_MSG_DATA_TIMEOUT %token TCP_CHECK_TIMER %token USER %token GROUP @@ -1020,6 +1021,8 @@ assign_stm: | MSG_RECV_MAX_SIZE EQUAL error { yyerror("number expected"); } | TCP_MSG_READ_TIMEOUT EQUAL NUMBER { ksr_tcp_msg_read_timeout=$3; } | TCP_MSG_READ_TIMEOUT EQUAL error { yyerror("number expected"); } + | TCP_MSG_DATA_TIMEOUT EQUAL NUMBER { ksr_tcp_msg_data_timeout=$3; } + | TCP_MSG_DATA_TIMEOUT EQUAL error { yyerror("number expected"); } | TCP_CHECK_TIMER EQUAL NUMBER { ksr_tcp_check_timer=$3; } | TCP_CHECK_TIMER EQUAL error { yyerror("number expected"); } | CHILDREN EQUAL NUMBER { children_no=$3; } diff --git a/src/core/globals.h b/src/core/globals.h index aac82563d51..0d7227c9c1e 100644 --- a/src/core/globals.h +++ b/src/core/globals.h @@ -240,6 +240,7 @@ extern int ksr_rpc_exec_delta; extern int ksr_msg_recv_max_size; extern int ksr_tcp_msg_read_timeout; +extern int ksr_tcp_msg_data_timeout; extern int ksr_tcp_check_timer; #ifdef USE_DNS_CACHE diff --git a/src/core/tcp_init.h b/src/core/tcp_init.h index 49c4ef7f748..f1c3ae61b37 100644 --- a/src/core/tcp_init.h +++ b/src/core/tcp_init.h @@ -40,7 +40,6 @@ #define DEFAULT_TCP_WBUF_SIZE 2100 /* after debugging switch to 4-16k */ -#define KSR_TCP_MSGREAD_TIMEOUT 20 /* timeout (secs) to read SIP message */ #define KSR_TCP_ACCEPT_IPLIMIT 1024 /* limit accepted tcp connections from IP */ struct tcp_child diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c index bd8b162cd40..60f316d89b4 100644 --- a/src/core/tcp_main.c +++ b/src/core/tcp_main.c @@ -5518,7 +5518,7 @@ void tcp_timer_check_connections(unsigned int ticks, void *param) if((cidset == 0) && !(con->req.dxstate & KSR_TCP_REQSTATE_DATARECV)) { if(tvnow.tv_sec - con->timestamp - >= ksr_tcp_msg_read_timeout) { + >= ksr_tcp_msg_data_timeout) { LM_DBG("n: %d - connection id: %d (state: %d) - " "message " "receiving timeout: %ld\n", diff --git a/src/main.c b/src/main.c index a949d930407..3b678e14947 100644 --- a/src/main.c +++ b/src/main.c @@ -531,7 +531,8 @@ char *pid_file = 0; /* filename as asked by use */ char *pgid_file = 0; int ksr_msg_recv_max_size = 32767; /* 2^15 - 1 */ -int ksr_tcp_msg_read_timeout = KSR_TCP_MSGREAD_TIMEOUT; +int ksr_tcp_msg_read_timeout = 20; /* timeout (secs) to read SIP message */ +int ksr_tcp_msg_data_timeout = 20; /* timeout (secs) to receive first msg data */ int ksr_tcp_check_timer = 10; /* seconds to check tcp connections */ /* memory manager */
1 year, 2 months
1
0
0
0
git:master:92feec4f: core: added tcp_msg_read_timeout parameter
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 92feec4fa026a153d1f9ed79e5893bf1086db909 URL:
https://github.com/kamailio/kamailio/commit/92feec4fa026a153d1f9ed79e5893bf…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-10-16T07:20:13+02:00 core: added tcp_msg_read_timeout parameter - specify read timeout for tcp messages --- Modified: src/core/cfg.lex Modified: src/core/cfg.y Modified: src/core/globals.h Modified: src/core/tcp_conn.h Modified: src/core/tcp_init.h Modified: src/core/tcp_main.c Modified: src/core/tcp_read.c Modified: src/main.c --- Diff:
https://github.com/kamailio/kamailio/commit/92feec4fa026a153d1f9ed79e5893bf…
Patch:
https://github.com/kamailio/kamailio/commit/92feec4fa026a153d1f9ed79e5893bf…
1 year, 2 months
1
0
0
0
git:master:b56037fa: core: added msg_recv_max_size global parameter
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: b56037fab181037d48bfc90802f25b85ae8bee04 URL:
https://github.com/kamailio/kamailio/commit/b56037fab181037d48bfc90802f25b8…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-10-14T16:49:20+02:00 core: added msg_recv_max_size global parameter - set limit for max size of received tcp or upd messages --- Modified: src/core/cfg.lex Modified: src/core/cfg.y Modified: src/core/globals.h Modified: src/core/tcp_read.c Modified: src/core/udp_server.c Modified: src/main.c --- Diff:
https://github.com/kamailio/kamailio/commit/b56037fab181037d48bfc90802f25b8…
Patch:
https://github.com/kamailio/kamailio/commit/b56037fab181037d48bfc90802f25b8…
--- diff --git a/src/core/cfg.lex b/src/core/cfg.lex index 9e338606c20..e88c54527ba 100644 --- a/src/core/cfg.lex +++ b/src/core/cfg.lex @@ -365,6 +365,7 @@ STATS_NAMESEP stats_name_separator MAXBUFFER maxbuffer MAXSNDBUFFER maxsndbuffer SQL_BUFFER_SIZE sql_buffer_size +MSG_RECV_MAX_SIZE msg_recv_max_size CHILDREN children SOCKET socket BIND bind @@ -850,6 +851,7 @@ IMPORTFILE "import_file" <INITIAL>{MAXBUFFER} { count(); yylval.strval=yytext; return MAXBUFFER; } <INITIAL>{MAXSNDBUFFER} { count(); yylval.strval=yytext; return MAXSNDBUFFER; } <INITIAL>{SQL_BUFFER_SIZE} { count(); yylval.strval=yytext; return SQL_BUFFER_SIZE; } +<INITIAL>{MSG_RECV_MAX_SIZE} { count(); yylval.strval=yytext; return MSG_RECV_MAX_SIZE; } <INITIAL>{CHILDREN} { count(); yylval.strval=yytext; return CHILDREN; } <INITIAL>{SOCKET} { count(); yylval.strval=yytext; return SOCKET; } <INITIAL>{BIND} { count(); yylval.strval=yytext; return BIND; } diff --git a/src/core/cfg.y b/src/core/cfg.y index d833288c10d..5a82345a15b 100644 --- a/src/core/cfg.y +++ b/src/core/cfg.y @@ -421,6 +421,7 @@ extern char *default_routename; %token MAXBUFFER %token MAXSNDBUFFER %token SQL_BUFFER_SIZE +%token MSG_RECV_MAX_SIZE %token USER %token GROUP %token CHROOT @@ -1013,6 +1014,8 @@ assign_stm: | MAXSNDBUFFER EQUAL error { yyerror("number expected"); } | SQL_BUFFER_SIZE EQUAL NUMBER { sql_buffer_size=$3; } | SQL_BUFFER_SIZE EQUAL error { yyerror("number expected"); } + | MSG_RECV_MAX_SIZE EQUAL NUMBER { ksr_msg_recv_max_size=$3; } + | MSG_RECV_MAX_SIZE EQUAL error { yyerror("number expected"); } | CHILDREN EQUAL NUMBER { children_no=$3; } | CHILDREN EQUAL error { yyerror("number expected"); } | STATS_NAMESEP EQUAL STRING { ksr_stats_namesep=$3; } diff --git a/src/core/globals.h b/src/core/globals.h index b541d8e9cf8..3a488db23c2 100644 --- a/src/core/globals.h +++ b/src/core/globals.h @@ -238,6 +238,8 @@ extern int ksr_local_rport; extern int ksr_rpc_exec_delta; +extern int ksr_msg_recv_max_size; + #ifdef USE_DNS_CACHE extern int dns_cache_init; /* if 0, the DNS cache is not initialized at startup */ diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c index 31c6e92444c..10fd348696f 100644 --- a/src/core/tcp_read.c +++ b/src/core/tcp_read.c @@ -1486,7 +1486,6 @@ int tcp_read_req(struct tcp_connection *con, int *bytes_read, resp = CONN_RELEASE; req = &con->req; if(req->tvrstart.tv_sec == 0) { - LM_DBG("=== set message read start time\n"); gettimeofday(&req->tvrstart, NULL); } @@ -1512,6 +1511,14 @@ int tcp_read_req(struct tcp_connection *con, int *bytes_read, } #endif + if(ksr_msg_recv_max_size <= (int)(req->parsed - req->start)) { + LOG(cfg_get(core, core_cfg, corelog), + "read message too large: %d - c: %p r: %p (%d)\n", + (int)(req->parsed - req->start), con, req, bytes); + resp = CONN_ERROR; + goto end_req; + } + if(unlikely(bytes < 0)) { LOG(cfg_get(core, core_cfg, corelog), "ERROR: tcp_read_req: error reading - c: %p r: %p (%d)\n", diff --git a/src/core/udp_server.c b/src/core/udp_server.c index 16c85bd8421..7e01dd8c279 100644 --- a/src/core/udp_server.c +++ b/src/core/udp_server.c @@ -664,6 +664,11 @@ int udp_rcv_loop() else goto error; } + if(ksr_msg_recv_max_size <= len) { + LOG(cfg_get(core, core_cfg, corelog), + "read message too large: %d\n", len); + continue; + } if(fromaddrlen != (unsigned int)sockaddru_len(bind_address->su)) { LM_ERR("ignoring data - unexpected from addr len: %u != %u\n", fromaddrlen, (unsigned int)sockaddru_len(bind_address->su)); diff --git a/src/main.c b/src/main.c index 90ef4ad49e8..7185f0c0eaf 100644 --- a/src/main.c +++ b/src/main.c @@ -530,6 +530,7 @@ int fixup_complete = 0; /* flag = is the fixup complete ? */ char *pid_file = 0; /* filename as asked by use */ char *pgid_file = 0; +int ksr_msg_recv_max_size = 32767; /* 2^15 - 1 */ /* memory manager */ #define SR_MEMMNG_DEFAULT "qm"
1 year, 2 months
1
0
0
0
git:master:a902e4a0: core: tcp - limit number of accepted connections per src ip
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: a902e4a032a85a7755de32eeadac800a1312e64f URL:
https://github.com/kamailio/kamailio/commit/a902e4a032a85a7755de32eeadac800…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-10-13T17:33:51+02:00 core: tcp - limit number of accepted connections per src ip - default 1024 --- Modified: src/core/tcp_conn.h Modified: src/core/tcp_main.c Modified: src/core/tcp_read.c --- Diff:
https://github.com/kamailio/kamailio/commit/a902e4a032a85a7755de32eeadac800…
Patch:
https://github.com/kamailio/kamailio/commit/a902e4a032a85a7755de32eeadac800…
--- diff --git a/src/core/tcp_conn.h b/src/core/tcp_conn.h index 4cb3da51f40..2a4a2dd7b0d 100644 --- a/src/core/tcp_conn.h +++ b/src/core/tcp_conn.h @@ -47,6 +47,8 @@ #define KSR_TCP_MSGREAD_TIMEOUT 20 /* timeout (secs) to read SIP message */ +#define KSR_TCP_ACCEPT_IPLIMIT 1024 /* limit accepted tcp connections from IP */ + /* tcp connection flags */ #define F_CONN_READ_W 2 /* watched for READ ev. in main */ #define F_CONN_WRITE_W 4 /* watched for WRITE (main) */ @@ -281,6 +283,7 @@ typedef struct tcp_connection unsigned int flags; /* connection related flags */ snd_flags_t send_flags; /* special send flags */ enum tcp_conn_states state; /* connection state */ + enum tcp_conn_states initstate; /* initial connection state */ void *extra_data; /* extra data associated to the connection, 0 for tcp*/ struct timer_ln timer; time_t timestamp; /* connection creation timestamp */ diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c index 9f39dd72444..aac5347431d 100644 --- a/src/core/tcp_main.c +++ b/src/core/tcp_main.c @@ -1162,6 +1162,30 @@ int tcpconn_read_haproxy(struct tcp_connection *c) return (bytes >= 0) ? retval : -1; } +int tcp_connection_limit_srcip(union sockaddr_union *srcaddr, int limit) +{ + struct tcp_connection *con; + ip_addr_t src_ip; + int n; + int i; + + n = 0; + su2ip_addr(&src_ip, srcaddr); + TCPCONN_LOCK; + for(i = 0; i < TCP_ID_HASH_SIZE && n < limit; i++) { + for(con = tcpconn_id_hash[i]; con && n < limit; con = con->id_next) { + if(con->initstate == S_CONN_ACCEPT) { + if(ip_addr_cmp(&src_ip, &con->rcv.src_ip)) { + n++; + } + } + } + } + TCPCONN_UNLOCK; + + return (n >= limit) ? 1 : 0; +} + struct tcp_connection *tcpconn_new(int sock, union sockaddr_union *su, union sockaddr_union *local_addr, struct socket_info *ba, int type, int state) @@ -1217,6 +1241,7 @@ struct tcp_connection *tcpconn_new(int sock, union sockaddr_union *su, c->rcv.proto_reserved1 = 0; /* this will be filled before receive_message*/ c->rcv.proto_reserved2 = 0; c->state = state; + c->initstate = state; c->extra_data = 0; c->timestamp = time(NULL); #ifdef USE_TLS @@ -4426,6 +4451,12 @@ static inline int handle_new_connect(struct socket_info *si) tcp_safe_close(new_sock); return 1; /* success, because the accept was successful */ } + if(unlikely(tcp_connection_limit_srcip(&su, KSR_TCP_ACCEPT_IPLIMIT))) { + LM_CRIT("hit the limit of connections per source IP (%s) - rejecting\n", + su2a(&su, sizeof(su))); + tcp_safe_close(new_sock); + return 1; /* success, because the accept was successful */ + } (*tcp_connections_no)++; if(unlikely(si->proto == PROTO_TLS)) (*tls_connections_no)++; diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c index 2ad9579854f..31c6e92444c 100644 --- a/src/core/tcp_read.c +++ b/src/core/tcp_read.c @@ -448,7 +448,6 @@ int tcp_read_headers(struct tcp_connection *c, rd_conn_flags_t *read_flags) bytes = tcp_read(c, read_flags); if(bytes <= 0) return bytes; - LM_DBG("===== read %d bytes\n", bytes); gettimeofday(&tvnow, NULL); tvdiff = 1000000 * (tvnow.tv_sec - r->tvrstart.tv_sec) + (tvnow.tv_usec - r->tvrstart.tv_usec); @@ -1661,12 +1660,10 @@ int tcp_read_req(struct tcp_connection *con, int *bytes_read, req->content_len = 0; req->bytes_to_go = 0; req->pos = req->buf + size; - LM_DBG("=== reset message read start time\n"); req->tvrstart.tv_sec = 0; req->tvrstart.tv_usec = 0; if(unlikely(size)) { - LM_DBG("=== set message read start time\n"); gettimeofday(&req->tvrstart, NULL); memmove(req->buf, req->parsed, size); req->parsed = req->buf; /* fix req->parsed after using it */
1 year, 2 months
1
0
0
0
git:master:ddfe15f8: core: tcp - exclude crlf ping from data exchage state
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: ddfe15f860555048f1ad6884727d4eb52f11910f URL:
https://github.com/kamailio/kamailio/commit/ddfe15f860555048f1ad6884727d4eb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-10-13T17:33:51+02:00 core: tcp - exclude crlf ping from data exchage state --- Modified: src/core/tcp_read.c --- Diff:
https://github.com/kamailio/kamailio/commit/ddfe15f860555048f1ad6884727d4eb…
Patch:
https://github.com/kamailio/kamailio/commit/ddfe15f860555048f1ad6884727d4eb…
--- diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c index e6e79c2a174..2ad9579854f 100644 --- a/src/core/tcp_read.c +++ b/src/core/tcp_read.c @@ -1580,7 +1580,9 @@ int tcp_read_req(struct tcp_connection *con, int *bytes_read, } /* if we are here everything is nice and ok*/ resp = CONN_RELEASE; - req->dxstate |= KSR_TCP_REQSTATE_DATARECV; + if(req->state != H_PING_CRLF) { + req->dxstate |= KSR_TCP_REQSTATE_DATARECV; + } #ifdef EXTRA_DEBUG LM_DBG("receiving msg(%p, %d)\n", req->start, (int)(req->parsed - req->start));
1 year, 2 months
1
0
0
0
git:master:ef86402d: core: tcp - close connection without data traffic at all
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: ef86402d2397ff7b0416bc17ab0a2ba906402215 URL:
https://github.com/kamailio/kamailio/commit/ef86402d2397ff7b0416bc17ab0a2ba…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-10-13T17:33:51+02:00 core: tcp - close connection without data traffic at all - default timeout: 20sec - cleanup is done on timer, it can take another 10sec --- Modified: src/core/tcp_conn.h Modified: src/core/tcp_main.c Modified: src/core/tcp_read.c --- Diff:
https://github.com/kamailio/kamailio/commit/ef86402d2397ff7b0416bc17ab0a2ba…
Patch:
https://github.com/kamailio/kamailio/commit/ef86402d2397ff7b0416bc17ab0a2ba…
--- diff --git a/src/core/tcp_conn.h b/src/core/tcp_conn.h index 2e58861277c..4cb3da51f40 100644 --- a/src/core/tcp_conn.h +++ b/src/core/tcp_conn.h @@ -195,6 +195,8 @@ typedef enum tcp_req_flags #define TCP_REQ_BCHUNKED(tr) ((tr)->flags & F_TCP_REQ_BCHUNKED) #endif +#define KSR_TCP_REQSTATE_DATARECV (1 << 0) + typedef struct tcp_req { struct tcp_req *next; @@ -214,6 +216,7 @@ typedef struct tcp_req int bytes_to_go; /* how many bytes we have still to read from the body*/ enum tcp_req_errors error; enum tcp_req_states state; + unsigned int dxstate; struct timeval tvrstart; } tcp_req_t; diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c index f4f00c23420..9f39dd72444 100644 --- a/src/core/tcp_main.c +++ b/src/core/tcp_main.c @@ -5454,6 +5454,7 @@ void tcp_timer_check_connections(unsigned int ticks, void *param) struct timeval tvnow; long long tvdiff; long mcmd[2]; + int cidset = 0; if(tcp_disable) { return; @@ -5466,6 +5467,7 @@ void tcp_timer_check_connections(unsigned int ticks, void *param) for(i = 0; i < TCP_ID_HASH_SIZE && n < TCPIDLIST_SIZE; i++) { for(con = tcpconn_id_hash[i]; con && n < TCPIDLIST_SIZE; con = con->id_next) { + cidset = 0; if(con->state == S_CONN_OK) { if(con->req.tvrstart.tv_sec > 0) { tvdiff = 1000000 @@ -5478,18 +5480,34 @@ void tcp_timer_check_connections(unsigned int ticks, void *param) n, con->id, tvdiff); tcpidlist[n] = con->id; n++; + cidset = 1; } } } + if((cidset == 0) + && !(con->req.dxstate & KSR_TCP_REQSTATE_DATARECV)) { + if(tvnow.tv_sec - con->timestamp + >= KSR_TCP_MSGREAD_TIMEOUT) { + LM_DBG("n: %d - connection id: %d (state: %d) - " + "message " + "receiving timeout: %ld\n", + n, con->id, con->state, + (long)(tvnow.tv_sec - con->timestamp)); + tcpidlist[n] = con->id; + n++; + cidset = 1; + } + } } } TCPCONN_UNLOCK; if(n > 0) { for(i = 0; i < n; i++) { if((con = tcpconn_get(tcpidlist[i], 0, 0, 0, 0))) { - LM_CRIT("message reading timeout on connection id: %d - " + LM_CRIT("message processing timeout on connection id: %d " + "(state: %d) - " "closing\n", - tcpidlist[i]); + tcpidlist[i], con->state); mcmd[0] = (long)con; mcmd[1] = CONN_EOF; diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c index 1592936238b..e6e79c2a174 100644 --- a/src/core/tcp_read.c +++ b/src/core/tcp_read.c @@ -1580,6 +1580,7 @@ int tcp_read_req(struct tcp_connection *con, int *bytes_read, } /* if we are here everything is nice and ok*/ resp = CONN_RELEASE; + req->dxstate |= KSR_TCP_REQSTATE_DATARECV; #ifdef EXTRA_DEBUG LM_DBG("receiving msg(%p, %d)\n", req->start, (int)(req->parsed - req->start));
1 year, 2 months
1
0
0
0
git:master:f5b46efc: core: tcp - set limit for reading a message
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: f5b46efc3a97aa45d090f46990a40bcc9dd91390 URL:
https://github.com/kamailio/kamailio/commit/f5b46efc3a97aa45d090f46990a40bc…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-10-13T17:33:51+02:00 core: tcp - set limit for reading a message - default 10sec - if message is not read, close connection - cleanup is done on timer, it can take an additional 10sec to clean up connection --- Modified: src/core/tcp_conn.h Modified: src/core/tcp_init.h Modified: src/core/tcp_main.c Modified: src/core/tcp_read.c Modified: src/main.c --- Diff:
https://github.com/kamailio/kamailio/commit/f5b46efc3a97aa45d090f46990a40bc…
Patch:
https://github.com/kamailio/kamailio/commit/f5b46efc3a97aa45d090f46990a40bc…
1 year, 2 months
1
0
0
0
git:master:2df623c7: github: fix cleanup perms [skip ci]
by Victor Seva
Module: kamailio Branch: master Commit: 2df623c78fd8605b9f7f936efc4cb2011d0a60b5 URL:
https://github.com/kamailio/kamailio/commit/2df623c78fd8605b9f7f936efc4cb20…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2023-10-13T12:42:35+02:00 github: fix cleanup perms [skip ci] --- Modified: .github/workflows/cleanup.yml --- Diff:
https://github.com/kamailio/kamailio/commit/2df623c78fd8605b9f7f936efc4cb20…
Patch:
https://github.com/kamailio/kamailio/commit/2df623c78fd8605b9f7f936efc4cb20…
--- diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index babf4956fb2..bea47fa30dc 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -13,7 +13,7 @@ jobs: x86_64: runs-on: ubuntu-latest permissions: - packages: admin + packages: write steps: - name: Delete untagged images uses: camargo/delete-untagged-action@v1
1 year, 2 months
1
0
0
0
git:master:09729561: github: move cleanup of untagged packages to its own workflow [skip ci]
by Victor Seva
Module: kamailio Branch: master Commit: 097295616f6387d192c5774ce7fc1a95b1913542 URL:
https://github.com/kamailio/kamailio/commit/097295616f6387d192c5774ce7fc1a9…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2023-10-13T12:35:35+02:00 github: move cleanup of untagged packages to its own workflow [skip ci] --- Added: .github/workflows/cleanup.yml Modified: .github/workflows/alpine.yml --- Diff:
https://github.com/kamailio/kamailio/commit/097295616f6387d192c5774ce7fc1a9…
Patch:
https://github.com/kamailio/kamailio/commit/097295616f6387d192c5774ce7fc1a9…
--- diff --git a/.github/workflows/alpine.yml b/.github/workflows/alpine.yml index eb64a32d73b..3bf126e588d 100644 --- a/.github/workflows/alpine.yml +++ b/.github/workflows/alpine.yml @@ -175,10 +175,3 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - - - name: Delete untagged images - if: ${{ steps.should_run.outputs.should_run != 'false' }} - uses: camargo/delete-untagged-action@v1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - package-name: ${{ env.IMAGE_NAME }} diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml new file mode 100644 index 00000000000..babf4956fb2 --- /dev/null +++ b/.github/workflows/cleanup.yml @@ -0,0 +1,22 @@ +--- +name: cleanup packages +on: + schedule: + - cron: '0 5 * * *' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + IMAGE_NAME: kamailio-ci + +jobs: + x86_64: + runs-on: ubuntu-latest + permissions: + packages: admin + steps: + - name: Delete untagged images + uses: camargo/delete-untagged-action@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + package-name: ${{ env.IMAGE_NAME }}
1 year, 2 months
1
0
0
0
git:master:5632d346: github: allow trigger actions manually from panel [skip ci]
by Victor Seva
Module: kamailio Branch: master Commit: 5632d34677eb9d6feeacda9dba12244f0c5de838 URL:
https://github.com/kamailio/kamailio/commit/5632d34677eb9d6feeacda9dba12244…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org> Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org> Date: 2023-10-13T10:13:33+02:00 github: allow trigger actions manually from panel [skip ci] --- Modified: .github/workflows/alpine.yml Modified: .github/workflows/cifuzz.yml Modified: .github/workflows/codeql.yml --- Diff:
https://github.com/kamailio/kamailio/commit/5632d34677eb9d6feeacda9dba12244…
Patch:
https://github.com/kamailio/kamailio/commit/5632d34677eb9d6feeacda9dba12244…
--- diff --git a/.github/workflows/alpine.yml b/.github/workflows/alpine.yml index c11d7056086..eb64a32d73b 100644 --- a/.github/workflows/alpine.yml +++ b/.github/workflows/alpine.yml @@ -6,6 +6,8 @@ on: push: tags: - '[0-9]+.[0-9]+.[0-9]+' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: env: IMAGE_NAME: kamailio-ci diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index a8294516c2a..bb1b712cb5b 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -4,6 +4,8 @@ on: branches: [ "master" ] schedule: - cron: "30 0 * * *" + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: jobs: Fuzzing: runs-on: ubuntu-latest diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 71c8e66cb6c..59e3dbf476f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -5,6 +5,8 @@ on: branches: [ "master" ] schedule: - cron: "30 0 * * *" + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: jobs: analyze: name: Analyze
1 year, 2 months
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
28
29
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Results per page:
10
25
50
100
200