Pārlūkot izejas kodu

fixed segfault in case of SCTP failover

Nils Ohlmeier 17 gadi atpakaļ
vecāks
revīzija
d6a58b53e7
1 mainītis faili ar 9 papildinājumiem un 0 dzēšanām
  1. 9 0
      forward.h

+ 9 - 0
forward.h

@@ -158,6 +158,15 @@ static inline int msg_send(struct dest_info* dst, char* buf, int len)
 					" support is disabled\n");
 			goto error;
 		}else{
+			if (unlikely(dst->send_sock==0)){
+				new_dst=*dst;
+				new_dst.send_sock=get_send_socket(0, &dst->to, dst->proto);
+				if (unlikely(new_dst.send_sock==0)){
+					LOG(L_ERR, "msg_send: ERROR: no sending SCTP socket found\n");
+					goto error;
+				}
+				dst=&new_dst;
+			}
 			if (unlikely(sctp_msg_send(dst, buf, len)<0)){
 				STATS_TX_DROPS;
 				LOG(L_ERR, "msg_send: ERROR: sctp_msg_send failed\n");