ソースを参照

[tcp] Avoid setting PSH flag when SYN flag is set

Some firewall devices seem to regard SYN,PSH as an invalid flag
combination and reject the packet.  Fix by setting PSH only if SYN is
not set.

Reported-by: DSE Incorporated <dseinc@gmail.com>
tags/v0.9.8
Michael Brown 15年前
コミット
3ed468e0c5
1個のファイルの変更3行の追加1行の削除
  1. 3
    1
      src/net/tcp.c

+ 3
- 1
src/net/tcp.c ファイルの表示

@@ -471,6 +471,8 @@ static int tcp_xmit ( struct tcp_connection *tcp, int force_send ) {
471 471
 		tsopt->tsopt.tsval = ntohl ( currticks() );
472 472
 		tsopt->tsopt.tsecr = ntohl ( tcp->ts_recent );
473 473
 	}
474
+	if ( ! ( flags & TCP_SYN ) )
475
+		flags |= TCP_PSH;
474 476
 	tcphdr = iob_push ( iobuf, sizeof ( *tcphdr ) );
475 477
 	memset ( tcphdr, 0, sizeof ( *tcphdr ) );
476 478
 	tcphdr->src = tcp->local_port;
@@ -478,7 +480,7 @@ static int tcp_xmit ( struct tcp_connection *tcp, int force_send ) {
478 480
 	tcphdr->seq = htonl ( tcp->snd_seq );
479 481
 	tcphdr->ack = htonl ( tcp->rcv_ack );
480 482
 	tcphdr->hlen = ( ( payload - iobuf->data ) << 2 );
481
-	tcphdr->flags = ( flags | TCP_PSH );
483
+	tcphdr->flags = flags;
482 484
 	tcphdr->win = htons ( tcp->rcv_win );
483 485
 	tcphdr->csum = tcpip_chksum ( iobuf->data, iob_len ( iobuf ) );
484 486
 

読み込み中…
キャンセル
保存