PPTP Client の Receive Window Size 変更で通信速度大幅アップ!!

PPTP Client 1.7.0 のソースを読んでいたら、Receive Windows Size が固定になっていることに気付いた。

PPTP Client

Outgoing Call Request のパラメータは固定な実装らしい。
Receive Windows Size が 3というのは、余りにも小さいと思うのだが、理由があるのだろうか。
(例えば YAMAHA RTX1000 の初期値は 32、Windows XP は 64)

PPTP_WINDOW を 64 に上げてコンパイルし直したら、通信速度が10〜20倍くらいになった!!

RFC2637

2.7. Outgoing-Call-Request

The Outgoing-Call-Request is a PPTP control message sent by the PNS
to the PAC to indicate that an outbound call from the PAC is to be
established. This request provides the PAC with information required
to make the call. It also provides information to the PAC that is
used to regulate the transmission of data to the PNS for this session
once it is established.

4.2. Sliding Window Protocol

The sliding window protocol used on the PPTP data path is used for
flow control by each side of the data exchange. The enhanced GRE
protocol allows packet acknowledgments to be piggybacked on data
packets. Acknowledgments can also be sent separately from data
packets. Again, the main purpose of the sliding window protocol is
for flow control--retransmissions are not performed by the tunnel
peers.

4.2.1. Initial Window Size

Although each side has indicated the maximum size of its receive
window, it is recommended that a conservative approach be taken when
beginning to transmit data. The initial window size on the
transmitter is set to half the maximum size the receiver requested,
with a minimum size of one packet. The transmitter stops sending
packets when the number of packets awaiting acknowledgment is equal
to the current window size. As the receiver successfully digests
each window, the window size on the transmitter is bumped up by one
packet until the maximum is reached. This method prevents a system
from flooding an already congested network because no history has
been established.

Debian -- Error
Debian -- Error

      #undef  PPTP_FIRMWARE_STRING
      #undef  PPTP_FIRMWARE_VERSION
      #define PPTP_BUF_MAX 65536
      #define PPTP_TIMEOUT 60 /* seconds */
      extern int idle_wait;
      extern int max_echo_wait;
      #define PPTP_CONNECT_SPEED 10000000
      #define PPTP_WINDOW 3
      #define PPTP_DELAY  0
      #define PPTP_BPS_MIN 2400
      #define PPTP_BPS_MAX 10000000
      struct pptp_out_call_rqst { /* for control message type 7 */
        struct pptp_header header;
        u_int16_t call_id;       /* Call ID (unique id used to multiplex data)  */
        u_int16_t call_sernum;  /* Call Serial Number (used for logging)       */
        u_int32_t bps_min;      /* Minimum BPS (lowest acceptable line speed)  */
        u_int32_t bps_max;       /* Maximum BPS (highest acceptable line speed) */
        u_int32_t bearer;       /* Bearer type                                 */
        u_int32_t framing;      /* Framing type                                */
        u_int16_t recv_size;       /* Recv. Window Size (no. of buffered packets) */
        u_int16_t delay;       /* Packet Processing Delay (in 1/10 sec)       */
        u_int16_t phone_len;       /* Phone Number Length (num. of valid digits)  */
        u_int16_t reserved1;    /* MUST BE ZERO                    */
        u_int8_t  phone_num[64]; /* Phone Number (64 octets, null term.)       */
        u_int8_t subaddress[64]; /* Subaddress (64 octets, null term.)         */
      };
      PPTP_CALL * pptp_call_open(PPTP_CONN * conn, pptp_call_cb callback,
              char *phonenr)
      {
          PPTP_CALL * call;
          int i;
          int idx, rc;
          /* Send off the call request */
          struct pptp_out_call_rqst packet = {
              PPTP_HEADER_CTRL(PPTP_OUT_CALL_RQST),
              0,0, /*call_id, sernum */
              hton32(PPTP_BPS_MIN), hton32(PPTP_BPS_MAX),
              hton32(PPTP_BEARER_CAP), hton32(PPTP_FRAME_CAP),
              hton16(PPTP_WINDOW), 0, 0, 0, {0}, {0}
          };