)]}'
{
  "commit": "d8a4e42b7d19a87eacc00c825e913907a58f39ee",
  "tree": "2d0777bfbef0e77ca1722fe0e7b2591ef89d4102",
  "parents": [
    "b0145ddb4bf75d2c8853aa3d0bc7c522f4f17531"
  ],
  "author": {
    "name": "JR Rivers",
    "email": "jrrivers@cumulusnetworks.com",
    "time": "Thu Sep 13 17:17:36 2012 +0000"
  },
  "committer": {
    "name": "David Lamparter",
    "email": "equinox@opensourcerouting.org",
    "time": "Thu Oct 25 10:15:58 2012 -0700"
  },
  "message": "lib: improve fletcher checksum validation\n\nOVERVIEW\n\nThe checksum used in OSPF (rfc2328) is specified in rc905 annex B.  There is an\nsample implementation in rfc1008 which forms the basis of the quagga\nimplementation.  This algorithm works perfectly when generating a checksum;\nhowever, validation is a bit problematic.\n\nThe following LSA (generated by a non-quagga implementation) is received by\nquagga and marked with an invalid checksum; however, it passes both the rfc905\nand rfc1008 validation checks.\n\nstatic uint8_t lsa_10_121_233_29[] \u003d {\n   0x0e, 0x10, 0x02, 0x03,\n   0x09, 0x00, 0x35, 0x40,\n   0x0a, 0x79, 0xe9, 0x1d,\n   0x80, 0x00, 0x00, 0x03,\n   0x00, 0x8a, 0x00, 0x1c,\n   0xff, 0xff, 0xff, 0xe0,\n   0x00, 0x00, 0x36, 0xb0\n};\n\nLS Type: Summary-LSA (IP network)\n   LS Age: 3600 seconds\n   Do Not Age: False\n   Options: 0x02 (E)\n   Link-State Advertisement Type: Summary-LSA (IP network) (3)\n   Link State ID: 9.0.53.64\n   Advertising Router: 10.121.233.29 (10.121.233.29)\n   LS Sequence Number: 0x80000003\n   LS Checksum: 0x008a\n   Length: 28\n   Netmask: 255.255.255.224\n   Metric: 14000\n\nYou\u0027ll note that one byte of the checksum is 0x00; quagga would calculate the\nchecksum as 0xff8a.\n\nIt can be argued that the sourcing implementation generates an incorrect\nchecksum; however, rfc905 indicates that, for 1\u0027s complement arithmetic, the\nvalue 255 shall be regarded as 0, thus either values are valid.\n\nEXPLANATION\n\nThe quagga ospfd and ospf6d implementations operate by copying the PDU\u0027s\nexisting checksum in a holding variable, calculating the checksum, and comparing\nthe resulting checksum to the original.  As a note, this implementation has the\nside effect of modifying the contents of the PDU.\n\nEvaluation of both rfc905 and rfc1008 shows that checksum validation should\ninvolve calculating the sum over the PDU and checking that both resulting C0 and\nC1 values are zero.  This behavior is enacted in the rfc1008 implementation by\ncalling encodecc with k \u003d 0 (checksum offset); however, this functionality had\nbeen omitted from the quagga implementation.\n\nPATCH\n\nThis patch adds the ability to call the quagga\u0027s fletcher_checksum() with a\nchecksum offset value of 0xffff (aka FLETCHER_CHECKSUM_VALIDATE) which returns\nthe sum over the buffer (a value of 0 indicates a valid checksum).  This is\nsimilar to the mechanism in rfc1008 when called with k \u003d 0.  The patch also\nintroduces ospf_lsa_checksum_valid().\n\nospf6d had it\u0027s own implementation of the fletcher checksum in\nospf6_lsa_checksum(); it\u0027s the same algorithm as in fletcher_checksum().  This\npatch removes the local implementation in favor of the library\u0027s as well as creates\nand uses ospf6_lsa_checksum_valid().\n\nquagga\u0027s ISIS implementation suffers from the same problem; however, I do not\nhave the facilities to validate a fix to ISIS, thus this change has been left to\nthe ISIS maintainers.  The function iso_csum_verify() should be reduced to\nrunning the fletcher checksum over the buffer using an offset of 0.\n\nSigned-off-by: JR Rivers \u003cjrrivers@cumulusnetworks.com\u003e\nReviewed-by: Scott Feldman \u003csfeldma@cumulusnetworks.com\u003e\nReviewed-by: Nolan Leake \u003cnolan@cumulusnetworks.com\u003e\nReviewed-by: Ayan Banerjee \u003cayan@cumulusnetworks.com\u003e\nReviewed-by: Shrijeet Mukherjee \u003cshm@cumulusnetworks.com\u003e\nSigned-off-by: David Lamparter \u003cequinox@opensourcerouting.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "3ddde815234a554109cdbf9be8b5e93abf46a2ed",
      "old_mode": 33188,
      "old_path": "lib/checksum.c",
      "new_id": "43940b7155591d2996ea3e2664f90bce82831353",
      "new_mode": 33188,
      "new_path": "lib/checksum.c"
    },
    {
      "type": "modify",
      "old_id": "da1d3cbad62e2c3d4169f556624f09c66ad0c989",
      "old_mode": 33188,
      "old_path": "lib/checksum.h",
      "new_id": "b310f744c950ead3396a7fea85465dd3646cf6eb",
      "new_mode": 33188,
      "new_path": "lib/checksum.h"
    },
    {
      "type": "modify",
      "old_id": "670c5d1d13724bc73e78e23d7d3032c39d3db510",
      "old_mode": 33188,
      "old_path": "ospf6d/ospf6_flood.c",
      "new_id": "b81597290a6330a6520fb907ee561bfd9484efb6",
      "new_mode": 33188,
      "new_path": "ospf6d/ospf6_flood.c"
    },
    {
      "type": "modify",
      "old_id": "e65752d8cd19a8d8154ae1693e17e87861653a8f",
      "old_mode": 33188,
      "old_path": "ospf6d/ospf6_lsa.c",
      "new_id": "ff061dfb1bd1ce10fa6d9ef14714101b0edc0c3d",
      "new_mode": 33188,
      "new_path": "ospf6d/ospf6_lsa.c"
    },
    {
      "type": "modify",
      "old_id": "7d93f5cbac12b0c4d900e57972b9965c816e8b9e",
      "old_mode": 33188,
      "old_path": "ospf6d/ospf6_lsa.h",
      "new_id": "263411fc7fcc9f2e769633026c7d5b905741f333",
      "new_mode": 33188,
      "new_path": "ospf6d/ospf6_lsa.h"
    },
    {
      "type": "modify",
      "old_id": "493209a0bbfe75db25aa04eb05496c73fd3f5363",
      "old_mode": 33188,
      "old_path": "ospfd/ospf_lsa.c",
      "new_id": "5579d8efda70c9d6e92b4cd8463692894e10b1dd",
      "new_mode": 33188,
      "new_path": "ospfd/ospf_lsa.c"
    },
    {
      "type": "modify",
      "old_id": "351fb210b1379315dbe2cdfd67663c61f6a9ea8c",
      "old_mode": 33188,
      "old_path": "ospfd/ospf_packet.c",
      "new_id": "ede59088ccb8b3df2cab2c3b8f33956ac8d86651",
      "new_mode": 33188,
      "new_path": "ospfd/ospf_packet.c"
    }
  ]
}
