Deleted Added
full compact
ng_pptpgre.c (243882) ng_pptpgre.c (298649)
1/*
2 * ng_pptpgre.c
3 */
4
5/*-
6 * Copyright (c) 1996-1999 Whistle Communications, Inc.
7 * All rights reserved.
8 *

--- 23 unchanged lines hidden (view full) ---

32 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
36 * OF SUCH DAMAGE.
37 *
38 * Author: Archie Cobbs <archie@freebsd.org>
39 *
1/*
2 * ng_pptpgre.c
3 */
4
5/*-
6 * Copyright (c) 1996-1999 Whistle Communications, Inc.
7 * All rights reserved.
8 *

--- 23 unchanged lines hidden (view full) ---

32 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
36 * OF SUCH DAMAGE.
37 *
38 * Author: Archie Cobbs <archie@freebsd.org>
39 *
40 * $FreeBSD: head/sys/netgraph/ng_pptpgre.c 243882 2012-12-05 08:04:20Z glebius $
40 * $FreeBSD: head/sys/netgraph/ng_pptpgre.c 298649 2016-04-26 15:38:17Z pfg $
41 * $Whistle: ng_pptpgre.c,v 1.7 1999/12/08 00:10:06 archie Exp $
42 */
43
44/*
45 * PPTP/GRE netgraph node type.
46 *
47 * This node type does the GRE encapsulation as specified for the PPTP
48 * protocol (RFC 2637, section 4). This includes sequencing and

--- 792 unchanged lines hidden (view full) ---

841
842 /* Compute how long until oldest unack'd packet times out,
843 and reset the timer to that time. */
844 remain = (hpriv->timeSent[0] + hpriv->ato) - ng_pptpgre_time();
845 if (remain < 0)
846 remain = 0;
847
848 /* Be conservative: timeout can happen up to 1 tick early */
41 * $Whistle: ng_pptpgre.c,v 1.7 1999/12/08 00:10:06 archie Exp $
42 */
43
44/*
45 * PPTP/GRE netgraph node type.
46 *
47 * This node type does the GRE encapsulation as specified for the PPTP
48 * protocol (RFC 2637, section 4). This includes sequencing and

--- 792 unchanged lines hidden (view full) ---

841
842 /* Compute how long until oldest unack'd packet times out,
843 and reset the timer to that time. */
844 remain = (hpriv->timeSent[0] + hpriv->ato) - ng_pptpgre_time();
845 if (remain < 0)
846 remain = 0;
847
848 /* Be conservative: timeout can happen up to 1 tick early */
849 ticks = (((remain * hz) + PPTP_TIME_SCALE - 1) / PPTP_TIME_SCALE) + 1;
849 ticks = howmany(remain * hz, PPTP_TIME_SCALE) + 1;
850 ng_callout(&hpriv->rackTimer, hpriv->node, hpriv->hook,
851 ticks, ng_pptpgre_recv_ack_timeout, hpriv, 0);
852}
853
854/*
855 * The peer has failed to acknowledge the oldest unacknowledged sequence
856 * number within the time allotted. Update our adaptive timeout parameters
857 * and reset/restart the recv ack timer.

--- 31 unchanged lines hidden (view full) ---

889 /* Take 1/4 of the estimated round trip time */
890 ackTimeout = (hpriv->rtt >> 2);
891 if (ackTimeout < PPTP_MIN_ACK_DELAY)
892 ackTimeout = PPTP_MIN_ACK_DELAY;
893 else if (ackTimeout > PPTP_MAX_ACK_DELAY)
894 ackTimeout = PPTP_MAX_ACK_DELAY;
895
896 /* Be conservative: timeout can happen up to 1 tick early */
850 ng_callout(&hpriv->rackTimer, hpriv->node, hpriv->hook,
851 ticks, ng_pptpgre_recv_ack_timeout, hpriv, 0);
852}
853
854/*
855 * The peer has failed to acknowledge the oldest unacknowledged sequence
856 * number within the time allotted. Update our adaptive timeout parameters
857 * and reset/restart the recv ack timer.

--- 31 unchanged lines hidden (view full) ---

889 /* Take 1/4 of the estimated round trip time */
890 ackTimeout = (hpriv->rtt >> 2);
891 if (ackTimeout < PPTP_MIN_ACK_DELAY)
892 ackTimeout = PPTP_MIN_ACK_DELAY;
893 else if (ackTimeout > PPTP_MAX_ACK_DELAY)
894 ackTimeout = PPTP_MAX_ACK_DELAY;
895
896 /* Be conservative: timeout can happen up to 1 tick early */
897 ticks = (((ackTimeout * hz) + PPTP_TIME_SCALE - 1) / PPTP_TIME_SCALE);
897 ticks = howmany(ackTimeout * hz, PPTP_TIME_SCALE);
898 ng_callout(&hpriv->sackTimer, hpriv->node, hpriv->hook,
899 ticks, ng_pptpgre_send_ack_timeout, hpriv, 0);
900}
901
902/*
903 * We've waited as long as we're willing to wait before sending an
904 * acknowledgement to the peer for received frames. We had hoped to
905 * be able to piggy back our acknowledgement on an outgoing data frame,

--- 78 unchanged lines hidden ---
898 ng_callout(&hpriv->sackTimer, hpriv->node, hpriv->hook,
899 ticks, ng_pptpgre_send_ack_timeout, hpriv, 0);
900}
901
902/*
903 * We've waited as long as we're willing to wait before sending an
904 * acknowledgement to the peer for received frames. We had hoped to
905 * be able to piggy back our acknowledgement on an outgoing data frame,

--- 78 unchanged lines hidden ---