Advertisement
Guest User

Untitled

a guest
May 30th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.45 KB | None | 0 0
  1. --- test_rohc.c.orig    2013-05-30 20:28:50.000000000 +0200
  2. +++ test_rohc.c 2013-05-30 20:41:26.000000000 +0200
  3. @@ -131,18 +131,16 @@
  4.          ip_packet[0] |= 5; /* IHL: minimal IPv4 header length (in 32-bit words) */
  5.          ip_packet[1] = 0; /* TOS */
  6.          ip_packet_len = 56; //5 * 4 + strlen(FAKE_PAYLOAD);
  7. -        ip_packet[2] = (htons(ip_packet_len) >> 8) & 0xff; /* Total Length */
  8. -        ip_packet[3] = htons(ip_packet_len) & 0xff;
  9. -        //ip_packet[2] = (ip_packet_len >> 8) & 0xff; /* Total Length */
  10. -        //ip_packet[3] = ip_packet_len & 0xff;
  11. +        ip_packet[2] = (ip_packet_len >> 8) & 0xff; /* Total Length */
  12. +        ip_packet[3] = ip_packet_len & 0xff;
  13.          ip_packet[4] = 0; /* IP-ID */
  14.          ip_packet[5] = 0;
  15.          ip_packet[6] = 0; /* Fragment Offset and IP flags */
  16.          ip_packet[7] = 0;
  17.          ip_packet[8] = 1; /* TTL */
  18.          ip_packet[9] = 17; /* Protocol: unassigned number */
  19. -        ip_packet[10] = 0xbe; /* fake Checksum */
  20. -        ip_packet[11] = 0xef;
  21. +        ip_packet[10] = 0xa9; /* fake Checksum */
  22. +        ip_packet[11] = 0xa2;
  23.          ip_packet[12] = 0x01; /* Source address */
  24.          ip_packet[13] = 0x02;
  25.          ip_packet[14] = 0x03;
  26. @@ -153,10 +151,10 @@
  27.          ip_packet[19] = 0x08;
  28.  
  29.      /* fake UDP headers, 8 bytes */
  30. -        udp_packet[0] = 0x05; /* Source address */
  31. -        udp_packet[1] = 0x06;
  32. -        udp_packet[2] = 0x05; /* Destination address */
  33. -        udp_packet[3] = 0x06;
  34. +        udp_packet[0] = 0x04; /* Source address */
  35. +        udp_packet[1] = 0xd2;
  36. +        udp_packet[2] = 0x04; /* Destination address */
  37. +        udp_packet[3] = 0xd2;
  38.      udp_packet_len = 36;
  39.          udp_packet[4] = (udp_packet_len >> 8) & 0xff; /* Total Length */
  40.          udp_packet[5] = udp_packet_len & 0xff;
  41. @@ -293,6 +291,7 @@
  42.          if(decomp_size <= 0)
  43.          {
  44.                  printf("\ndecompression of fake IP packet failed. decompressed size = %d\n", decomp_size);
  45. +                goto release_decompressor;
  46.          }
  47.      else {
  48.          printf("\nROHC packet resulting from the ROHC decompression:\n");
  49. @@ -324,9 +323,10 @@
  50.  
  51.          return 0;
  52.  
  53. +release_decompressor:
  54. +        rohc_free_decompressor(decompressor);
  55.  release_compressor:
  56.          rohc_free_compressor(compressor);
  57. -        rohc_free_decompressor(decompressor);
  58.  error:
  59.          fprintf(stderr, "an error occured during program execution, "
  60.                  "abort program\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement