FreeBSD/sys/netinet/sctp_asconf.c
/*
 * sa is the sockaddr to ask the peer to set primary to.
 * returns: 0 = completed, -1 = error
 */
sa is the sockaddr to ask the peer to set primary to.
returns: 0 = completed, -1 = error
sa is the sockaddr to ask the peer to set primary to . returns : 0 = completed - 1 = error
int32_t
sctp_set_primary_ip_address_sa(struct sctp_tcb *stcb, struct sockaddr *sa)
{
	uint32_t vrf_id;
	struct sctp_ifa *ifa;
	vrf_id = stcb->asoc.vrf_id;
	ifa = sctp_find_ifa_by_addr(sa, vrf_id, SCTP_ADDR_NOT_LOCKED);
	if (ifa == NULL) {
		return (-1);
	}
	if (!sctp_asconf_queue_add(stcb, ifa, SCTP_SET_PRIM_ADDR)) {
		SCTPDBG(SCTP_DEBUG_ASCONF1,
		    "set_primary_ip_address_sa: queued on tcb=%p, ",
		    (void *)stcb);
		SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, sa);
		if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) ||
		    (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
#ifdef SCTP_TIMER_BASED_ASCONF
			sctp_timer_start(SCTP_TIMER_TYPE_ASCONF,
			    stcb->sctp_ep, stcb,
			    stcb->asoc.primary_destination);
#else
			sctp_send_asconf(stcb, NULL, SCTP_ADDR_NOT_LOCKED);
#endif
		}
	} else {
		SCTPDBG(SCTP_DEBUG_ASCONF1, "set_primary_ip_address_sa: failed to add to queue on tcb=%p, ",
		    (void *)stcb);
		SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, sa);
		return (-1);
	}
	return (0);
}
int32_t sctp_set_primary_ip_address_sa ( struct sctp_tcb * stcb , struct sockaddr * sa ) { uint32_t vrf_id ; struct sctp_ifa * ifa ; vrf_id = stcb -> asoc . vrf_id ; ifa = sctp_find_ifa_by_addr ( sa , vrf_id , SCTP_ADDR_NOT_LOCKED ) ; if ( ifa == NULL ) { return ( -1 ) ; } if ( ! sctp_asconf_queue_add ( stcb , ifa , SCTP_SET_PRIM_ADDR ) ) { SCTPDBG ( SCTP_DEBUG_ASCONF1 , " " , ( void * ) stcb ) ; SCTPDBG_ADDR ( SCTP_DEBUG_ASCONF1 , sa ) ; if ( ( SCTP_GET_STATE ( & stcb -> asoc ) == SCTP_STATE_OPEN ) || ( SCTP_GET_STATE ( & stcb -> asoc ) == SCTP_STATE_SHUTDOWN_RECEIVED ) ) { #ifdef SCTP_TIMER_BASED_ASCONF sctp_timer_start ( SCTP_TIMER_TYPE_ASCONF , stcb -> sctp_ep , stcb , stcb -> asoc . primary_destination ) ; #else sctp_send_asconf ( stcb , NULL , SCTP_ADDR_NOT_LOCKED ) ; #endif } } else { SCTPDBG ( SCTP_DEBUG_ASCONF1 , " " , ( void * ) stcb ) ; SCTPDBG_ADDR ( SCTP_DEBUG_ASCONF1 , sa ) ; return ( -1 ) ; } return ( 0 ) ; }
sa is the sockaddr to ask the peer to set primary to.
sa is the sockaddr to ask the peer to set primary to .
/* find the ifa for the desired set primary */ /* Invalid address */ /* queue an ASCONF:SET_PRIM_ADDR to be sent */ /* set primary queuing succeeded */