Home | History | Annotate | Download | only in netinet

Lines Matching defs:stcb

129 	struct sctp_tcb *stcb;
130 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
131 if (mtx_owned(&(stcb)->tcb_mtx))
149 struct sctp_tcb *stcb;
153 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
154 if (mtx_owned(&(stcb)->tcb_mtx))
173 struct sctp_tcb *stcb;
181 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
182 if (mtx_owned(&(stcb)->tcb_mtx))
246 struct sctp_tcb *stcb;
342 stcb = LIST_FIRST(&inp->sctp_asoc_list);
343 if (stcb == NULL) {
347 SCTP_TCB_LOCK(stcb);
348 if (stcb->rport != rport) {
350 SCTP_TCB_UNLOCK(stcb);
355 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
364 return (stcb);
367 SCTP_TCB_UNLOCK(stcb);
378 struct sctp_tcb *stcb;
474 stcb = sctp_findassociation_ep_addr(inp_p,
477 return (stcb);
486 struct sctp_tcb *stcb;
515 stcb = sctp_tcb_special_locate(inp_p, remote, local,
517 if ((stcb != NULL) && (locked_tcb == NULL)){
527 if (stcb != NULL) {
528 SCTP_TCB_UNLOCK(stcb);
532 return (stcb);
535 stcb = LIST_FIRST(&inp->sctp_asoc_list);
536 if (stcb == NULL) {
539 SCTP_TCB_LOCK(stcb);
540 if (stcb->rport != rport) {
542 SCTP_TCB_UNLOCK(stcb);
546 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
557 return (stcb);
560 SCTP_TCB_UNLOCK(stcb);
569 LIST_FOREACH(stcb, head, sctp_tcbhash) {
570 if (stcb->rport != rport) {
575 SCTP_TCB_LOCK(stcb);
576 stcb->asoc.nets, sctp_next) {
587 return (stcb);
590 SCTP_TCB_UNLOCK(stcb);
621 struct sctp_tcb *stcb;
636 LIST_FOREACH(stcb, head, sctp_asocs) {
637 SCTP_INP_RLOCK(stcb->sctp_ep);
638 SCTP_TCB_LOCK(stcb);
639 SCTP_INP_RUNLOCK(stcb->sctp_ep);
640 if (stcb->asoc.my_vtag == vtag) {
642 if (inp != stcb->sctp_ep) {
647 SCTP_TCB_UNLOCK(stcb);
652 return (stcb);
654 SCTP_TCB_UNLOCK(stcb);
1064 struct sctp_tcb *stcb;
1074 LIST_FOREACH(stcb, head, sctp_asocs) {
1075 SCTP_INP_RLOCK(stcb->sctp_ep);
1076 SCTP_TCB_LOCK(stcb);
1077 SCTP_INP_RUNLOCK(stcb->sctp_ep);
1078 if (stcb->asoc.my_vtag == vtag) {
1080 if (stcb->rport != rport) {
1085 SCTP_TCB_UNLOCK(stcb);
1088 if (stcb->sctp_ep->sctp_lport != lport) {
1093 SCTP_TCB_UNLOCK(stcb);
1096 net = sctp_findnet(stcb, from);
1101 *inp_p = stcb->sctp_ep;
1103 return (stcb);
1112 SCTP_TCB_UNLOCK(stcb);
1490 struct sctp_tcb *stcb)
1496 SCTP_TCB_UNLOCK(stcb);
1500 SCTP_TCB_LOCK(stcb);
1514 rport = stcb->rport;
1516 LIST_REMOVE(stcb, sctp_tcbhash);
1517 LIST_REMOVE(stcb, sctp_tcblist);
1526 LIST_INSERT_HEAD(&new_inp->sctp_asoc_list, stcb, sctp_tcblist);
1533 stcb->sctp_socket = new_inp->sctp_socket;
1534 stcb->sctp_ep = new_inp;
1967 it->stcb = NULL;
1971 it->stcb = NULL;
1982 it->stcb = NULL;
2253 sctp_findnet(struct sctp_tcb *stcb, struct sockaddr *addr)
2259 if (stcb->rport != sin->sin_port) {
2265 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
2322 sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
2340 netfirst = sctp_findnet(stcb, newaddr);
2375 stcb->ipv4_local_scope = 1;
2378 stcb->asoc.ipv4_local_scope = 1;
2383 stcb->asoc.loopback_scope = 1;
2384 stcb->asoc.ipv4_local_scope = 1;
2385 stcb->asoc.local_scope = 1;
2386 stcb->asoc.site_scope = 1;
2392 stcb->asoc.loopback_scope = 1;
2393 stcb->asoc.ipv4_local_scope = 1;
2394 stcb->asoc.local_scope = 1;
2395 stcb->asoc.site_scope = 1;
2400 (stcb->asoc.ipv4_local_scope == 0)) {
2415 stcb->asoc.loopback_scope = 1;
2416 stcb->asoc.local_scope = 1;
2417 stcb->asoc.ipv4_local_scope = 1;
2418 stcb->asoc.site_scope = 1;
2428 stcb->asoc.ipv4_local_scope = 1;
2429 stcb->asoc.site_scope = 1;
2435 stcb->asoc.site_scope = 1;
2441 stcb->asoc.loopback_scope = 1;
2442 stcb->asoc.ipv4_local_scope = 1;
2443 stcb->asoc.local_scope = 1;
2444 stcb->asoc.site_scope = 1;
2449 (stcb->asoc.loopback_scope == 0)) {
2452 (stcb->asoc.local_scope == 0)) {
2455 (stcb->asoc.site_scope == 0)) {
2471 ((struct sockaddr_in *)newaddr)->sin_port = stcb->rport;
2473 ((struct sockaddr_in6 *)newaddr)->sin6_port = stcb->rport;
2476 net->failure_threshold = stcb->asoc.def_net_failure;
2493 net->RTO = stcb->asoc.initial_rto;
2494 stcb->asoc.numnets++;
2513 stcb->asoc.smallest_mtu = net->mtu;
2518 net->mtu = stcb->asoc.smallest_mtu;
2523 if (stcb->asoc.smallest_mtu > net->mtu) {
2524 stcb->asoc.smallest_mtu = net->mtu;
2529 net->cwnd = uimin((net->mtu * 4), uimax((stcb->asoc.max_burst * net->mtu), SCTP_INITIAL_CWND));
2536 net->ssthresh = stcb->asoc.peers_rwnd;
2539 netfirst = TAILQ_FIRST(&stcb->asoc.nets);
2542 TAILQ_INSERT_TAIL(&stcb->asoc.nets, net, sctp_next);
2545 TAILQ_INSERT_HEAD(&stcb->asoc.nets, net, sctp_next);
2551 TAILQ_INSERT_HEAD(&stcb->asoc.nets, net, sctp_next);
2558 TAILQ_INSERT_HEAD(&stcb->asoc.nets, net, sctp_next);
2573 TAILQ_INSERT_TAIL(&stcb->asoc.nets, net,
2582 TAILQ_INSERT_AFTER(&stcb->asoc.nets, netlook,
2593 if (stcb->asoc.primary_destination == 0) {
2594 stcb->asoc.primary_destination = net;
2595 } else if (!rtcache_validate(&stcb->asoc.primary_destination->ro)) {
2597 stcb->asoc.primary_destination = net;
2599 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, stcb->sctp_ep, stcb,
2615 struct sctp_tcb *stcb;
2722 stcb = (struct sctp_tcb *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_asoc);
2723 if (stcb == NULL) {
2727 printf("aloc_assoc: no assoc mem left, stcb=NULL\n");
2736 memset(stcb, 0, sizeof(*stcb));
2737 asoc = &stcb->asoc;
2738 SCTP_TCB_LOCK_INIT(stcb);
2743 stcb->sctp_ep = inp;
2744 stcb->sctp_socket = inp->sctp_socket;
2747 SCTP_TCB_LOCK_DESTROY (stcb);
2748 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asoc, stcb);
2759 stcb->rport = rport;
2764 SCTP_TCB_LOCK_DESTROY (stcb);
2765 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asoc, stcb);
2777 SCTP_TCB_LOCK(stcb);
2780 head = &sctppcbinfo.sctp_asochash[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag,
2783 LIST_INSERT_HEAD(head, stcb, sctp_asocs);
2787 if ((err = sctp_add_remote_addr(stcb, firstaddr, 1, 1))) {
2794 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asoc, stcb);
2801 SCTP_TCB_LOCK_DESTROY (stcb);
2812 LIST_INSERT_HEAD(&inp->sctp_asoc_list, stcb, sctp_tcblist);
2819 head = &inp->sctp_tcbhash[SCTP_PCBHASH_ALLADDR(stcb->rport,
2821 LIST_INSERT_HEAD(head, stcb, sctp_tcbhash);
2829 printf("Association %p now allocated\n", stcb);
2832 return (stcb);
2859 sctp_del_remote_addr(struct sctp_tcb *stcb, struct sockaddr *remaddr)
2871 asoc = &stcb->asoc;
2893 sctp_find_alternate_net(stcb, lnet);
2977 sctp_iterator_asoc_being_freed(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
2992 SCTP_TCB_LOCK(stcb);
2994 it = stcb->asoc.stcb_starting_point_for_iterator;
2998 if (it->inp != stcb->sctp_ep) {
3002 if (it->stcb != stcb) {
3005 it->stcb = LIST_NEXT(stcb, sctp_tcblist);
3006 if (it->stcb == NULL) {
3021 sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
3033 if (stcb->asoc.state == 0) {
3035 stcb);
3039 asoc = &stcb->asoc;
3067 SCTP_TCB_UNLOCK(stcb);
3068 sctp_iterator_asoc_being_freed(inp, stcb);
3072 if (sq->tcb == stcb) {
3077 if (inp->sctp_tcb_at_block == (void *)stcb) {
3082 LIST_REMOVE(stcb, sctp_tcbhash);
3085 LIST_REMOVE(stcb, sctp_tcblist);
3091 LIST_REMOVE(stcb, sctp_asocs);
3298 SCTP_TCB_LOCK_DESTROY(stcb);
3301 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asoc, stcb);
3345 sctp_destination_is_reachable(struct sctp_tcb *stcb, const struct sockaddr *destaddr)
3361 inp = stcb->sctp_ep;
3468 sctp_select_primary_destination(struct sctp_tcb *stcb)
3472 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
3476 if (sctp_destination_is_reachable(stcb,
3479 stcb->asoc.primary_destination = net;
3518 struct sctp_tcb *stcb;
3526 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
3527 if (stcb->asoc.last_used_address == laddr)
3529 stcb->asoc.last_used_address = NULL;
3538 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
3540 SCTP_TCB_LOCK(stcb);
3541 if (sctp_destination_is_reachable(stcb,
3542 rtcache_getdst(&stcb->asoc.primary_destination->ro)) == 0) {
3543 sctp_select_primary_destination(stcb);
3545 SCTP_TCB_UNLOCK(stcb);
3558 sctp_add_local_addr_assoc(struct sctp_tcb *stcb, struct ifaddr *ifa)
3578 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list, sctp_nxt_addr) {
3585 error = sctp_insert_laddr(&stcb->asoc.sctp_local_addr_list, ifa);
3639 sctp_del_local_addr_assoc(struct sctp_tcb *stcb, struct ifaddr *ifa)
3657 inp = stcb->sctp_ep;
3661 if (stcb->asoc.numnets < 2) {
3667 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list, sctp_nxt_addr) {
3686 sctp_del_local_addr_assoc_sa(struct sctp_tcb *stcb, struct sockaddr *sa)
3698 inp = stcb->sctp_ep;
3702 if (stcb->asoc.numnets < 2) {
3708 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list, sctp_nxt_addr) {
3893 sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m,
3924 sin.sin_port = stcb->rport;
3928 sin6.sin6_port = stcb->rport;
3966 stcb->asoc.ecn_allowed = 0;
3968 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
3973 l_inp = inp = stcb->sctp_ep;
3974 stcb_tmp = sctp_findassociation_ep_addr(&inp, sa, &net_tmp, local_sa, stcb);
3975 if ((stcb_tmp == NULL && inp == stcb->sctp_ep) || inp == NULL) {
3979 (stcb->asoc.ipv4_addr_legal)) {
3980 if (sctp_add_remote_addr(stcb, sa, 0, 2)) {
3984 (stcb->asoc.ipv6_addr_legal)) {
3985 if (sctp_add_remote_addr(stcb, sa, 0, 3)) {
3990 if (net_tmp != NULL && stcb_tmp == stcb) {
3992 } else if (stcb_tmp != stcb) {
4004 if (stcb->asoc.state == 0) {
4022 (stcb->asoc.ipv4_addr_legal)) {
4034 inp = stcb->sctp_ep;
4036 local_sa, stcb);
4038 stcb->sctp_ep) ||
4048 if (stcb->asoc.state == 0) {
4052 if (sctp_add_remote_addr(stcb, sa, 0, 4)) {
4055 } else if (stcb_tmp == stcb) {
4060 if (stcb->asoc.state == 0) {
4080 if (stcb->asoc.state == 0) {
4085 SCTP_TCB_LOCK(stcb);
4086 SCTP_INP_RUNLOCK(stcb->sctp_ep);
4090 (stcb->asoc.ipv6_addr_legal)) {
4103 inp = stcb->sctp_ep;
4105 local_sa, stcb);
4106 if (stcb_tmp == NULL && (inp == stcb->sctp_ep ||
4113 if (stcb->asoc.state == 0) {
4118 if (sctp_add_remote_addr(stcb, sa, 0, 5)) {
4121 } else if (stcb_tmp == stcb) {
4127 if (stcb->asoc.state == 0) {
4148 if (stcb->asoc.state == 0) {
4153 SCTP_TCB_LOCK(stcb);
4158 stcb->asoc.ecn_allowed = 1;
4160 if (stcb->asoc.state != SCTP_STATE_OPEN) {
4167 stcb, ntohl(aip->indication), NULL);
4175 stcb->asoc.peer_supports_asconf = 1;
4176 stcb->asoc.peer_supports_asconf_setprim = 1;
4213 sctp_set_primary_addr(stcb, sa, NULL);
4218 stcb->asoc.peer_supports_prsctp = 1;
4230 stcb->asoc.peer_supports_asconf = 0;
4231 stcb->asoc.peer_supports_asconf_setprim = 0;
4232 stcb->asoc.peer_supports_prsctp = 0;
4233 stcb->asoc.peer_supports_pktdrop = 0;
4234 stcb->asoc.peer_supports_strreset = 0;
4240 stcb->asoc.peer_supports_asconf = 1;
4241 stcb->asoc.peer_supports_asconf_setprim = 1;
4244 stcb->asoc.peer_supports_asconf = 1;
4245 stcb->asoc.peer_supports_asconf_setprim = 1;
4248 stcb->asoc.peer_supports_prsctp = 1;
4251 stcb->asoc.peer_supports_pktdrop = 1;
4254 stcb->asoc.peer_supports_strreset = 1;
4264 stcb->asoc.peer_supports_ecn_nonce = 1;
4265 stcb->asoc.ecn_nonce_allowed = 1;
4294 for (net = TAILQ_FIRST(&stcb->asoc.nets); net != NULL; net = net_tmp) {
4300 stcb->asoc.numnets--;
4301 TAILQ_REMOVE(&stcb->asoc.nets, net, sctp_next);
4303 if (net == stcb->asoc.primary_destination) {
4304 stcb->asoc.primary_destination = NULL;
4305 sctp_select_primary_destination(stcb);
4313 sctp_set_primary_addr(struct sctp_tcb *stcb, struct sockaddr *sa,
4318 net = sctp_findnet(stcb, sa);
4329 stcb->asoc.primary_destination = net;
4349 struct sctp_tcb *stcb;
4362 LIST_FOREACH(stcb, head, sctp_asocs) {
4363 if (stcb->asoc.my_vtag == tag) {
4369 if (inp == stcb->sctp_ep) {
4486 sctp_drain_mbufs(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
4498 asoc = &stcb->asoc;
4612 struct sctp_tcb *stcb;
4618 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4620 SCTP_TCB_LOCK(stcb);
4621 sctp_drain_mbufs(inp, stcb);
4622 SCTP_TCB_UNLOCK(stcb);
4630 sctp_add_to_socket_q(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
4635 if ((inp == NULL) || (stcb == NULL)) {
4647 if (stcb)
4648 stcb->asoc.cnt_msg_on_sb++;
4649 sq->tcb = stcb;
4658 struct sctp_tcb *stcb = NULL;
4666 stcb = sq->tcb;
4671 if (stcb) {
4672 stcb->asoc.cnt_msg_on_sb--;
4674 return (stcb);