|
@@ -46,6 +46,9 @@
|
|
|
#include "../../tcp_int_send.h"
|
|
|
#include "../../tcp_read.h"
|
|
|
#include "../../cfg/cfg.h"
|
|
|
+#include "../../route.h"
|
|
|
+#include "../../forward.h"
|
|
|
+#include "../../onsend.h"
|
|
|
|
|
|
#include "tls_init.h"
|
|
|
#include "tls_domain.h"
|
|
@@ -56,6 +59,8 @@
|
|
|
#include "tls_dump_vf.h"
|
|
|
#include "tls_cfg.h"
|
|
|
|
|
|
+int tls_run_event_routes(struct tcp_connection *c);
|
|
|
+
|
|
|
/* low memory treshold for openssl bug #1491 workaround */
|
|
|
#define LOW_MEM_NEW_CONNECTION_TEST() \
|
|
|
(cfg_get(tls, tls_cfg, low_mem_threshold1) && \
|
|
@@ -435,6 +440,7 @@ int tls_connect(struct tcp_connection *c, int* error)
|
|
|
LOG(tls_log, "tls_connect: server did not "
|
|
|
"present a certificate\n");
|
|
|
}
|
|
|
+ tls_run_event_routes(c);
|
|
|
} else { /* 0 or < 0 */
|
|
|
*error = SSL_get_error(ssl, ret);
|
|
|
}
|
|
@@ -1343,3 +1349,42 @@ bug:
|
|
|
c, flags, ssl_read, *flags);
|
|
|
return -1;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+static int _tls_evrt_connection_out = -1; /* default disabled */
|
|
|
+
|
|
|
+/*!
|
|
|
+ * lookup tls event routes
|
|
|
+ */
|
|
|
+void tls_lookup_event_routes(void)
|
|
|
+{
|
|
|
+ _tls_evrt_connection_out=route_lookup(&event_rt, "tls:connection-out");
|
|
|
+ if (_tls_evrt_connection_out>=0 && event_rt.rlist[_tls_evrt_connection_out]==0)
|
|
|
+ _tls_evrt_connection_out=-1; /* disable */
|
|
|
+ if(_tls_evrt_connection_out!=-1)
|
|
|
+ forward_set_send_info(1);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ */
|
|
|
+int tls_run_event_routes(struct tcp_connection *c)
|
|
|
+{
|
|
|
+ int backup_rt;
|
|
|
+ struct run_act_ctx ctx;
|
|
|
+ sip_msg_t tmsg;
|
|
|
+
|
|
|
+ if(_tls_evrt_connection_out<0)
|
|
|
+ return 0;
|
|
|
+ if(p_onsend==0 || p_onsend->msg==0)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ backup_rt = get_route_type();
|
|
|
+ set_route_type(LOCAL_ROUTE);
|
|
|
+ init_run_actions_ctx(&ctx);
|
|
|
+ tls_set_pv_con(c);
|
|
|
+ run_top_route(event_rt.rlist[_tls_evrt_connection_out], &tmsg, 0);
|
|
|
+ tls_set_pv_con(0);
|
|
|
+ set_route_type(backup_rt);
|
|
|
+ return 0;
|
|
|
+}
|