[PATCH 3/3] doc: explain pair construction range failures
Document that expression-based pair construction is checked at filter runtime and that failed route filters do not accept the affected update. Also show how to guard a 32-bit large-community field before using it as a 16-bit pair component. --- doc/bird.sgml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/bird.sgml b/doc/bird.sgml index b97793f4..5a022540 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -1848,6 +1848,13 @@ in the foot). Operators <cf/.asn/ and <cf/.data/ can be used to extract corresponding components of a pair: <cf>(<m/asn/, <m/data/)</cf>. + Pair construction from expressions is range-checked at filter runtime. + If either expression evaluates to a value greater than 65535, filter + evaluation fails with a runtime error. During route import or export, the + affected update is handled as filtered instead of being accepted. An + import configured to keep filtered routes may retain the update as a + filtered route. + <tag><label id="type-quad">quad</tag> This is a dotted quad of numbers used to represent router IDs (and others). Each component can have a value from 0 to 255. Literals of @@ -1990,6 +1997,18 @@ in the foot). to extract corresponding components of LCs: <cf>(<m/asn/, <m/data1/, <m/data2/)</cf>. + Large community fields are 32-bit, while pair components are 16-bit. + Therefore, check the range before using an LC field to construct a pair. + For example, given an LC value in <cf/op/: + <code> + if op.data2 <= 65535 then + bgp_community.add((64512, op.data2)); + else + reject; + </code> + The explicit <cf/reject/ is optional policy; a filter may instead ignore + an LC that cannot be represented as a pair. + <tag><label id="type-set">int|pair|quad|ip|prefix|ec|lc|rd|enum set</tag> Filters recognize several types of sets. Sets are similar to strings: you can pass them around but you cannot modify them. Literals of type <cf>int -- 2.47.3
participants (1)
-
Alice39s