)]}'
{
  "commit": "49c370b74df11832239408f68119bd0a0a19a6e8",
  "tree": "c4a613673e1b1a4ec9f66845e699ebe75357f313",
  "parents": [
    "06de82eaeb11a1c84798cc222af77cdb07af2e4e"
  ],
  "author": {
    "name": "Colin Petrie",
    "email": "cpetrie@ripe.net",
    "time": "Wed May 11 11:56:58 2016 +0200"
  },
  "committer": {
    "name": "Paul Jakma",
    "email": "paul.jakma@hpe.com",
    "time": "Tue Sep 13 10:36:40 2016 +0100"
  },
  "message": "bgpd: fix MRT table dumps for locally-originated routes\n\nI\u0027ve been working on a small patch to correct an issue in the BGP MRT\ntable dump code. It\u0027s a quick\u0027n\u0027easy fix initially, and I\u0027d appreciate\nany feedback on making it better :)\n\nIssue:\n\nWhen the BGP table dump code runs, it generates the peer_index_table.\nThis walks the list of peers, and dumps out their IP, ASN, address\nfamily, etc. It also sets the peer index number in the peer struct.\n\nThen the code walks the RIB, and for each prefix, writes out RIB\nentries, that refer to the peer index number.\n\nHowever, when it finds prefixes that are locally originated, the\nassociated peer is the \u0027self\u0027 peer, which wasn\u0027t in the list of peers,\nnever gets an index number assigned, but because it is calloc\u0027d, the\nindex number is set to 0.\n\nEnd result: locally-originated routes are associated with whichever peer\nhappens to be first in the list of remote peers in the index table :)\n\nExample (from one of our route collectors) - these are two of our\noriginated prefixes (bgpdump output):\nTABLE_DUMP2|1457568002|B|12.0.1.63|7018|84.205.80.0/24||IGP|193.0.4.28|0|0||NAG|64512\n10.255.255.255|\nTABLE_DUMP2|1457568006|B|12.0.1.63|7018|2001:7fb:ff00::/48||IGP|::|0|0||NAG||\n\nThe prefixes are announced by us (note it has an empty AS PATH (the\nfield after the prefix)) but also looks like it was received from AS7018\n(12.0.1.63). In fact, the AS7018 peer just happens to be the first peer\nin the index table.\n\nFix:\n\nThe simplest fix (which is also the method adopted by both OpenBGPd and\nthe BIRD mrtdump branch) is to create an empty placeholder \u0027peer\u0027 at the\nstart of the peer index table, for all the routes which are locally\noriginated to refer to.\n\nI\u0027ve attached a patch for this.\nHere\u0027s a resulting bgpdump output after the patch:\nTABLE_DUMP2|1458828539|B|0.0.0.0|0|93.175.150.0/24||IGP|0.0.0.0|0|0||NAG||\nNow it is more obvious that the prefix is locally originated.\n\nThere are more complicated potential ways of fixing it\n1) skip the local routes when dumping the RIB. This leads to questions\nabout what an MRT table dump *should* contain :)\n2) include the \u0027self\u0027 peer in the list of peers used to generate the\nindex table.\netc etc.\n\nBut I\u0027m quite happy with my \u0027create a fake peer, and associate local\nroutes with it\u0027 method :)\n\nYour thoughts and feedback are welcome!\n\nRegards,\n\nColin Petrie\nSystems Engineer\nRIPE NCC RIS Project\nTested-by: NetDEF CI System \u003ccisystem@netdef.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "1fa0e658eb06d15263cdb5df5cfd4571f4037d18",
      "old_mode": 33188,
      "old_path": "bgpd/bgp_dump.c",
      "new_id": "da0c2ac33b3180b404b71b542ca7ff301a478b95",
      "new_mode": 33188,
      "new_path": "bgpd/bgp_dump.c"
    }
  ]
}
