|
@@ -341,7 +341,7 @@ void tcp_trans ( struct tcp_connection *conn, int nxt_state ) {
|
341
|
341
|
* @v tcphdr TCP header
|
342
|
342
|
*/
|
343
|
343
|
void tcp_dump ( struct tcp_header *tcphdr ) {
|
344
|
|
- DBG ( "TCP %p src:%d dest:%d seq:%lld ack:%lld hlen:%hd flags:%#hx\n",
|
|
344
|
+ DBG ( "TCP %p src:%d dest:%d seq:%lx ack:%lx hlen:%hd flags:%#hx\n",
|
345
|
345
|
tcphdr, ntohs ( tcphdr->src ), ntohs ( tcphdr->dest ), ntohl ( tcphdr->seq ),
|
346
|
346
|
ntohl ( tcphdr->ack ), ( ( tcphdr->hlen & TCP_MASK_HLEN ) / 16 ), ( tcphdr->flags & TCP_MASK_FLAGS ) );
|
347
|
347
|
}
|
|
@@ -670,7 +670,6 @@ static int tcp_rx ( struct pk_buff *pkb,
|
670
|
670
|
struct tcp_header *tcphdr;
|
671
|
671
|
uint32_t acked, toack;
|
672
|
672
|
int hlen;
|
673
|
|
- int add = 4;
|
674
|
673
|
|
675
|
674
|
/* Sanity check */
|
676
|
675
|
if ( pkb_len ( pkb ) < sizeof ( *tcphdr ) ) {
|
|
@@ -688,7 +687,6 @@ static int tcp_rx ( struct pk_buff *pkb,
|
688
|
687
|
if ( hlen != sizeof ( *tcphdr ) ) {
|
689
|
688
|
if ( hlen == sizeof ( *tcphdr ) + 4 ) {
|
690
|
689
|
DBG ( "TCP options sent\n" );
|
691
|
|
- add = 4;
|
692
|
690
|
} else {
|
693
|
691
|
DBG ( "Bad header length (%d bytes)\n", hlen );
|
694
|
692
|
return -EINVAL;
|
|
@@ -861,10 +859,11 @@ static int tcp_rx ( struct pk_buff *pkb,
|
861
|
859
|
/* Check if expected sequence number */
|
862
|
860
|
if ( conn->rcv_nxt == ntohl ( tcphdr->seq ) ) {
|
863
|
861
|
conn->rcv_nxt += toack;
|
864
|
|
- conn->tcp_op->newdata ( conn, pkb->data + sizeof ( *tcphdr ) + add, toack );
|
|
862
|
+ conn->tcp_op->newdata ( conn, pkb->data + hlen,
|
|
863
|
+ toack );
|
865
|
864
|
} else {
|
866
|
|
- printf ( "Unexpected sequence number %ld\n",
|
867
|
|
- ntohl ( tcphdr->seq ) );
|
|
865
|
+ DBG ( "Unexpected sequence number %ld (wanted %ld)\n",
|
|
866
|
+ ntohl ( tcphdr->seq ), conn->rcv_nxt );
|
868
|
867
|
}
|
869
|
868
|
|
870
|
869
|
/* Acknowledge new data */
|