@@ -228,6 +228,137 @@ Example usage:
228228To also dump the JP aggregation details, use dump_neighbor_jp_agg.
229229end
230230
231+ define dump_pim_neighbor
232+ set $_neigh = (struct pim_neighbor *)$arg0
233+
234+ if $_neigh == 0
235+ printf "Neighbor pointer is NULL\n"
236+ else
237+ printf "========== PIM Neighbor %p ==========\n", $_neigh
238+
239+ # Source address
240+ printf "Source Address: "
241+ if sizeof($_neigh->source_addr) == 4
242+ # IPv4
243+ set $_na = (unsigned char *)&$_neigh->source_addr
244+ printf "%u.%u.%u.%u", $_na[0], $_na[1], $_na[2], $_na[3]
245+ else
246+ # IPv6
247+ dump_s6_addr &$_neigh->source_addr
248+ end
249+ printf "\n"
250+
251+ # Interface
252+ if $_neigh->interface != 0
253+ printf "Interface: %s\n", $_neigh->interface->name
254+ else
255+ printf "Interface: NULL\n"
256+ end
257+
258+ # Creation timestamp
259+ printf "Creation time: %ld\n", $_neigh->creation
260+
261+ # Hello options (bit flags)
262+ printf "Hello options: 0x%08x ", $_neigh->hello_options
263+ if $_neigh->hello_options & 0x1
264+ printf "HOLDTIME "
265+ end
266+ if $_neigh->hello_options & 0x2
267+ printf "LAN_PRUNE_DELAY "
268+ end
269+ if $_neigh->hello_options & 0x4
270+ printf "DR_PRIORITY "
271+ end
272+ if $_neigh->hello_options & 0x8
273+ printf "GENERATION_ID "
274+ end
275+ if $_neigh->hello_options & 0x10
276+ printf "ADDRESS_LIST "
277+ end
278+ printf "\n"
279+
280+ # Timers and parameters
281+ printf "Holdtime: %u sec\n", $_neigh->holdtime
282+ printf "Propagation delay: %u msec\n", $_neigh->propagation_delay_msec
283+ printf "Override interval: %u msec\n", $_neigh->override_interval_msec
284+ printf "DR priority: %u\n", $_neigh->dr_priority
285+ printf "Generation ID: 0x%08x\n", $_neigh->generation_id
286+
287+ # Prefix list (secondary addresses)
288+ if $_neigh->prefix_list != 0
289+ printf "Secondary addresses: count=%u\n", $_neigh->prefix_list->count
290+ if $_neigh->prefix_list->count > 0
291+ set $_pnode = $_neigh->prefix_list->head
292+ set $_pcount = 0
293+ while $_pnode != 0 && $_pcount < 10
294+ set $_prefix = (struct prefix *)$_pnode->data
295+ printf " [%u] family=%u prefixlen=%u\n", $_pcount, $_prefix->family, $_prefix->prefixlen
296+ set $_pnode = $_pnode->next
297+ set $_pcount = $_pcount + 1
298+ end
299+ if $_neigh->prefix_list->count > 10
300+ printf " ... (%u more)\n", $_neigh->prefix_list->count - 10
301+ end
302+ end
303+ else
304+ printf "Secondary addresses: NULL\n"
305+ end
306+
307+ # Timers
308+ printf "\nTimers:\n"
309+ if $_neigh->t_expire_timer != 0
310+ printf " Expire timer: RUNNING (expires at %ld.%06ld)\n", $_neigh->t_expire_timer->u.sands.tv_sec, $_neigh->t_expire_timer->u.sands.tv_usec
311+ else
312+ printf " Expire timer: stopped\n"
313+ end
314+ if $_neigh->jp_timer != 0
315+ printf " JP timer: RUNNING (expires at %ld.%06ld)\n", $_neigh->jp_timer->u.sands.tv_sec, $_neigh->jp_timer->u.sands.tv_usec
316+ else
317+ printf " JP timer: stopped\n"
318+ end
319+
320+ # JP Aggregation list
321+ if $_neigh->upstream_jp_agg != 0
322+ printf "\nJP Aggregation: count=%u\n", $_neigh->upstream_jp_agg->count
323+ else
324+ printf "\nJP Aggregation: NULL\n"
325+ end
326+
327+ # BFD session
328+ if $_neigh->bfd_session != 0
329+ printf "BFD session: %p (configured)\n", $_neigh->bfd_session
330+ else
331+ printf "BFD session: NULL\n"
332+ end
333+
334+ printf "========================================\n"
335+ end
336+ end
337+ document dump_pim_neighbor
338+ Dump detailed information about a PIM neighbor structure.
339+
340+ This displays comprehensive information including:
341+ - Source address and interface
342+ - Creation timestamp
343+ - Hello options (decoded bit flags)
344+ - Holdtime, propagation delay, override interval
345+ - DR priority and generation ID
346+ - Secondary address list
347+ - Timer states
348+ - JP aggregation list count
349+ - BFD session status
350+
351+ Arguments:
352+ (struct pim_neighbor *) pointer to the neighbor structure
353+
354+ Example usage:
355+ (gdb) dump_pim_neighbor neigh
356+ (gdb) p pim_ifp->pim_neighbor_list->head->data
357+ (gdb) dump_pim_neighbor $
358+
359+ To also dump the JP aggregation details, use dump_neighbor_jp_agg.
360+ end
361+
231362define dump_neighbor_jp_agg
232363 set $_neigh = (struct pim_neighbor *)$arg0
233364
0 commit comments