diff libfdcore/p_cnx.c @ 1540:407e0a889c7e

SCTP ConnectPeer: sctp_bindx() to local endpoints When connecting to an SCTP peer using sctp_connectx() with local addresses configured with ListenOn, bind to the ListenOn addresses using sctp_bindx() so that the SCTP INIT only contains the configured local addresses, matching what is advertised in the CER, and disable SCTP_AUTO_ASCONF. If no local addresses are configured with ListenOn, the previous behaviour of sctp_connectx() and enable SCTP_AUTO_ASCONF is used.
author Luke Mewburn <luke@mewburn.net>
date Fri, 01 May 2020 18:20:33 +1000
parents 92f33e5ecb77
children 566bb46cc73f
line wrap: on
line diff
--- a/libfdcore/p_cnx.c	Thu Apr 30 15:24:47 2020 +1000
+++ b/libfdcore/p_cnx.c	Fri May 01 18:20:33 2020 +1000
@@ -261,12 +261,14 @@
 		
 		switch (nc->proto) {
 			case IPPROTO_TCP:
+/* TODO: use no_bind and first of cnf_endpoints of nc->ss.sa_family ? */
 				cnx = fd_cnx_cli_connect_tcp((sSA *)&nc->ss, sSAlen(&nc->ss));
 				break;
 #ifndef DISABLE_SCTP			
 			case IPPROTO_SCTP:
 				cnx = fd_cnx_cli_connect_sctp((peer->p_hdr.info.config.pic_flags.pro3 == PI_P3_IP) ? 1 : fd_g_config->cnf_flags.no_ip6, 
-							nc->port, &peer->p_hdr.info.pi_endpoints);
+							nc->port, &peer->p_hdr.info.pi_endpoints,
+							fd_g_config->cnf_flags.no_bind ? NULL : &fd_g_config->cnf_endpoints);
 				break;
 #endif /* DISABLE_SCTP */
 		}
"Welcome to our mercurial repository"