Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/sctp_output.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 5,811 Lines • ▼ Show 20 Lines | if ((asoc != NULL) && | ||||
initack->init.initial_tsn = htonl(asoc->init_seq_number); | initack->init.initial_tsn = htonl(asoc->init_seq_number); | ||||
} else { | } else { | ||||
uint32_t vtag, itsn; | uint32_t vtag, itsn; | ||||
if (asoc) { | if (asoc) { | ||||
atomic_add_int(&asoc->refcnt, 1); | atomic_add_int(&asoc->refcnt, 1); | ||||
SCTP_TCB_UNLOCK(stcb); | SCTP_TCB_UNLOCK(stcb); | ||||
new_tag: | new_tag: | ||||
SCTP_INP_INFO_RLOCK(); | |||||
vtag = sctp_select_a_tag(inp, inp->sctp_lport, sh->src_port, 1); | vtag = sctp_select_a_tag(inp, inp->sctp_lport, sh->src_port, 1); | ||||
SCTP_INP_INFO_RUNLOCK(); | |||||
if ((asoc->peer_supports_nat) && (vtag == asoc->my_vtag)) { | if ((asoc->peer_supports_nat) && (vtag == asoc->my_vtag)) { | ||||
/* | /* | ||||
* Got a duplicate vtag on some guy behind a | * Got a duplicate vtag on some guy behind a | ||||
* nat make sure we don't use it. | * nat make sure we don't use it. | ||||
*/ | */ | ||||
goto new_tag; | goto new_tag; | ||||
} | } | ||||
initack->init.initiate_tag = htonl(vtag); | initack->init.initiate_tag = htonl(vtag); | ||||
/* get a TSN to use too */ | /* get a TSN to use too */ | ||||
itsn = sctp_select_initial_TSN(&inp->sctp_ep); | itsn = sctp_select_initial_TSN(&inp->sctp_ep); | ||||
initack->init.initial_tsn = htonl(itsn); | initack->init.initial_tsn = htonl(itsn); | ||||
SCTP_TCB_LOCK(stcb); | SCTP_TCB_LOCK(stcb); | ||||
atomic_add_int(&asoc->refcnt, -1); | atomic_add_int(&asoc->refcnt, -1); | ||||
} else { | } else { | ||||
SCTP_INP_INCR_REF(inp); | SCTP_INP_INCR_REF(inp); | ||||
SCTP_INP_RUNLOCK(inp); | SCTP_INP_RUNLOCK(inp); | ||||
SCTP_INP_INFO_RLOCK(); | |||||
vtag = sctp_select_a_tag(inp, inp->sctp_lport, sh->src_port, 1); | vtag = sctp_select_a_tag(inp, inp->sctp_lport, sh->src_port, 1); | ||||
SCTP_INP_INFO_RUNLOCK(); | |||||
initack->init.initiate_tag = htonl(vtag); | initack->init.initiate_tag = htonl(vtag); | ||||
/* get a TSN to use too */ | /* get a TSN to use too */ | ||||
initack->init.initial_tsn = htonl(sctp_select_initial_TSN(&inp->sctp_ep)); | initack->init.initial_tsn = htonl(sctp_select_initial_TSN(&inp->sctp_ep)); | ||||
SCTP_INP_RLOCK(inp); | SCTP_INP_RLOCK(inp); | ||||
SCTP_INP_DECR_REF(inp); | SCTP_INP_DECR_REF(inp); | ||||
} | } | ||||
} | } | ||||
/* save away my tag to */ | /* save away my tag to */ | ||||
▲ Show 20 Lines • Show All 6,871 Lines • ▼ Show 20 Lines | if (addr == NULL) { | ||||
} | } | ||||
/* get an asoc/stcb struct */ | /* get an asoc/stcb struct */ | ||||
vrf_id = inp->def_vrf_id; | vrf_id = inp->def_vrf_id; | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
if (create_lock_applied == 0) { | if (create_lock_applied == 0) { | ||||
panic("Error, should hold create lock and I don't?"); | panic("Error, should hold create lock and I don't?"); | ||||
} | } | ||||
#endif | #endif | ||||
stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id, | stcb = sctp_aloc_assoc_connected(inp, addr, &error, 0, 0, vrf_id, | ||||
inp->sctp_ep.pre_open_stream_count, | inp->sctp_ep.pre_open_stream_count, | ||||
inp->sctp_ep.port, | inp->sctp_ep.port, | ||||
p, | p, | ||||
SCTP_INITIALIZE_AUTH_PARAMS); | SCTP_INITIALIZE_AUTH_PARAMS); | ||||
if (stcb == NULL) { | if (stcb == NULL) { | ||||
/* Error is setup for us in the call */ | /* Error is setup for us in the call */ | ||||
goto out_unlocked; | goto out_unlocked; | ||||
} | |||||
if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { | |||||
stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; | |||||
/* | |||||
* Set the connected flag so we can queue | |||||
* data | |||||
*/ | |||||
soisconnecting(so); | |||||
} | } | ||||
hold_tcblock = 1; | hold_tcblock = 1; | ||||
if (create_lock_applied) { | if (create_lock_applied) { | ||||
SCTP_ASOC_CREATE_UNLOCK(inp); | SCTP_ASOC_CREATE_UNLOCK(inp); | ||||
create_lock_applied = 0; | create_lock_applied = 0; | ||||
} else { | } else { | ||||
SCTP_PRINTF("Huh-3? create lock should have been on??\n"); | SCTP_PRINTF("Huh-3? create lock should have been on??\n"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,111 Lines • Show Last 20 Lines |