Mercurial > hg > freeDiameter
comparison 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 |
comparison
equal
deleted
inserted
replaced
1539:d25ce064c667 | 1540:407e0a889c7e |
---|---|
259 /* Attempt connection to the first entry */ | 259 /* Attempt connection to the first entry */ |
260 nc = (struct next_conn *)(peer->p_connparams.next); | 260 nc = (struct next_conn *)(peer->p_connparams.next); |
261 | 261 |
262 switch (nc->proto) { | 262 switch (nc->proto) { |
263 case IPPROTO_TCP: | 263 case IPPROTO_TCP: |
264 /* TODO: use no_bind and first of cnf_endpoints of nc->ss.sa_family ? */ | |
264 cnx = fd_cnx_cli_connect_tcp((sSA *)&nc->ss, sSAlen(&nc->ss)); | 265 cnx = fd_cnx_cli_connect_tcp((sSA *)&nc->ss, sSAlen(&nc->ss)); |
265 break; | 266 break; |
266 #ifndef DISABLE_SCTP | 267 #ifndef DISABLE_SCTP |
267 case IPPROTO_SCTP: | 268 case IPPROTO_SCTP: |
268 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, | 269 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, |
269 nc->port, &peer->p_hdr.info.pi_endpoints); | 270 nc->port, &peer->p_hdr.info.pi_endpoints, |
271 fd_g_config->cnf_flags.no_bind ? NULL : &fd_g_config->cnf_endpoints); | |
270 break; | 272 break; |
271 #endif /* DISABLE_SCTP */ | 273 #endif /* DISABLE_SCTP */ |
272 } | 274 } |
273 | 275 |
274 if (cnx) | 276 if (cnx) |