Module: sip-router
Branch: master
Commit: 7a0489e835789292fbe133b2000bc4091db87e5b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7a0489e…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Fri Feb 27 23:27:37 2009 +0100
Merge branch 'ser_core_cvs'
* ser_core_cvs:
sctp: direct blacklist support
Support for MESSAGE and OPTIONS method types are added to the parser.
log/dbg: level is not limited anymore
config: tcp_async alias for tcp_buf_write
tcp: async write timeout fixes
tcp: blacklist at tcp level if possible
blst: another blacklist dest. function version
cfg_size macro renamed to cfg_sizeof to avoid a conflict with one of the
Conflicts:
cfg.y
The first conflict in BREAK definition, the file coming from cvs contained
RETURN_R_F, while the file coming from git contained BREAK_R_F, I resolved it
with BREAK_R_F.
The second conflict was in the definition in LOG_TOK which was resolved with
the latest version from cvs.
---
Module: sip-router
Branch: master
Commit: 69515cab5eefb3b272617fc46565d58e8b392619
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=69515ca…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Feb 26 23:13:59 2009 +0000
config: tcp_async alias for tcp_buf_write
- tcp_buf_write was not the best choosen name, so tcp_async was added as an
alias for it
---
NEWS | 3 ++-
cfg.lex | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 6318d2a..f3cbfb3 100644
--- a/NEWS
+++ b/NEWS
@@ -273,9 +273,10 @@ new config variables:
will be cached inside the process calling tcp_send (performance increase
for sending over tcp at the cost of slightly slower connection closing and
extra FDs kept open)
- tcp_buf_write = yes | no (default no) - if enabled all the tcp writes that
+ tcp_async = yes | no (default no) - if enabled all the tcp writes that
would block / wait for connect to finish, will be queued and attempted
latter (see also tcp_conn_wq_max and tcp_wq_max).
+ tcp_buf_write = synonim for tcp_async
tcp_conn_wq_max = bytes (default 32 K) - maximum bytes queued for write
allowed per connection. Attempting to queue more bytes would result
in an error and in the connection being closed (too slow). If
diff --git a/cfg.lex b/cfg.lex
index 0c4ac17..e36a625 100644
--- a/cfg.lex
+++ b/cfg.lex
@@ -301,7 +301,7 @@ TCP_MAX_CONNECTIONS "tcp_max_connections"
TCP_SOURCE_IPV4 "tcp_source_ipv4"
TCP_SOURCE_IPV6 "tcp_source_ipv6"
TCP_OPT_FD_CACHE "tcp_fd_cache"
-TCP_OPT_BUF_WRITE "tcp_buf_write"
+TCP_OPT_BUF_WRITE "tcp_buf_write"|"tcp_async"
TCP_OPT_CONN_WQ_MAX "tcp_conn_wq_max"
TCP_OPT_WQ_MAX "tcp_wq_max"
TCP_OPT_DEFER_ACCEPT "tcp_defer_accept"
Module: sip-router
Branch: master
Commit: 38429f23ff8a73c16c1b02812fa4a27cf28c0cb1
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=38429f2…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Feb 26 23:13:22 2009 +0000
tcp: blacklist at tcp level if possible
- automatically blacklist destinations if connecting to them fails
(BLST_ERR_CONNECT) or send fails (BLST_ERR_SEND), either due to a
protocol error (RST, protocol level timeout a.s.o), or because
of a ser level send/connect timeout.
Note: in this cases the sip_msg parameter of the blacklist will
be null (since in general the message triggering the error is not
known), so if you register a blacklist callback you should make
sure it works with null sip_msgs too.
- if a connection is in a connect pending state (S_CONN_CONNECT)
and something is read on it, move it into established state
(S_CONN_OK). This can happen only in tcp async mode.
- fix transition directly to S_CONN_OK from S_CONN_PENDING (should go
through S_CONN_CONNECT first)
---
tcp_main.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
tcp_read.c | 27 ++++++++++++-
2 files changed, 139 insertions(+), 8 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=384…
Module: sip-router
Branch: master
Commit: 047b1dfb8958f4ba29fd77ed44e7cb17fdd106b1
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=047b1df…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Feb 27 21:15:27 2009 +0000
sctp: direct blacklist support
- blacklist support at the sctp level. If sctp_send_retries are
used, the blacklist will work only for send (using
SCTP_SEND_FAILED notifications). If sctp_send_retries is not
used (default), there are 2 possible blacklist reasons: SEND or
CONNECT (assoc. failed to be opened).
---
sctp_server.c | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/sctp_server.c b/sctp_server.c
index 7ac8444..9b8688f 100644
--- a/sctp_server.c
+++ b/sctp_server.c
@@ -22,6 +22,7 @@
* History:
* --------
* 2008-08-07 initial version (andrei)
+ * 2009-02-27 blacklist support (andrei)
*/
#ifdef USE_SCTP
@@ -49,6 +50,9 @@
#include "mem/mem.h"
#include "ip_addr.h"
#include "cfg/cfg_struct.h"
+#ifdef USE_DST_BLACKLIST
+#include "dst_blacklist.h"
+#endif /* USE_DST_BLACKLIST */
@@ -643,6 +647,16 @@ static int sctp_handle_send_failed(struct socket_info* si,
ret=sctp_msg_send_raw(&dst, data, data_len, &sinfo);
}
+#ifdef USE_DST_BLACKLIST
+ else if (cfg_get(core, core_cfg, use_dst_blacklist) &&
+ sctp_options.sctp_send_retries) {
+ /* blacklist only if send_retries is on, if off we blacklist
+ from SCTP_ASSOC_CHANGE: SCTP_COMM_LOST/SCTP_CANT_STR_ASSOC
+ which is better (because we can tell connect errors from send
+ errors and we blacklist a failed dst only once) */
+ dst_blacklist_su(BLST_ERR_SEND, PROTO_SCTP, su, 0);
+ }
+#endif /* USE_DST_BLACKLIST */
return (ret>0)?0:ret;
}
@@ -665,7 +679,7 @@ static int sctp_handle_notification(struct socket_info* si,
text " too short (%d bytes instead of %d bytes)\n", \
su2a((from_su), sizeof(*(from_su))), \
(bind_addr)->name.len, (bind_addr)->name.s, \
- (bind_addr)->port_no, (length), (val)); \
+ (bind_addr)->port_no, (int)(length), (int)(val)); \
goto error; \
}
@@ -735,6 +749,21 @@ static int sctp_handle_notification(struct socket_info* si,
snp->sn_assoc_change.sac_outbound_streams,
snp->sn_assoc_change.sac_inbound_streams
);
+#ifdef USE_DST_BLACKLIST
+ /* blacklist only if send_retries is turned off (if on we don't
+ know here if we did retry or we are at the first error) */
+ if (cfg_get(core, core_cfg, use_dst_blacklist) &&
+ (sctp_options.sctp_send_retries==0)){
+ switch(snp->sn_assoc_change.sac_state) {
+ case SCTP_CANT_STR_ASSOC:
+ dst_blacklist_su(BLST_ERR_CONNECT, PROTO_SCTP, su, 0);
+ break;
+ case SCTP_COMM_LOST:
+ dst_blacklist_su(BLST_ERR_SEND, PROTO_SCTP, su, 0);
+ break;
+ }
+ }
+#endif /* USE_DST_BLACKLIST */
break;
#ifdef SCTP_ADAPTION_INDICATION
case SCTP_ADAPTION_INDICATION: