Fill in IPv6 and BGP unnumbered support in oxstats

Abierto
#641 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
38/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
rust

Línea de trabajo

Lee oxstats.rs, centrándote en bgp_stats(), static_stats() y rib_stats(), además de en los targets BgpSession, StaticRoutingConfig y SwitchRib descritos en el issue. Rastrea cómo llegan los valores de PeerId y AddressFamily a las métricas y, a continuación, determina cómo deben representarse los peers sin numerar y las dimensiones IPv4/IPv6. Se considera terminado cuando las estadísticas de BGP, rutas estáticas y RIB exponen los peers y las distinciones de familias de direcciones que faltan sin perder las métricas existentes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Oxstats currently has no awareness of the PeerId enum (allowing IP and interface based peers to coexist) and only queries the IPv4 Unicast address family. This needs to be updated for full (and correct) stats exposure into oxstats.

Asking Claude to summarize the gaps in oxstats for ipv6 and bgp unnumbered functionality:

Oxstats IPv6 / BGP Unnumbered Gaps

Gap 1: BGP unnumbered sessions are completely excluded from metrics

oxstats.rs:287-293 — The bgp_stats() method explicitly skips unnumbered sessions:

if let PeerId::Ip(addr) = key {
    session_counters.insert(*addr, session.counters.clone());
    session_count += 1;
}

PeerId::Interface(String) sessions (unnumbered peers discovered via NDP on an interface) are silently dropped. All 29 BGP counters (keepalives, opens, updates, prefixes, transitions, errors, etc.) are missing for unnumbered peers.

Root cause: The BgpSession oximeter target struct has a peer field that's typed as an IpAddr. An interface name like "eth0" can't be represented. The timeseries schema itself would need updating to support a string-based peer identifier, or a parallel timeseries for unnumbered sessions.

Gap 2: Static route stats only report IPv4

oxstats.rs:689-722 — The static_stats() method only queries IPv4:

self.db.get_static_count(AddressFamily::Ipv4)
// ...
self.db.get_static_nexthop_count(AddressFamily::Ipv4)

IPv6 static routes (AddressFamily::Ipv6) are completely ignored. The StaticRoutingConfig target doesn't differentiate by address family either, so even if you added IPv6 counts, there's no way to distinguish them in the current schema — the counts would need separate metrics or an address-family field on the target.

Gap 3: RIB stats are aggregated without AF breakdown

oxstats.rs:727-744 — The rib_stats() method calls full_rib(None), which merges IPv4 and IPv6 RIBs into a single ActiveRoutes gauge. There's no way to see IPv4 vs IPv6 active route counts independently. The SwitchRib target has no address-family dimension.

Summary

┌───────────────────────┬────────────────────────────┬──────────────────────────────────┬──────────────┐
│         Area          │            IPv4            │               IPv6               │  Unnumbered  │
├───────────────────────┼────────────────────────────┼──────────────────────────────────┼──────────────┤
│ BGP session counters  │ Reported                   │ Reported (if numbered IPv6 peer) │ Not reported │
├───────────────────────┼────────────────────────────┼──────────────────────────────────┼──────────────┤
│ Static route counts   │ Reported                   │ Not reported                     │ N/A          │
├───────────────────────┼────────────────────────────┼──────────────────────────────────┼──────────────┤
│ Static nexthop counts │ Reported                   │ Not reported                     │ N/A          │
├───────────────────────┼────────────────────────────┼──────────────────────────────────┼──────────────┤
│ RIB active routes     │ Merged into single count   │ Merged into single count         │ N/A          │
├───────────────────────┼────────────────────────────┼──────────────────────────────────┼──────────────┤
│ BFD                   │ Reported (keyed by IpAddr) │ Reported (keyed by IpAddr)       │ N/A          │
├───────────────────────┼────────────────────────────┼──────────────────────────────────┼──────────────┤
│ mg-lower              │ Reported (no AF dimension) │ Same                             │ N/A          │
└───────────────────────┴────────────────────────────┴──────────────────────────────────┴──────────────┘

The most significant gap is #1 — unnumbered BGP sessions have zero observability through oximeter. This is a blind spot for any deployment using BGP unnumbered, since you can't see session state transitions, keepalive health, or prefix exchange rates for those peers.
Lenguaje dominante
Rust
Estrellas
100
Forks
8
Merge medio
2 d 1 h
PR fusionados (30 d)
18

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de oxidecomputer/maghemite

Todos los issues de oxidecomputer/maghemite

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.