Tidy the export limits, passive peers and status page code

Readability, no change in behaviour, but for one log line:

- The routes a peer holds from us were counted twice over, differently,
  in the exporter: once per learned-route batch and once per originated
  route. Learned::held_by_peer counts the learned ones in one place, and
  ExportLimits::exceeded_by returns the limit that was passed instead of a
  bool, so that ending the session no longer has to dig it out again with
  a default that could not happen.
- The two hold-downs for a limit passed, ours or the peer's, were two
  near-identical blocks; they are one match.
- How a session ended is put into words in one place
  (SessionEnd::reason), for the dialer's backoff and the passive peer's
  state alike.
- parse_export_limits parses one block; what a missing block means (no
  limits at the top, the top's limits for a peer) is said where it
  differs, instead of Option in and Option out.
- The startup warnings about export limits are a function of their own,
  and the peers without limits are named in one line rather than one
  line each: a router with eighty sessions does not need eighty warnings.
  The warning about a peer without a role is gone: the configuration now
  refuses one.
- Hex formatting of attribute octets is one function; the text for an
  unknown attribute is built in three plain steps.
- The exporter's test fixture returns a named struct, not a tuple.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Rayhaan JaufeerallyandClaude Fable 5.1 committed 2026-10-06 10:05:31 +02:00
1 parent 2dfc00862b
commit befc292215
9 files changed
+219 -214

No files matched your search

+7 -7
View File
@@ -177,14 +177,14 @@ from <select id="lookup-peer"><option value="">any peer</option></select>
if (high === L) return low === L ? 'to every network' : `only to AS${low} (and others named so)`;
return '';
}
const [admin, fn, arg] = p;
const [admin, func, arg] = p;
if (admin !== L) return '';
if (fn === 0) return arg ? `not to AS${arg}` : 'to no other network';
if (fn === 1) return `only to AS${arg} (and others named so)`;
if (fn >= 11 && fn <= 13) return `our AS ${TIMES[fn - 10]} more on the path to ${arg ? `AS${arg}` : 'every network'}`;
if (fn === 20) return `not to group ${arg}`;
if (fn === 21) return `only to group ${arg} (and others named so)`;
if (fn >= 31 && fn <= 33) return `our AS ${TIMES[fn - 30]} more on the path to group ${arg}`;
if (func === 0) return arg ? `not to AS${arg}` : 'to no other network';
if (func === 1) return `only to AS${arg} (and others named so)`;
if (func >= 11 && func <= 13) return `our AS ${TIMES[func - 10]} more on the path to ${arg ? `AS${arg}` : 'every network'}`;
if (func === 20) return `not to group ${arg}`;
if (func === 21) return `only to group ${arg} (and others named so)`;
if (func >= 31 && func <= 33) return `our AS ${TIMES[func - 30]} more on the path to group ${arg}`;
return '';
}