Parcourir la source

[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 il y a 15 ans
Parent
révision
3ed468e0c5
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3
    1
      src/net/tcp.c

+ 3
- 1
src/net/tcp.c Voir le fichier

@@ -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
 

Chargement…
Annuler
Enregistrer