ospf.txt 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. # GDB macros for use with Quagga.
  2. #
  3. # Macros in this file are specific to ospfd/. Definitions here depend on the
  4. # lib.txt macros file, which must also be loaed.
  5. #
  6. # The macro file can be loaded with 'source <filename>'. They can then be
  7. # called by the user. Macros that explore more complicated structs generally
  8. # take pointer arguments.
  9. define dump_ospf_lsa_flags
  10. set $flags = $arg0
  11. printf "%u: ", $flags
  12. if $flags & 0x1
  13. echo Self,
  14. end
  15. if $flags & 0x2
  16. echo Self-checked,
  17. end
  18. if $flags & 0x4
  19. echo Recvd,
  20. end
  21. if $flags & 0x8
  22. echo Apprvd,
  23. end
  24. if $flags & 0x10
  25. echo Discard,
  26. end
  27. if $flags & 0x20
  28. echo Local-Xlt,
  29. end
  30. if $flags & 0x40
  31. echo Premature-Aged,
  32. end
  33. if $flags & 0x40
  34. echo In-Maxage,
  35. end
  36. echo \n
  37. end
  38. define dump_ospf_lsa_data
  39. set $lsad = (struct lsa_header *)$arg0
  40. echo ID / AdvRtr: \t\t
  41. dump_s_addr &$lsad->id.s_addr
  42. echo \ : \
  43. dump_s_addr &$lsad->adv_router.s_addr
  44. echo \n
  45. def_ntohs &$lsad->ls_age
  46. printf "Type: %2u Age: %4u,", $lsad->type, $_
  47. def_ntohs &$lsad->length
  48. printf " length: %2u", $_
  49. def_ntohl &$lsad->ls_seqnum
  50. printf " Seqnum: 0x%08x", $_
  51. def_ntohs &$lsad->checksum
  52. printf " csum: 0x%04x\n", $_
  53. # return the age
  54. def_ntohs &$lsad->ls_age
  55. end
  56. define dump_ospf_lsa
  57. set $lsa = (struct ospf_lsa *)$arg0
  58. #print/x *$lsa
  59. dump_ospf_lsa_data $lsa->data
  60. set $relage = $_ + (relative_time.tv_sec - $lsa->tv_recv.tv_sec)
  61. printf "Relative age: %4u\n", $relage
  62. dump_ospf_lsa_flags $lsa->flags
  63. echo tv_recv: \
  64. dump_timeval &$lsa->tv_recv
  65. echo \ tv_orig: \
  66. dump_timeval &$lsa->tv_orig
  67. echo \n
  68. printf "lock %2u", $lsa->lock
  69. printf " stat %2d", $lsa->stat
  70. printf " rtx count: %u", $lsa->retransmit_counter
  71. printf " rfsh list: %d", $lsa->refresh_list
  72. printf "\n\n"
  73. end
  74. define walk_ospf_lsdb
  75. set $node = (struct route_node *)$arg0
  76. set $top = (struct route_node *)$arg0
  77. set $visited = 0
  78. while ($node != 0)
  79. set $prevl = $node
  80. if ($node->info != 0)
  81. dump_ospf_lsa $node->info
  82. set $visited = $visited + 1
  83. end
  84. walk_route_table_next $top $node
  85. set $node = $_
  86. # we've gotten back to the top, finish
  87. if ($node == $top)
  88. set $node = 0
  89. end
  90. end
  91. printf "Visited: %u\n", $visited
  92. end
  93. document walk_ospf_lsdb
  94. Walk through an OSPF LSDB (or subset thereof) and dump all the LSAs
  95. contained there-in.
  96. Argument: A (struct route_node *) pointing to the top of the
  97. LSDB route-table which should be dumped.
  98. end
  99. define ospf_backbone_lsdb_top
  100. set $type = $arg0
  101. set $ospf = ospf_master->ospf->head->data
  102. output/x ((struct ospf *)$ospf)->backbone->lsdb->type[$type]->db->top
  103. echo \n
  104. end
  105. document ospf_backbone_lsdb_top
  106. Dump location of the LSDB in the backbone area for the given LSA type
  107. Argument: Integer LSA type
  108. end