Lines Matching +full:disconnection +full:- +full:compensate
5 /*-
6 * Copyright (c) 1996-1999 Whistle Communications, Inc.
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
121 #define PPTP_MAX_PAYLOAD (0xffff - sizeof(struct greheader) - 8)
135 we can piggy-back the ACK off of. These parameters determine the minimum
147 #define PPTP_SEQ_DIFF(x,y) ((int32_t)(x) - (int32_t)(y))
150 #define SESSHASH(x) (((x) ^ ((x) >> 8)) & (SESSHASHSIZE - 1))
191 int32_t ato; /* adaptive time-out value */
334 mtx_init(&priv->uppersess.mtx, "ng_pptp", NULL, MTX_DEF); in ng_pptpgre_constructor()
335 ng_callout_init(&priv->uppersess.sackTimer); in ng_pptpgre_constructor()
336 ng_callout_init(&priv->uppersess.rackTimer); in ng_pptpgre_constructor()
337 priv->uppersess.node = node; in ng_pptpgre_constructor()
339 SLIST_INIT(&priv->uppersess.roq); in ng_pptpgre_constructor()
340 priv->uppersess.roq_len = 0; in ng_pptpgre_constructor()
341 ng_callout_init(&priv->uppersess.reorderTimer); in ng_pptpgre_constructor()
344 LIST_INIT(&priv->sesshash[i]); in ng_pptpgre_constructor()
346 LIST_INSERT_HEAD(&priv->sesshash[0], &priv->uppersess, sessions); in ng_pptpgre_constructor()
362 priv->upper = hook; in ng_pptpgre_newhook()
363 priv->uppersess.hook = hook; in ng_pptpgre_newhook()
364 NG_HOOK_SET_PRIVATE(hook, &priv->uppersess); in ng_pptpgre_newhook()
366 priv->lower = hook; in ng_pptpgre_newhook()
377 sizeof(NG_PPTPGRE_HOOK_SESSION_P) - 1) != 0) in ng_pptpgre_newhook()
379 hex = name + sizeof(NG_PPTPGRE_HOOK_SESSION_P) - 1; in ng_pptpgre_newhook()
394 mtx_init(&hpriv->mtx, "ng_pptp", NULL, MTX_DEF); in ng_pptpgre_newhook()
395 ng_callout_init(&hpriv->sackTimer); in ng_pptpgre_newhook()
396 ng_callout_init(&hpriv->rackTimer); in ng_pptpgre_newhook()
397 hpriv->conf.cid = cid; in ng_pptpgre_newhook()
398 hpriv->node = node; in ng_pptpgre_newhook()
399 hpriv->hook = hook; in ng_pptpgre_newhook()
401 SLIST_INIT(&hpriv->roq); in ng_pptpgre_newhook()
402 hpriv->roq_len = 0; in ng_pptpgre_newhook()
403 ng_callout_init(&hpriv->reorderTimer); in ng_pptpgre_newhook()
408 LIST_INSERT_HEAD(&priv->sesshash[hash], hpriv, sessions); in ng_pptpgre_newhook()
426 switch (msg->header.typecookie) { in ng_pptpgre_rcvmsg()
428 switch (msg->header.cmd) { in ng_pptpgre_rcvmsg()
432 (struct ng_pptpgre_conf *) msg->data; in ng_pptpgre_rcvmsg()
437 if (msg->header.arglen != sizeof(*newConf)) in ng_pptpgre_rcvmsg()
440 hpriv = ng_pptpgre_find_session(priv, newConf->cid); in ng_pptpgre_rcvmsg()
441 /* If not present - use upper. */ in ng_pptpgre_rcvmsg()
443 hpriv = &priv->uppersess; in ng_pptpgre_rcvmsg()
445 hash = SESSHASH(newConf->cid); in ng_pptpgre_rcvmsg()
446 LIST_INSERT_HEAD(&priv->sesshash[hash], hpriv, in ng_pptpgre_rcvmsg()
450 hpriv->conf = *newConf; in ng_pptpgre_rcvmsg()
457 if (msg->header.arglen == 2) { in ng_pptpgre_rcvmsg()
460 *((uint16_t *)msg->data)); in ng_pptpgre_rcvmsg()
463 } else if (msg->header.arglen == 0) { in ng_pptpgre_rcvmsg()
465 hpriv = &priv->uppersess; in ng_pptpgre_rcvmsg()
468 NG_MKRESPONSE(resp, msg, sizeof(hpriv->conf), M_NOWAIT); in ng_pptpgre_rcvmsg()
471 bcopy(&hpriv->conf, resp->data, sizeof(hpriv->conf)); in ng_pptpgre_rcvmsg()
478 if (msg->header.cmd != NGM_PPTPGRE_CLR_STATS) { in ng_pptpgre_rcvmsg()
480 sizeof(priv->stats), M_NOWAIT); in ng_pptpgre_rcvmsg()
483 bcopy(&priv->stats, in ng_pptpgre_rcvmsg()
484 resp->data, sizeof(priv->stats)); in ng_pptpgre_rcvmsg()
486 if (msg->header.cmd != NGM_PPTPGRE_GET_STATS) in ng_pptpgre_rcvmsg()
487 bzero(&priv->stats, sizeof(priv->stats)); in ng_pptpgre_rcvmsg()
515 if (!hpriv->conf.enabled) { in ng_pptpgre_rcvdata()
520 mtx_lock(&hpriv->mtx); in ng_pptpgre_rcvdata()
524 mtx_assert(&hpriv->mtx, MA_NOTOWNED); in ng_pptpgre_rcvdata()
530 * Hook disconnection
540 if (hook == priv->upper) { in ng_pptpgre_disconnect()
541 priv->upper = NULL; in ng_pptpgre_disconnect()
542 priv->uppersess.hook = NULL; in ng_pptpgre_disconnect()
543 } else if (hook == priv->lower) { in ng_pptpgre_disconnect()
544 priv->lower = NULL; in ng_pptpgre_disconnect()
550 mtx_destroy(&hpriv->mtx); in ng_pptpgre_disconnect()
570 ng_pptpgre_reset(&priv->uppersess); in ng_pptpgre_shutdown()
572 LIST_REMOVE(&priv->uppersess, sessions); in ng_pptpgre_shutdown()
573 mtx_destroy(&priv->uppersess.mtx); in ng_pptpgre_shutdown()
592 const priv_p priv = NG_NODE_PRIVATE(hpriv->node); in ng_pptpgre_xmit()
598 mtx_assert(&hpriv->mtx, MA_OWNED); in ng_pptpgre_xmit()
608 if (hpriv->conf.enableWindowing) { in ng_pptpgre_xmit()
610 if ((u_int32_t)PPTP_SEQ_DIFF(hpriv->xmitSeq, in ng_pptpgre_xmit()
611 hpriv->recvAck) >= hpriv->xmitWin) { in ng_pptpgre_xmit()
612 priv->stats.xmitDrops++; in ng_pptpgre_xmit()
618 if (m->m_pkthdr.len > PPTP_MAX_PAYLOAD) { in ng_pptpgre_xmit()
619 priv->stats.xmitTooBig++; in ng_pptpgre_xmit()
623 priv->stats.xmitLoneAcks++; in ng_pptpgre_xmit()
628 be16enc(&gre->length, (m != NULL) ? m->m_pkthdr.len : 0); in ng_pptpgre_xmit()
629 be16enc(&gre->cid, hpriv->conf.peerCid); in ng_pptpgre_xmit()
633 gre->hasSeq = 1; in ng_pptpgre_xmit()
634 if (hpriv->conf.enableWindowing) { in ng_pptpgre_xmit()
635 hpriv->timeSent[hpriv->xmitSeq - hpriv->recvAck] in ng_pptpgre_xmit()
638 hpriv->xmitSeq++; in ng_pptpgre_xmit()
639 be32enc(&gre->data[0], hpriv->xmitSeq); in ng_pptpgre_xmit()
643 if (hpriv->conf.enableAlwaysAck || hpriv->xmitAck != hpriv->recvSeq) { in ng_pptpgre_xmit()
644 gre->hasAck = 1; in ng_pptpgre_xmit()
645 be32enc(&gre->data[gre->hasSeq], hpriv->recvSeq); in ng_pptpgre_xmit()
646 hpriv->xmitAck = hpriv->recvSeq; in ng_pptpgre_xmit()
647 if (hpriv->conf.enableDelayedAck) in ng_pptpgre_xmit()
648 ng_uncallout(&hpriv->sackTimer, hpriv->node); in ng_pptpgre_xmit()
652 grelen = sizeof(*gre) + sizeof(u_int32_t) * (gre->hasSeq + gre->hasAck); in ng_pptpgre_xmit()
656 priv->stats.memoryFailures++; in ng_pptpgre_xmit()
659 m->m_len = m->m_pkthdr.len = grelen; in ng_pptpgre_xmit()
660 m->m_pkthdr.rcvif = NULL; in ng_pptpgre_xmit()
663 if (m == NULL || (m->m_len < grelen in ng_pptpgre_xmit()
665 priv->stats.memoryFailures++; in ng_pptpgre_xmit()
672 priv->stats.xmitPackets++; in ng_pptpgre_xmit()
673 priv->stats.xmitOctets += m->m_pkthdr.len; in ng_pptpgre_xmit()
679 if (hpriv->conf.enableWindowing && in ng_pptpgre_xmit()
680 gre->hasSeq && hpriv->xmitSeq == hpriv->recvAck + 1) in ng_pptpgre_xmit()
683 mtx_unlock(&hpriv->mtx); in ng_pptpgre_xmit()
687 NG_FWD_NEW_DATA(error, item, priv->lower, m); in ng_pptpgre_xmit()
689 NG_SEND_DATA_ONLY(error, priv->lower, m); in ng_pptpgre_xmit()
695 mtx_unlock(&hpriv->mtx); in ng_pptpgre_xmit()
705 mtx_assert(&hpriv->mtx, MA_OWNED); in ng_pptpgre_ack()
706 if (!(callout_pending(&hpriv->sackTimer))) { in ng_pptpgre_ack()
708 if (!hpriv->conf.enableDelayedAck) { /* ack now */ in ng_pptpgre_ack()
715 mtx_unlock(&hpriv->mtx); in ng_pptpgre_ack()
718 mtx_unlock(&hpriv->mtx); in ng_pptpgre_ack()
733 mtx_assert(&hpriv->mtx, MA_NOTOWNED); in ng_pptpgre_sendq()
737 NGI_GET_M(np->item, m); in ng_pptpgre_sendq()
738 NG_FWD_NEW_DATA(error, np->item, hpriv->hook, m); in ng_pptpgre_sendq()
769 priv->stats.recvPackets++; in ng_pptpgre_rcvdata_lower()
770 priv->stats.recvOctets += m->m_pkthdr.len; in ng_pptpgre_rcvdata_lower()
773 if (m->m_pkthdr.len < sizeof(*ip) + sizeof(*gre)) { in ng_pptpgre_rcvdata_lower()
774 priv->stats.recvRunts++; in ng_pptpgre_rcvdata_lower()
779 if (m->m_len < sizeof(*ip) + sizeof(*gre)) { in ng_pptpgre_rcvdata_lower()
781 priv->stats.memoryFailures++; in ng_pptpgre_rcvdata_lower()
788 iphlen = ip->ip_hl << 2; in ng_pptpgre_rcvdata_lower()
789 if (m->m_len < iphlen + sizeof(*gre)) { in ng_pptpgre_rcvdata_lower()
791 priv->stats.memoryFailures++; in ng_pptpgre_rcvdata_lower()
799 grelen = sizeof(*gre) + sizeof(u_int32_t) * (gre->hasSeq + gre->hasAck); in ng_pptpgre_rcvdata_lower()
800 if (m->m_pkthdr.len < iphlen + grelen) { in ng_pptpgre_rcvdata_lower()
801 priv->stats.recvRunts++; in ng_pptpgre_rcvdata_lower()
804 if (m->m_len < iphlen + grelen) { in ng_pptpgre_rcvdata_lower()
806 priv->stats.memoryFailures++; in ng_pptpgre_rcvdata_lower()
816 extralen = m->m_pkthdr.len in ng_pptpgre_rcvdata_lower()
817 - (iphlen + grelen + gre->hasSeq * be16dec(&gre->length)); in ng_pptpgre_rcvdata_lower()
819 priv->stats.recvBadGRE++; in ng_pptpgre_rcvdata_lower()
823 priv->stats.recvBadGRE++; in ng_pptpgre_rcvdata_lower()
827 hpriv = ng_pptpgre_find_session(priv, be16dec(&gre->cid)); in ng_pptpgre_rcvdata_lower()
828 if (hpriv == NULL || hpriv->hook == NULL || !hpriv->conf.enabled) { in ng_pptpgre_rcvdata_lower()
829 priv->stats.recvBadCID++; in ng_pptpgre_rcvdata_lower()
832 mtx_lock(&hpriv->mtx); in ng_pptpgre_rcvdata_lower()
835 if (gre->hasAck) { in ng_pptpgre_rcvdata_lower()
836 const u_int32_t ack = be32dec(&gre->data[gre->hasSeq]); in ng_pptpgre_rcvdata_lower()
837 const int index = ack - hpriv->recvAck - 1; in ng_pptpgre_rcvdata_lower()
841 if (PPTP_SEQ_DIFF(ack, hpriv->xmitSeq) > 0) { in ng_pptpgre_rcvdata_lower()
842 priv->stats.recvBadAcks++; in ng_pptpgre_rcvdata_lower()
845 if (PPTP_SEQ_DIFF(ack, hpriv->recvAck) <= 0) in ng_pptpgre_rcvdata_lower()
847 hpriv->recvAck = ack; in ng_pptpgre_rcvdata_lower()
850 if (hpriv->conf.enableWindowing) { in ng_pptpgre_rcvdata_lower()
851 sample = ng_pptpgre_time() - hpriv->timeSent[index]; in ng_pptpgre_rcvdata_lower()
852 diff = sample - hpriv->rtt; in ng_pptpgre_rcvdata_lower()
853 hpriv->rtt += PPTP_ACK_ALPHA(diff); in ng_pptpgre_rcvdata_lower()
855 diff = -diff; in ng_pptpgre_rcvdata_lower()
856 hpriv->dev += PPTP_ACK_BETA(diff - hpriv->dev); in ng_pptpgre_rcvdata_lower()
857 /* +2 to compensate low precision of int math */ in ng_pptpgre_rcvdata_lower()
858 hpriv->ato = hpriv->rtt + PPTP_ACK_CHI(hpriv->dev + 2); in ng_pptpgre_rcvdata_lower()
859 if (hpriv->ato > PPTP_MAX_TIMEOUT) in ng_pptpgre_rcvdata_lower()
860 hpriv->ato = PPTP_MAX_TIMEOUT; in ng_pptpgre_rcvdata_lower()
861 else if (hpriv->ato < PPTP_MIN_TIMEOUT) in ng_pptpgre_rcvdata_lower()
862 hpriv->ato = PPTP_MIN_TIMEOUT; in ng_pptpgre_rcvdata_lower()
865 bcopy(hpriv->timeSent + index + 1, hpriv->timeSent, in ng_pptpgre_rcvdata_lower()
866 sizeof(*hpriv->timeSent) in ng_pptpgre_rcvdata_lower()
867 * (PPTP_XMIT_WIN - (index + 1))); in ng_pptpgre_rcvdata_lower()
870 if (PPTP_SEQ_DIFF(ack, hpriv->winAck) >= 0 in ng_pptpgre_rcvdata_lower()
871 && hpriv->xmitWin < PPTP_XMIT_WIN) { in ng_pptpgre_rcvdata_lower()
872 hpriv->xmitWin++; in ng_pptpgre_rcvdata_lower()
873 hpriv->winAck = ack + hpriv->xmitWin; in ng_pptpgre_rcvdata_lower()
877 ng_uncallout(&hpriv->rackTimer, hpriv->node); in ng_pptpgre_rcvdata_lower()
878 if (hpriv->recvAck != hpriv->xmitSeq) in ng_pptpgre_rcvdata_lower()
885 if (!gre->hasSeq) { /* no data to deliver */ in ng_pptpgre_rcvdata_lower()
886 priv->stats.recvLoneAcks++; in ng_pptpgre_rcvdata_lower()
887 mtx_unlock(&hpriv->mtx); in ng_pptpgre_rcvdata_lower()
891 seq = be32dec(&gre->data[0]); in ng_pptpgre_rcvdata_lower()
893 diff = PPTP_SEQ_DIFF(seq, hpriv->recvSeq); in ng_pptpgre_rcvdata_lower()
896 priv->stats.recvOutOfOrder++; /* late */ in ng_pptpgre_rcvdata_lower()
898 priv->stats.recvDuplicates++; /* duplicate */ in ng_pptpgre_rcvdata_lower()
899 mtx_unlock(&hpriv->mtx); in ng_pptpgre_rcvdata_lower()
906 m_adj(m, -extralen); in ng_pptpgre_rcvdata_lower()
913 hpriv->recvSeq = seq; \ in ng_pptpgre_rcvdata_lower()
927 prev = SLIST_FIRST(&hpriv->roq); in ng_pptpgre_rcvdata_lower()
928 SLIST_FOREACH(np, &hpriv->roq, next) { in ng_pptpgre_rcvdata_lower()
929 diff = PPTP_SEQ_DIFF(np->seq, seq); in ng_pptpgre_rcvdata_lower()
931 priv->stats.recvDuplicates++; in ng_pptpgre_rcvdata_lower()
932 mtx_unlock(&hpriv->mtx); in ng_pptpgre_rcvdata_lower()
943 priv->stats.recvOutOfOrder++; /* duplicate not found */ in ng_pptpgre_rcvdata_lower()
944 if (hpriv->roq_len < reorder_max) in ng_pptpgre_rcvdata_lower()
950 * It the latter case, we may still have non-empty reorder queue in ng_pptpgre_rcvdata_lower()
956 priv->stats.recvReorderOverflow++; in ng_pptpgre_rcvdata_lower()
966 np = SLIST_FIRST(&hpriv->roq); in ng_pptpgre_rcvdata_lower()
969 SLIST_REMOVE_HEAD(&hpriv->roq, next); in ng_pptpgre_rcvdata_lower()
970 hpriv->roq_len--; /* we are allowed to use malloc() now */ in ng_pptpgre_rcvdata_lower()
973 hpriv->recvSeq = np->seq; in ng_pptpgre_rcvdata_lower()
978 priv->stats.memoryFailures++; in ng_pptpgre_rcvdata_lower()
984 while (!SLIST_EMPTY(&hpriv->roq)) { in ng_pptpgre_rcvdata_lower()
985 np = SLIST_FIRST(&hpriv->roq); in ng_pptpgre_rcvdata_lower()
986 if (np->seq > seq) in ng_pptpgre_rcvdata_lower()
988 SLIST_REMOVE_HEAD(&hpriv->roq, next); in ng_pptpgre_rcvdata_lower()
989 hpriv->roq_len--; in ng_pptpgre_rcvdata_lower()
1001 hpriv->recvSeq = seq; in ng_pptpgre_rcvdata_lower()
1004 NG_FWD_NEW_DATA(error, item, hpriv->hook, m); in ng_pptpgre_rcvdata_lower()
1009 np->item = item; in ng_pptpgre_rcvdata_lower()
1010 np->seq = seq; in ng_pptpgre_rcvdata_lower()
1012 SLIST_INSERT_HEAD(&hpriv->roq, np, next); in ng_pptpgre_rcvdata_lower()
1015 hpriv->roq_len++; in ng_pptpgre_rcvdata_lower()
1019 while (!SLIST_EMPTY(&hpriv->roq)) { in ng_pptpgre_rcvdata_lower()
1020 np = SLIST_FIRST(&hpriv->roq); in ng_pptpgre_rcvdata_lower()
1021 if (PPTP_SEQ_DIFF(np->seq, hpriv->recvSeq) > 1) in ng_pptpgre_rcvdata_lower()
1025 SLIST_REMOVE_HEAD(&hpriv->roq, next); in ng_pptpgre_rcvdata_lower()
1026 hpriv->roq_len--; in ng_pptpgre_rcvdata_lower()
1027 hpriv->recvSeq = np->seq; in ng_pptpgre_rcvdata_lower()
1036 if (SLIST_EMPTY(&hpriv->roq)) { in ng_pptpgre_rcvdata_lower()
1037 if (callout_pending(&hpriv->reorderTimer)) in ng_pptpgre_rcvdata_lower()
1038 ng_uncallout(&hpriv->reorderTimer, hpriv->node); in ng_pptpgre_rcvdata_lower()
1040 if (!callout_pending(&hpriv->reorderTimer)) in ng_pptpgre_rcvdata_lower()
1046 mtx_unlock(&hpriv->mtx); in ng_pptpgre_rcvdata_lower()
1077 remain = (hpriv->timeSent[0] + hpriv->ato) - ng_pptpgre_time(); in ng_pptpgre_start_recv_ack_timer()
1083 ng_callout(&hpriv->rackTimer, hpriv->node, hpriv->hook, in ng_pptpgre_start_recv_ack_timer()
1099 priv->stats.recvAckTimeouts++; in ng_pptpgre_recv_ack_timeout()
1100 hpriv->rtt = PPTP_ACK_DELTA(hpriv->rtt) + 1; /* +1 to avoid delta*0 case */ in ng_pptpgre_recv_ack_timeout()
1101 hpriv->ato = hpriv->rtt + PPTP_ACK_CHI(hpriv->dev); in ng_pptpgre_recv_ack_timeout()
1102 if (hpriv->ato > PPTP_MAX_TIMEOUT) in ng_pptpgre_recv_ack_timeout()
1103 hpriv->ato = PPTP_MAX_TIMEOUT; in ng_pptpgre_recv_ack_timeout()
1104 else if (hpriv->ato < PPTP_MIN_TIMEOUT) in ng_pptpgre_recv_ack_timeout()
1105 hpriv->ato = PPTP_MIN_TIMEOUT; in ng_pptpgre_recv_ack_timeout()
1108 hpriv->recvAck = hpriv->xmitSeq; /* pretend we got the ack */ in ng_pptpgre_recv_ack_timeout()
1109 hpriv->xmitWin = (hpriv->xmitWin + 1) / 2; /* shrink transmit window */ in ng_pptpgre_recv_ack_timeout()
1110 hpriv->winAck = hpriv->recvAck + hpriv->xmitWin; /* reset win expand time */ in ng_pptpgre_recv_ack_timeout()
1123 ackTimeout = (hpriv->rtt >> 2); in ng_pptpgre_start_send_ack_timer()
1131 ng_callout(&hpriv->sackTimer, hpriv->node, hpriv->hook, in ng_pptpgre_start_send_ack_timer()
1146 mtx_lock(&hpriv->mtx); in ng_pptpgre_send_ack_timeout()
1149 mtx_assert(&hpriv->mtx, MA_NOTOWNED); in ng_pptpgre_send_ack_timeout()
1162 ticks = (((reorder_timeout * hz) + 1000 - 1) / 1000) + 1; in ng_pptpgre_start_reorder_timer()
1163 ng_callout(&hpriv->reorderTimer, hpriv->node, hpriv->hook, in ng_pptpgre_start_reorder_timer()
1179 priv->stats.recvReorderTimeouts++; in ng_pptpgre_reorder_timeout()
1180 mtx_lock(&hpriv->mtx); in ng_pptpgre_reorder_timeout()
1181 if (SLIST_EMPTY(&hpriv->roq)) { /* should not happen */ in ng_pptpgre_reorder_timeout()
1182 mtx_unlock(&hpriv->mtx); in ng_pptpgre_reorder_timeout()
1186 last = np = SLIST_FIRST(&hpriv->roq); in ng_pptpgre_reorder_timeout()
1187 hpriv->roq_len--; in ng_pptpgre_reorder_timeout()
1188 SLIST_REMOVE_HEAD(&hpriv->roq, next); in ng_pptpgre_reorder_timeout()
1192 while (!SLIST_EMPTY(&hpriv->roq)) { in ng_pptpgre_reorder_timeout()
1193 np = SLIST_FIRST(&hpriv->roq); in ng_pptpgre_reorder_timeout()
1194 if (PPTP_SEQ_DIFF(np->seq, last->seq) > 1) in ng_pptpgre_reorder_timeout()
1198 hpriv->roq_len--; in ng_pptpgre_reorder_timeout()
1199 SLIST_REMOVE_HEAD(&hpriv->roq, next); in ng_pptpgre_reorder_timeout()
1204 hpriv->recvSeq = last->seq; in ng_pptpgre_reorder_timeout()
1205 if (!SLIST_EMPTY(&hpriv->roq)) in ng_pptpgre_reorder_timeout()
1211 mtx_assert(&hpriv->mtx, MA_NOTOWNED); in ng_pptpgre_reorder_timeout()
1227 LIST_FOREACH(hpriv, &privp->sesshash[hash], sessions) { in ng_pptpgre_find_session()
1228 if (hpriv->conf.cid == cid) in ng_pptpgre_find_session()
1244 hpriv->ato = PPTP_MAX_TIMEOUT; in ng_pptpgre_reset()
1245 hpriv->rtt = PPTP_TIME_SCALE / 10; in ng_pptpgre_reset()
1246 if (hpriv->conf.peerPpd > 1) /* ppd = 0 treat as = 1 */ in ng_pptpgre_reset()
1247 hpriv->rtt *= hpriv->conf.peerPpd; in ng_pptpgre_reset()
1248 hpriv->dev = 0; in ng_pptpgre_reset()
1249 hpriv->xmitWin = (hpriv->conf.recvWin + 1) / 2; in ng_pptpgre_reset()
1250 if (hpriv->xmitWin < 2) /* often the first packet is lost */ in ng_pptpgre_reset()
1251 hpriv->xmitWin = 2; /* because the peer isn't ready */ in ng_pptpgre_reset()
1252 else if (hpriv->xmitWin > PPTP_XMIT_WIN) in ng_pptpgre_reset()
1253 hpriv->xmitWin = PPTP_XMIT_WIN; in ng_pptpgre_reset()
1254 hpriv->winAck = hpriv->xmitWin; in ng_pptpgre_reset()
1257 hpriv->recvSeq = ~0; in ng_pptpgre_reset()
1258 hpriv->recvAck = ~0; in ng_pptpgre_reset()
1259 hpriv->xmitSeq = ~0; in ng_pptpgre_reset()
1260 hpriv->xmitAck = ~0; in ng_pptpgre_reset()
1263 ng_uncallout(&hpriv->sackTimer, hpriv->node); in ng_pptpgre_reset()
1264 ng_uncallout(&hpriv->rackTimer, hpriv->node); in ng_pptpgre_reset()
1265 ng_uncallout(&hpriv->reorderTimer, hpriv->node); in ng_pptpgre_reset()
1268 while (!SLIST_EMPTY(&hpriv->roq)) { in ng_pptpgre_reset()
1269 np = SLIST_FIRST(&hpriv->roq); in ng_pptpgre_reset()
1270 SLIST_REMOVE_HEAD(&hpriv->roq, next); in ng_pptpgre_reset()
1271 NG_FREE_ITEM(np->item); in ng_pptpgre_reset()
1274 hpriv->roq_len = 0; in ng_pptpgre_reset()