~james-page/ubuntu/saucy/openvswitch/1.12-snapshot

« back to all changes in this revision

Viewing changes to tests/test-csum.c

  • Committer: James Page
  • Date: 2013-08-21 10:16:57 UTC
  • mfrom: (1.1.20)
  • Revision ID: james.page@canonical.com-20130821101657-3o0z0qeiv5zkwlzi
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
test_rfc1624(void)
95
95
{
96
96
    /* "...an IP packet header in which a 16-bit field m = 0x5555..." */
97
 
    uint8_t data[32] =
98
 
        "\xfe\x8f\xc1\x14\x4b\x6f\x70\x2a\x80\x29\x78\xc0\x58\x81\x77\xaa"
99
 
        "\x66\x64\xfc\x96\x63\x97\x64\xee\x12\x53\x1d\xa9\x2d\xa9\x55\x55";
 
97
    uint8_t data[32] = {
 
98
        0xfe, 0x8f, 0xc1, 0x14, 0x4b, 0x6f, 0x70, 0x2a,
 
99
        0x80, 0x29, 0x78, 0xc0, 0x58, 0x81, 0x77, 0xaa,
 
100
        0x66, 0x64, 0xfc, 0x96, 0x63, 0x97, 0x64, 0xee,
 
101
        0x12, 0x53, 0x1d, 0xa9, 0x2d, 0xa9, 0x55, 0x55
 
102
    };
100
103
 
101
104
    /* "...the one's complement sum of all other header octets is 0xCD7A." */
102
105
    assert(ntohs(csum(data, sizeof data - 2)) == 0xffff - 0xcd7a);