|
|
@ -5,7 +5,7 @@ The values for the header fields are: |
|
|
|
1. Verison = 4, to indicate IPv4 version is used. |
|
|
|
2. IHL = 5, which indicates 20 bytes. |
|
|
|
3. Type of Service = 0, |
|
|
|
4. Total Window size = 40, which is 28 in hex. The total windows size contains the total lenght of IP header plus data. |
|
|
|
4. Total Length = 40, which is 28 in hex. The total windows size contains the total lenght of IP header plus data. |
|
|
|
5. Identification = 0001, |
|
|
|
6. Flags = All flags are set to zero, |
|
|
|
7. Fragment Offset = For now, there is no fragment offset so, this value is set to 0. |
|
|
@ -28,6 +28,32 @@ For the FIN+ACK packet, the FIN and ACK flags in the header have a value of 1. |
|
|
|
(i) Concatenate TCP Pseudo header (Protocol, Source IP, Destination IP, Total Length) with TCP header and TCP data. This creates a big integer. |
|
|
|
(ii) Convert this integer to binary and compute bit wise 1's complement. |
|
|
|
|
|
|
|
The value of header comes out to be: |
|
|
|
header = {} |
|
|
|
header[0] = 0x45, Version, IHL |
|
|
|
header[1] = 0x00, TOS, |
|
|
|
header[2] = 0x00, Total Length, |
|
|
|
header[3] = 0x28, Total Length, |
|
|
|
header[4] = 0x00, Identification, |
|
|
|
header[5] = 0x01, Identification, |
|
|
|
header[6] = 0x00, Flags + Fragment Offset, |
|
|
|
header[7] = 0x00, Flags + Fragment Offset, |
|
|
|
header[8] = 0x28, TTL |
|
|
|
header[9] = 0x06, Protocol |
|
|
|
header[10] = 0x00, Header Checksum |
|
|
|
header[11] = 0x00, Header Checksum |
|
|
|
header[12] = 0xc8, Source IP, |
|
|
|
header[13] = 0xcc, Source IP, |
|
|
|
header[14] = 0x0a, Source IP, |
|
|
|
header[15] = 0x0c, Source IP, |
|
|
|
header[16] = 0xc8, Source IP, |
|
|
|
header[17] = 0xcc, Source IP, |
|
|
|
header[18] = 0x0a, Source IP, |
|
|
|
header[19] = 0x0e, Source IP, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
References: |
|
|
|
1. https://www.thegeekstuff.com/2012/05/ip-header-checksum/ |
|
|
|
2. https://www.tutorialspoint.com/calculation-of-tcp-checksum |