java-topology/tools/tickets/scans/frrouting-bgpd.md
russell@unturf.com db29a08762 undefect. CWE-407 — 92 sites, 42 ecosystems
B&W print-friendly diagrams + tinkerpop-0001 + wave-3 proof sections.
Squash of 94 local commits onto remote master.
2026-03-26 19:48:18 -04:00

2.2 KiB
Raw Blame History

id priority status created
scan-frrouting-bgpd critical unscanned 2026-03-23

Target

Repo: https://github.com/FRRouting/frr Language: C Why: BGP route storm amplification — internet routing events trigger AS-path loop detection over linear lists, and at scale this degrades convergence under load.

Scan command

# Shallow clone
git clone --depth 1 https://github.com/FRRouting/frr /tmp/frrouting-bgpd

# Submit to unsandbox
cat > /tmp/scan-frrouting-bgpd.sh << 'EOF'
#!/usr/bin/env bash
set -euo pipefail
GRAPH_KW="tarjan|strongly.connected|dfs|scc|topolog|topo.sort|cycle|reachab|postorder|dominator|liveness|digraph|shortest.path|path.find"
MEM="aspath_loop_check|as_in_path|for.*seg.*next|listnode|list_lookup|aspath_count"
find /tmp/frrouting-bgpd/bgpd -name "*.c" -o -name "*.h" | sort | while read f; do
  graph_lines=$(grep -inE "$GRAPH_KW" "$f" 2>/dev/null | cut -d: -f1 | head -5 || true)
  [ -z "$graph_lines" ] && continue
  while IFS= read -r lineno; do
    s=$(( lineno > 20 ? lineno - 20 : 1 )); e=$(( lineno + 20 ))
    hit=$(sed -n "${s},${e}p" "$f" 2>/dev/null | grep -iE "$MEM" | head -1 | sed 's/^\s*//' || true)
    [ -n "$hit" ] && echo "CANDIDATE\t${f}:${lineno}\t${hit}"
  done <<< "$graph_lines"
done
EOF
export UNSANDBOX_PUBLIC_KEY=unsb-pk-russ-test-isth-best
export UNSANDBOX_SECRET_KEY=unsb-sk-rk46c-3zvpg-zjf6z-hjrge
~/git/un-inception/build/un /tmp/scan-frrouting-bgpd.sh

Key files to check

  • bgpd/bgp_aspath.c — AS-path loop detection; aspath_loop_check iterates path segments linearly
  • bgpd/bgp_route.c — Route selection and best-path computation; per-prefix adjacency list scans
  • bgpd/bgp_damp.c — Route dampening; reachability history list traversal

Expected pattern

aspath_loop_check or equivalent iterating over an array/list of AS numbers to detect whether the local AS appears in the path, using a linear scan (O(path-length)) called per received UPDATE — under a route storm this is O(updates × path-length) with no hash-set acceleration.

Acceptance criteria

  • Scan run and results saved to tools/scan-results/frrouting-bgpd.txt
  • All CANDIDATE hits triaged (confirmed defect or false positive)
  • If confirmed: defect ticket created in tools/tickets/defects/