From 3ed468e0c58bb0eb94925c18a0461cd5014b5777 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 10 Mar 2009 08:15:47 +0000 Subject: [PATCH] [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 --- src/net/tcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/net/tcp.c b/src/net/tcp.c index 6bcd193c..0ef65779 100644 --- a/src/net/tcp.c +++ b/src/net/tcp.c @@ -471,6 +471,8 @@ static int tcp_xmit ( struct tcp_connection *tcp, int force_send ) { tsopt->tsopt.tsval = ntohl ( currticks() ); tsopt->tsopt.tsecr = ntohl ( tcp->ts_recent ); } + if ( ! ( flags & TCP_SYN ) ) + flags |= TCP_PSH; tcphdr = iob_push ( iobuf, sizeof ( *tcphdr ) ); memset ( tcphdr, 0, sizeof ( *tcphdr ) ); tcphdr->src = tcp->local_port; @@ -478,7 +480,7 @@ static int tcp_xmit ( struct tcp_connection *tcp, int force_send ) { tcphdr->seq = htonl ( tcp->snd_seq ); tcphdr->ack = htonl ( tcp->rcv_ack ); tcphdr->hlen = ( ( payload - iobuf->data ) << 2 ); - tcphdr->flags = ( flags | TCP_PSH ); + tcphdr->flags = flags; tcphdr->win = htons ( tcp->rcv_win ); tcphdr->csum = tcpip_chksum ( iobuf->data, iob_len ( iobuf ) );