wulin weng

TCP Grammar header check in MQX4.1

Discussion created by wulin weng on Oct 13, 2016
Latest reply on Nov 17, 2016 by Daniel Chen

Dear Support:

As we know, the tcp/ip stack in mqx4.1 has check the TCP Grammar Header in function TCP_Process_packet() in Tcp.c.

the tcp header include:

/*  Header of a TCP packet
 */
typedef struct tcp_header {              /* see RFC sec.3.1 */

   unsigned char    source_port[2];   /* source TCP port number */
   unsigned char    dest_port[2];     /* destination TCP port number */
   unsigned char    seq[4];           /* of 1st data octet or 1st-1 if (flags & SYN)*/
   unsigned char    ack[4];           /* valid if (flags & ACK) */
   unsigned char    flags[2];         /* see flags values above */
   unsigned char    window[2];        /* nb of bytes recipient of packet can send */
   unsigned char    checksum[2];      /* (see RFC) */
   unsigned char    urgent[2];        /* offset from seq, valid if (flags & URG) */
                              /* then follow options in 4-byte multiples, */
                              /* then data  */

} TCP_HEADER, * TCP_HEADER_PTR; /* 20 bytes */

the processing of the received packet is just check the flags in the source code like below:

   if ( ((flags & SYN) && (flags & FIN)) ||
        (flags == FIN) ||
        (flags == 0) ) {
      TCP_PP_DROP;
   }

 

my question is if the other data in the structure of tcp header is not valid, and the processing is not do the checking, can it be something wrong happen?

If I want to do the all tcp header data check? how can I to do it?

 

BR,

Outcomes