Making magic with the network stack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.4 KiB

  1. This folder contains detail for Test_Case2.
  2. 1. Verison = 4, to indicate IPv4 version is used.
  3. 2. IHL = 5, which indicates 20 bytes.
  4. 3. Type of Service = 0,
  5. 4. Total Length = 40, which is 28 in hex. The total windows size contains the total lenght of IP header plus data.
  6. 5. Identification = 0002,
  7. 6. Flags = All flags are set to zero,
  8. 7. Fragment Offset = For now, there is no fragment offset so, this value is set to 0.
  9. 8. TTL = 40s, which is 28 in hex.
  10. 9. Protocol = 6, which indicates TCP.
  11. 10. Header Checksum = initially zero and then changed to the 1's complement of the sum of 16 bit values of IP header + data.
  12. 11. Source IP = 192.168.10.20, which is c0a8 0a14 in hex
  13. 12. Destination IP = 192.168.10.10, which is c0a8 0a0a in hex
  14. 13. Source Port = 2341, which is 0925 in hex,
  15. 14. Destination Port = 1200, which is 04B0 in hex.
  16. 15. Sequence Number = 0 for now,
  17. 16. Acknowledgement Number = 0,
  18. 17. Flags:
  19. For the SYN packet, the SYN Flag in the header has a value of 1.
  20. For the SYN+ACK packet, the SYN and ACK flags in the header have a value of 1.
  21. For the ACK packet, the ACK flag in the header has a value of 1.
  22. For the FIN packet, the FIN flag in the header has a value of 1.
  23. For the FIN+ACK packet, the FIN and ACK flags in the header have a value of 1.
  24. 18. TCP Checksum = initially zero, then:
  25. (i) Concatenate TCP Pseudo header (Protocol, Source IP, Destination IP, Total Length) with TCP header and TCP data. This creates a big integer.
  26. (ii) Convert this integer to binary and compute bit wise 1's complement.
  27. 19. Urgent Pointer = 0, no urgent data in the header.
  28. The value of header comes out to be:
  29. header = {}
  30. header[0] = 0x45, Version, IHL
  31. header[1] = 0x00, TOS,
  32. header[2] = 0x00, Total Length,
  33. header[3] = 0x28, Total Length,
  34. header[4] = 0x00, Identification,
  35. header[5] = 0x02, Identification,
  36. header[6] = 0x00, Flags + Fragment Offset,
  37. header[7] = 0x00, Flags + Fragment Offset,
  38. header[8] = 0x28, TTL
  39. header[9] = 0x06, Protocol
  40. header[10] = 0x00, Header Checksum
  41. header[11] = 0x00, Header Checksum
  42. header[12] = 0xc0, Source IP,
  43. header[13] = 0xa8, Source IP,
  44. header[14] = 0x0a, Source IP,
  45. header[15] = 0x14, Source IP,
  46. header[16] = 0xc0, Destination IP,
  47. header[17] = 0xa8, Destination IP,
  48. header[18] = 0x0a, Destination IP,
  49. header[19] = 0x0a, Destination IP,
  50. The value of IP_Header_Checksum comes out to be: fd5f.
  51. References:
  52. 1. https://www.thegeekstuff.com/2012/05/ip-header-checksum/
  53. 2. https://www.tutorialspoint.com/calculation-of-tcp-checksum