|
@@ -229,6 +229,8 @@ static int tcp_senddata_conn ( struct tcp_connection *conn, int force_send ) {
|
229
|
229
|
struct tcp_application *app = conn->app;
|
230
|
230
|
struct pk_buff *pkb;
|
231
|
231
|
struct tcp_header *tcphdr;
|
|
232
|
+ struct tcp_mss_option *mssopt;
|
|
233
|
+ void *payload;
|
232
|
234
|
unsigned int flags;
|
233
|
235
|
size_t len;
|
234
|
236
|
size_t seq_len;
|
|
@@ -289,13 +291,20 @@ static int tcp_senddata_conn ( struct tcp_connection *conn, int force_send ) {
|
289
|
291
|
start_timer ( &conn->timer );
|
290
|
292
|
|
291
|
293
|
/* Fill up the TCP header */
|
|
294
|
+ payload = pkb->data;
|
|
295
|
+ if ( flags & TCP_SYN ) {
|
|
296
|
+ mssopt = pkb_push ( pkb, sizeof ( *mssopt ) );
|
|
297
|
+ mssopt->kind = TCP_OPTION_MSS;
|
|
298
|
+ mssopt->length = sizeof ( *mssopt );
|
|
299
|
+ mssopt->mss = htons ( TCP_MSS );
|
|
300
|
+ }
|
292
|
301
|
tcphdr = pkb_push ( pkb, sizeof ( *tcphdr ) );
|
293
|
302
|
memset ( tcphdr, 0, sizeof ( *tcphdr ) );
|
294
|
303
|
tcphdr->src = conn->local_port;
|
295
|
304
|
tcphdr->dest = conn->peer.st_port;
|
296
|
305
|
tcphdr->seq = htonl ( conn->snd_seq );
|
297
|
306
|
tcphdr->ack = htonl ( conn->rcv_ack );
|
298
|
|
- tcphdr->hlen = ( ( sizeof ( *tcphdr ) / 4 ) << 4 );
|
|
307
|
+ tcphdr->hlen = ( ( payload - pkb->data ) << 2 );
|
299
|
308
|
tcphdr->flags = flags;
|
300
|
309
|
tcphdr->win = htons ( TCP_WINDOW_SIZE );
|
301
|
310
|
tcphdr->csum = tcpip_chksum ( pkb->data, pkb_len ( pkb ) );
|