Browse code

fixed segfault in case of SCTP failover

Nils Ohlmeier authored on 24/08/2008 11:49:01
Showing 1 changed files
... ...
@@ -158,6 +158,15 @@ static inline int msg_send(struct dest_info* dst, char* buf, int len)
158 158
 					" support is disabled\n");
159 159
 			goto error;
160 160
 		}else{
161
+			if (unlikely(dst->send_sock==0)){
162
+				new_dst=*dst;
163
+				new_dst.send_sock=get_send_socket(0, &dst->to, dst->proto);
164
+				if (unlikely(new_dst.send_sock==0)){
165
+					LOG(L_ERR, "msg_send: ERROR: no sending SCTP socket found\n");
166
+					goto error;
167
+				}
168
+				dst=&new_dst;
169
+			}
161 170
 			if (unlikely(sctp_msg_send(dst, buf, len)<0)){
162 171
 				STATS_TX_DROPS;
163 172
 				LOG(L_ERR, "msg_send: ERROR: sctp_msg_send failed\n");