bgp / bgpq4

BGP Filter generator
https://github.com/bgp/bgpq4
BSD 2-Clause "Simplified" License
303 stars 43 forks source link

readme: -H generates input as-list not output as-list #116

Open yu-re-ka opened 2 months ago

job commented 2 months ago

Can you also update this one? https://github.com/bgp/bgpq4/blob/main/bgpq4.8

job commented 2 months ago

It seems there is a discrepancy between documentation and behaviour:

feather$ fgrep 'origin as-list' *
main.c: printf(" -H number : generate origin as-lists (JunOS only)\n");

feather$ bgpq4 -J -H 15562 AS-SNIJDERS
policy-options {
replace:
 as-list-group NN {
  as-list a0 members 15562;
  as-list a1 members [ 112 234 267 8952 12654 31451 39765 41996 ];
  as-list a2 members [ 43997 44854 48603 57782 60927 199036 202314 205956 ];
  as-list a3 members [ 210089 212121 215198 ];
 }
}

The keyword as-path-origin does not appear in the code:

feather$ fgrep -r as-path-origin *
CHANGES:    - Add support for the new Junos as-path-origins feature
README.md:> generate output as-list for JunOS 21.3R1+ `as-path-origin` filter (JunOS only)
bgpq4.8:.Em as-path-origin
yu-re-ka commented 1 month ago

Hi,

the command works as intended. Assuming we generated our as-list for use with the as-path-origins statement with bgpq4 -J -H 9136 -l AS9136_ORIGINS AS-WOBCOM, the following policy, which includes as-path-origin AS9136_ORIGINS must be specified by the user:

policy-statement POLICY_AS9136 {
    term FILTER_LISTS {
        from {
            as-path-origins as-list-group AS9136_ORIGINS;
        }
        then next policy;
    }
    then reject;
}

The -f and -G options would not generate a policy-statement or term either. The documentation never states that an as-path-origins statement will be generated.

yu-re-ka commented 1 day ago

Have you had a chance to take review this with the additional context?