]> git.proxmox.com Git - mirror_frr.git/blame - gdb/ospf.txt
Merge pull request #5793 from ton31337/fix/formatting_show_bgp_summary_failed
[mirror_frr.git] / gdb / ospf.txt
CommitLineData
b3fda246
PJ
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
10define dump_ospf_lsa_flags
11 set $flags = $arg0
12
13 printf "%u: ", $flags
14
15 if $flags & 0x1
16 echo Self,
17 end
18 if $flags & 0x2
19 echo Self-checked,
20 end
21 if $flags & 0x4
22 echo Recvd,
23 end
24 if $flags & 0x8
25 echo Apprvd,
26 end
27 if $flags & 0x10
28 echo Discard,
29 end
30 if $flags & 0x20
31 echo Local-Xlt,
32 end
33 if $flags & 0x40
34 echo Premature-Aged,
35 end
36 if $flags & 0x40
37 echo In-Maxage,
38 end
39 echo \n
40end
41
42define dump_ospf_lsa_data
43 set $lsad = (struct lsa_header *)$arg0
44
45 echo ID / AdvRtr: \t\t
46 dump_s_addr &$lsad->id.s_addr
47 echo \ : \
48 dump_s_addr &$lsad->adv_router.s_addr
49 echo \n
50
51 def_ntohs &$lsad->ls_age
52 printf "Type: %2u Age: %4u,", $lsad->type, $_
53
54 def_ntohs &$lsad->length
55 printf " length: %2u", $_
56
57 def_ntohl &$lsad->ls_seqnum
58 printf " Seqnum: 0x%08x", $_
59
60 def_ntohs &$lsad->checksum
61 printf " csum: 0x%04x\n", $_
62
63 # return the age
64 def_ntohs &$lsad->ls_age
65end
66
67define dump_ospf_lsa
68 set $lsa = (struct ospf_lsa *)$arg0
69
70 #print/x *$lsa
71
72 dump_ospf_lsa_data $lsa->data
73
74 set $relage = $_ + (relative_time.tv_sec - $lsa->tv_recv.tv_sec)
75 printf "Relative age: %4u\n", $relage
76
77 dump_ospf_lsa_flags $lsa->flags
78
79 echo tv_recv: \
80 dump_timeval &$lsa->tv_recv
81 echo \ tv_orig: \
82 dump_timeval &$lsa->tv_orig
83 echo \n
84
85 printf "lock %2u", $lsa->lock
86 printf " stat %2d", $lsa->stat
87 printf " rtx count: %u", $lsa->retransmit_counter
88 printf " rfsh list: %d", $lsa->refresh_list
89 printf "\n\n"
90end
91
92define walk_ospf_lsdb
93 set $node = (struct route_node *)$arg0
94 set $top = (struct route_node *)$arg0
95 set $visited = 0
96
97 while ($node != 0)
98 set $prevl = $node
99
100 if ($node->info != 0)
101 dump_ospf_lsa $node->info
102 set $visited = $visited + 1
103 end
104
105 walk_route_table_next $top $node
106 set $node = $_
107
108 # we've gotten back to the top, finish
109 if ($node == $top)
110 set $node = 0
111 end
112 end
113 printf "Visited: %u\n", $visited
114end
115
116document walk_ospf_lsdb
117Walk through an OSPF LSDB (or subset thereof) and dump all the LSAs
118contained there-in.
119
120Argument: A (struct route_node *) pointing to the top of the
121LSDB route-table which should be dumped.
122end
123
124define ospf_backbone_lsdb_top
125 set $type = $arg0
126
127 set $ospf = ospf_master->ospf->head->data
128
129 output/x ((struct ospf *)$ospf)->backbone->lsdb->type[$type]->db->top
130 echo \n
131end
132document ospf_backbone_lsdb_top
133Dump location of the LSDB in the backbone area for the given LSA type
134
135Argument: Integer LSA type
136end
137