Setting options Data Using Libnet_build_tcp_options

Source: Internet
Author: User

When sending TCP SYN data using Libnet, the options information is generally not set by default, i.e. no MSS and timestamps.

In some IDC rooms, this data is intercepted. The behavior that occurs is that there is no problem using Telnet access, but the libnet sends a SYN packet without responding. The options information needs to be set at the time of the contract. The libnet provides libnet_builf_tcp_options to set up.

Uint8_t payload[20] = {0x00};static int set_options_payload (Uint8_t *payload, UINT32_T TIMEVAL,UINT16_T MSS) {    int len = 0;         //set mss value    payload[len++] = 0x02 ;    payload[len++] = 0x04;    payload[len++] =  ( uint8_t) ((mss >> 8)  & 0xff);    payload[len++] =  ( uint8_t) (MSS & 0XFF);        //set sack     payload[len++] = 0x04;    payload[len++] = 0x02;         //set timeval    payload[len++] =  0x08;    payload[len++] = 0x0a;    payload[len++]  =  (uint8_t) ((Timeval >> 24)  & 0xff);    payload[len++] =  (uint8_t) ( (timeval >> 16)  & 0xff);    payload[len++] =  ( uint8_t) ((timeval >> 8)  & 0xff);     payload[len++] =   (uint8_t) (TIMEVAL & 0XFF);    len+=4;         //set NOP    payload[len++] = 0x01;         //set Window scale    payload[len++] =  0x03;    payload[len++] = 0x03;    payload[len] =  0x07;        return 0;} R = libnet_build_tcp_options (             payload,            20,            l,             0);


Setting options Data Using Libnet_build_tcp_options

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.