From e49e16acd33b2199d4e763ac7fb1908637361b95 Mon Sep 17 00:00:00 2001 From: Alexandre Snarskii Date: Thu, 4 Oct 2018 13:33:06 +0300 Subject: [PATCH] make -t (as-sets) work for BIRD too. --- CHANGES | 4 ++-- bgpq3.c | 16 ++++++++-------- bgpq3_printer.c | 7 ++++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGES b/CHANGES index a51e1d0..ac9bfd4 100644 --- a/CHANGES +++ b/CHANGES @@ -12,8 +12,8 @@ untagged yet (2018-10-02) By default checks route[4] presence, to check route6 objects shall be used together with -6. - cleanup OpenBGPd prefix-sets. Submitted by Claudio Jeker. - - new flag -t: generate as-sets for OpenBGPd (OpenBSD 6.4+) and JSON - formats. Based on submission by Claudio Jeker. + - new flag -t: generate as-sets for OpenBGPD (OpenBSD 6.4+), BIRD and + JSON formats. Based on submission by Claudio Jeker. 0.1.35-rc2 (2017-06-14) - OpenBSD need . Reported by Denis Fondras. diff --git a/bgpq3.c b/bgpq3.c index ee500c1..40c9c5e 100644 --- a/bgpq3.c +++ b/bgpq3.c @@ -372,14 +372,14 @@ main(int argc, char* argv[]) "supported for IOS XR\n"); }; if(expander.vendor==V_BIRD && expander.generation!=T_PREFIXLIST && - expander.generation!=T_ASPATH) { - sx_report(SX_FATAL, "Sorry, only prefix-lists and as-paths supported " - "for BIRD output\n"); + expander.generation!=T_ASPATH && expander.generation!=T_ASSET) { + sx_report(SX_FATAL, "Sorry, only prefix-lists and as-paths/as-sets " + "supported for BIRD output\n"); }; if(expander.vendor==V_JSON && expander.generation!=T_PREFIXLIST && expander.generation!=T_ASPATH && expander.generation!=T_ASSET) { - sx_report(SX_FATAL, "Sorry, only prefix-lists and as-paths supported " - "for JSON output\n"); + sx_report(SX_FATAL, "Sorry, only prefix-lists and as-paths/as-sets " + "supported for JSON output\n"); }; if(expander.vendor==V_FORMAT && expander.generation!=T_PREFIXLIST) sx_report(SX_FATAL, "Sorry, only prefix-lists supported in formatted " @@ -399,9 +399,9 @@ main(int argc, char* argv[]) " output only\n"); }; if(expander.generation==T_ASSET && expander.vendor!=V_JSON && - expander.vendor!=V_OPENBGPD) { - sx_report(SX_FATAL, "As-Sets (-t) supported for JSON (-j) and OpenBGPD" - " (-B) output only\n"); + expander.vendor!=V_OPENBGPD && expander.vendor!=V_BIRD) { + sx_report(SX_FATAL, "As-Sets (-t) supported for JSON (-j), OpenBGPD " + "(-B) and BIRD (-b) output only\n"); }; if(expander.asdot && expander.vendor!=V_CISCO) { diff --git a/bgpq3_printer.c b/bgpq3_printer.c index 3b48f40..993b822 100644 --- a/bgpq3_printer.c +++ b/bgpq3_printer.c @@ -554,17 +554,18 @@ bgpq3_print_asset(FILE* f, struct bgpq_expander* b) case V_JUNIPER: case V_CISCO: case V_CISCO_XR: - case V_BIRD: case V_NOKIA: case V_HUAWEI: case V_FORMAT: - sx_report(SX_FATAL, "as-sets (-t) supported for json and openbgpd " - "only\n"); + sx_report(SX_FATAL, "as-sets (-t) supported for JSON, OpenBGPD " + "and BIRD only\n"); return -1; case V_JSON: return bgpq3_print_json_aspath(f,b); case V_OPENBGPD: return bgpq3_print_openbgpd_asset(f,b); + case V_BIRD: + return bgpq3_print_bird_aspath(f,b); }; };