summaryrefslogtreecommitdiff
path: root/bgpd/bgp_debug.c
AgeCommit message (Collapse)Author
2024-04-17bgpd: cleanup references to debug bgp allow-martiansLouis Scalbert
The debug command was removed in 17e9298e47 ("bgpd: Remove 'debug bgp allow-martian'") Cleanup all references to the debug command. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-29bgpd: Send "Send Hold Timer Expired" on such events notificationDonatas Abraitis
This is required by the current (latest/-02 draft). IANA has registered code 8 for "Send Hold Timer Expired" in the "BGP Error (Notification) Codes" sub-registry under the "Border Gateway Protocol (BGP) Parameters" registry. https://datatracker.ietf.org/doc/html/draft-ietf-idr-bgp-sendholdtimer Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-11bgpd: add hooks for displaying module debug messagesPhilippe Guibert
when a plugin is attached, some debugs may be attached to that plugin. For that, add one hook that is interacting with vty: a boolean indicates what the usage is for: either for impacting the 'show running-config', or for impacting the 'show debugging' command. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-09Merge pull request #15122 from opensourcerouting/fix/drop_packet_send_debugsDonald Sharp
bgpd: Change printing format show debugging for debug bgp updates
2024-01-09bgpd: Change printing format `show debugging` for `debug bgp updates`Donatas Abraitis
Before: ``` BGP debugging status: BGP updates debugging is on (inbound) for 127.0.0.1 with prefix-list rn-dummy 192.168.10.18 with prefix-list rn-dummy 1.1.1.1 ``` After: ``` BGP debugging status: BGP updates debugging is on (inbound) for: 127.0.0.1 with prefix-list rn-dummy 192.168.10.18 with prefix-list rn-dummy 192.168.10.20 ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-07bgpd: Add `debug bgp updates detail` commandDonatas Abraitis
When filtering with `debug bgp updates in x.x.x.x prefix-list plist`, we want to filter out unnecessary messages like: ``` 127.0.0.1(Unknown) rcvd UPDATE wlen 0 attrlen 20 alen 5 ``` Such a line as above will be repeated for all the paths received and it's useless without knowing the prefix (because NLRIs are not parsed yet). But want to see only relevant ones: ``` 127.0.0.1(Unknown) rcvd UPDATE w/ attr: nexthop 127.0.0.1, origin i, path 65002 127.0.0.1(Unknown) rcvd 10.255.255.1/32 IPv4 unicast ``` With `debug bgp updates detail` we can combine this to something like: ``` 127.0.0.1(Unknown) rcvd UPDATE w/ attr: nexthop 127.0.0.1, origin i, path 65002 127.0.0.1(Unknown) rcvd UPDATE wlen 0 attrlen 20 alen 5 127.0.0.1(Unknown) rcvd 10.255.255.1/32 IPv4 unicast ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-11-22bgpd: Optimize prefix-list lookup for debug messagesDonatas Abraitis
Pass prefix-list pointers at configuration time. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-11-22bgpd: Add an ability to filter UPDATEs using neighbor with prefix-listDonatas Abraitis
Before this patch we didn't have an option to filter debug UPDATE messages by specifying an arbitrary prefix, prefix-list or so. We had/have only an option to specify: ``` * debug bgp updates in 10.0.0.1 * debug bgp updates prefix 10.0.1.0/24 ``` Now adding: ``` * debug bgp updates <in|out> 10.0.0.1 prefix-list plist ``` CLI output: ``` r2# show debugging MGMT debugging status: Zebra debugging status: BGP debugging status: BGP updates debugging is on (inbound) for 192.168.2.6 with prefix-list debug Staticd debugging status r2# show running-config | include prefix-list debug debug bgp updates in 192.168.2.6 prefix-list debug r2# ``` Logs: ``` BGP: [PCFFM-WMARW] 192.168.2.3(r3) rcvd UPDATE wlen 0 attrlen 28 alen 5 BGP: [PCFFM-WMARW] 192.168.2.3(r3) rcvd UPDATE wlen 0 attrlen 28 alen 4 BGP: [PCFFM-WMARW] 192.168.2.3(r3) rcvd UPDATE wlen 0 attrlen 0 alen 0 BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.2.3 in vrf default BGP: [PCFFM-WMARW] 192.168.2.4(r4) rcvd UPDATE wlen 0 attrlen 28 alen 5 BGP: [PCFFM-WMARW] 192.168.2.4(r4) rcvd UPDATE wlen 0 attrlen 28 alen 4 BGP: [PCFFM-WMARW] 192.168.2.4(r4) rcvd UPDATE wlen 0 attrlen 0 alen 0 BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.2.4 in vrf default BGP: [PCFFM-WMARW] 192.168.1.1(r1) rcvd UPDATE wlen 0 attrlen 29 alen 5 BGP: [PCFFM-WMARW] 192.168.2.6(r6) rcvd UPDATE wlen 0 attrlen 28 alen 5 BGP: [XXWBM-V772F] 192.168.2.6(r6) rcvd UPDATE w/ attr: nexthop 192.168.2.6, origin ?, metric 0, path 65006 BGP: [YCKEM-GB33T] 192.168.2.6(r6) rcvd 172.16.16.254/32 IPv4 unicast <<<<<<<<<<<< BGP: [PCFFM-WMARW] 192.168.2.6(r6) rcvd UPDATE wlen 0 attrlen 28 alen 4 BGP: [PCFFM-WMARW] 192.168.2.6(r6) rcvd UPDATE wlen 0 attrlen 0 alen 0 BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.2.6 in vrf default BGP: [PCFFM-WMARW] 192.168.2.5(r5) rcvd UPDATE wlen 0 attrlen 28 alen 5 BGP: [PCFFM-WMARW] 192.168.2.5(r5) rcvd UPDATE wlen 0 attrlen 28 alen 4 BGP: [PCFFM-WMARW] 192.168.2.5(r5) rcvd UPDATE wlen 0 attrlen 0 alen 0 BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.2.5 in vrf default BGP: [PCFFM-WMARW] 192.168.1.1(r1) rcvd UPDATE wlen 0 attrlen 29 alen 5 BGP: [PCFFM-WMARW] 192.168.7.7(r7) rcvd UPDATE wlen 0 attrlen 0 alen 0 BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.7.7 in vrf default ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-10-10Revert "bgpd: add linkstate debug"Donald Sharp
This reverts commit de38eada9c0527758bca34984d2f018670d74c9a.
2023-09-27Merge pull request #14342 from fdumontet6WIND/fix_crash_snmpDonald Sharp
bgpd: fix crash in *bgpv2PeerErrorsTable"
2023-09-19bgpd: initialization in bgp_notify_admin_message functionFrancois Dumontet
buffer buff is fully zeroed by a memset in bgp_notify_admin_message function Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-09-18bgpd: add linkstate debugLouis Scalbert
Add the "debug bgp linkstate" command to display incoming link-states prefixes. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-09-18bgpd: fix crash in *bgpv2PeerErrorsTableFrancois Dumontet
following crash occurs: at ./nptl/pthread_kill.c:44 at ./nptl/pthread_kill.c:78 at ./nptl/pthread_kill.c:89 context=0x7ffd06d3d300) at /build/make-pkg/output/_packages/cp-routing/src/lib/sigevent.c:246 length=0x7ffd06d3da88, exact=1, var_len=0x7ffd06d3da90, write_method=<optimized out>) at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_snmp_bgp4v2.c:364 vp=vp@entry=0x7f7c88b584c0 <bgpv2_variables>, vp_len=vp_len@entry=102, ename=ename@entry=0x7f7c88b58440 <bgpv2_trap_oid>, enamelen=enamelen@entry=8, name=name@entry=0x7f7c88b58480 <bgpv2_oid>, namelen=namelen@entry=7, iname=0x7ffd06d3e7b0, index_len=1, trapobj=0x7f7c88b53b80 <bgpv2TrapBackListv6>, trapobjlen=6, sptrap=2 '\002') at /build/make-pkg/output/_packages/cp-routing/src/lib/agentx.c:382 vp_len=vp_len@entry=102, ename=ename@entry=0x7f7c88b58440 <bgpv2_trap_oid>, enamelen=enamelen@entry=8, name=name@entry=0x7f7c88b58480 <bgpv2_oid>, namelen=namelen@entry=7, iname=0x7ffd06d3ec30, inamelen=16, trapobj=0x7f7c88b53b80 <bgpv2TrapBackListv6>, trapobjlen=6, sptrap=2 '\002') at /build/make-pkg/output/_packages/cp-routing/src/lib/agentx.c:298 at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_snmp_bgp4v2.c:1496 at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_fsm.c:48 at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_fsm.c:1314 event=Receive_NOTIFICATION_message) at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_fsm.c:2665 at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_packet.c:3129 at /build/make-pkg/output/_packages/cp-routing/src/lib/event.c:1979 at /build/make-pkg/output/_packages/cp-routing/src/lib/libfrr.c:1213 at /build/make-pkg/output/_packages/cp-routing/src/bgpd/bgp_main.c:510 it's due to function bgpv2PeerErrorsTable returning return SNMP_STRING(msg_str); with msg_str NULL rather the string "" this commit avoid the issue. Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2023-02-21Merge pull request #12248 from pguibert6WIND/bgpasdotRuss White
lib, bgp: add initial support for asdot format
2023-02-17Merge pull request #12780 from opensourcerouting/spdx-license-idDonald Sharp
*: convert to SPDX License identifiers
2023-02-10bgpd: Remove extraneous include of version.hDonald Sharp
It's not needed in these compiles. So let's remove it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-10bgpd: support for as notation format for route distinguisherPhilippe Guibert
RD may be built based on an AS number. Like for the AS, the RD may use the AS notation. The two below examples can illustrate: RD 1.1:20 stands for an AS4B:NN RD with AS4B=65536 in dot format. RD 0.1:20 stands for an AS2B:NNNN RD with AS2B=0.1 in dot+ format. This commit adds the asnotation mode to prefix_rd2str() API so as to pick up the relevant display. Two new printfrr extensions are available to display the RD with the two above display methods. - The pRDD extension stands for dot asnotation format - The pRDE extension stands for dot+ asnotation format. - The pRD extension has been renamed to pRDP extension The code is changed each time '%pRD' printf extension is called. Possibly, the asnotation may change the output, then a macro defines the asnotation mode to use. A side effect of forging the mode to use is that the string could not be concatenated with other strings in vty_out and snprintfrr. Those functions have been called multiple times. When zlog_debug needs to display the RD with some other string, the prefix_rd2str() old API is used instead of the printf extension. Some code has been kept untouched: - code related to running-config. Actually, wherever an RD is displayed, its configured name should be dumped. - bgp rfapi code - bgp evpn multihoming code (partially done), since the logic is missing to get the asnotation of 'struct bgp_evpn_es'. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-17Revert "bgpd: optimal router reflection cli and fsm changes"Donatas Abraitis
This reverts commit 70cd87ca02125616e9f61f97ab504248c935bd83. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-17Revert "bgpd: code review comments addressed"Donatas Abraitis
This reverts commit 80f6ea8b99188b9d8e79fe4fc1740cc92375d7bc.
2023-01-14bgpd: Deprecate some unused BGP stuffDonatas Abraitis
* BGP optional parameter type (Authentication) * BGP UPDATE message error subcode for AS loop Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20bgpd: fix static analyzer warningsRafael Zalamena
Use `DEFPY` to provide the `struct prefix` required by the debug insertion functions. While here exchange `int` with `bool` where appropriated. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-12-20bgpd: When allocating prefix, free it when we are already tracking itDonald Sharp
Several functions had this pattern: a) p = prefix_new b) if (already_tracking) return Let's just stop allocating the prefix and use a prefix on the stack, especially since the function used to hold the value actually copies it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-29bgpd: inet_ntop() adjustmentsDonatas Abraitis
Use %pI4/%pI6 where possible, otherwise at least atjust stack buffer sizes for inet_ntop() calls. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-03Merge pull request #12196 from opensourcerouting/xref-vtyshDonald Sharp
*: rewrite `extract.pl` using `xref` infra
2022-10-26build, vtysh: extract vtysh commands from .xrefDavid Lamparter
Rather than running selected source files through the preprocessor and a bunch of perl regex'ing to get the list of all DEFUNs, use the data collected in frr.xref. This not only eliminates issues we've been having with preprocessor failures due to nonexistent header files, but is also much faster. Where extract.pl would take 5s, this now finishes in 0.2s. And since this is a non-parallelizable build step towards the end of the build (dependent on a lot of other things being done already), the speedup is actually noticeable. Also files containing CLI no longer need to be listed in `vtysh_scan` since the .xref data covers everything. `#ifndef VTYSH_EXTRACT_PL` checks are equally obsolete. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-26bgpd: Implement Accumulated IGP Metric Attribute for BGPDonatas Abraitis
https://www.rfc-editor.org/rfc/rfc7311.html Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-12bgpd: code review comments addressedMadhuri Kuruganti
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-12bgpd: optimal router reflection cli and fsm changesMadhuri Kuruganti
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-07*: Create and use infrastructure to show debugs in libDonald Sharp
There are lib debugs being set but never show up in `show debug` commands because there was no way to show that they were being used. Add a bit of infrastructure to allow this and then use it for `debug route-map` Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-06bgpd: adding debug command for conditional advertisementMadhuri Kuruganti
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-09-22bgpd: Use %pRD for prefix_rd2str()Donatas Abraitis
Convert a bunch of prefix_rd2str() for json/vty stuff. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-28Merge pull request #11093 from donaldsharp/allow_martiansLou Berger
Allow martians
2022-06-24bgpd: Remove 'debug bgp allow-martian'Donald Sharp
This command should not be in the code and is being removed as per tech meeting decision. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-17bgpd: Add RFC9234 implementationEugene Bogomazov
RFC9234 is a way to establish correct connection roles (Customer/ Provider, Peer or with RS) between bgp speakers. This patch: - Add a new configuration/terminal option to set the appropriate local role; - Add a mechanism for checking used roles, implemented by exchanging the corresponding capabilities in OPEN messages; - Add strict mode to force other party to use this feature; - Add basic support for a new transitive optional bgp attribute - OTC (Only to Customer); - Add logic for default setting OTC attribute and filtering routes with this attribute by the edge speakers, if the appropriate conditions are met; - Add two test stands to check role negotiation and route filtering during role usage. Signed-off-by: Eugene Bogomazov <eb@qrator.net>
2022-06-15bgpd, ospfd: Remove extra newline for `show debugging`Donald Sharp
This extra newline was adding a weird output to `show debugging` display where there would be extra newlines sometims and not others. Make it consistent. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-02bgpd: Add Notification CEASE BFD Down messageDonatas Abraitis
Related: https://datatracker.ietf.org/doc/html/draft-ietf-idr-bfd-subcode When BFD Down notification comes and BGP is configured to track on BFD events, send BGP Cease/BFD Down notification to the peer. If RFC 8538 is enabled (Notification support for Graceful-Restart), notification should be encapsulated into Hard Reset message. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-13bgpd: Make bgp_debug.[ch] take `const struct peer *` and return boolDonald Sharp
Several functions in bgp_debug.[ch] take a const struct peer * and also return a bool instead of an int. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-13Merge pull request #11177 from opensourcerouting/fix/memset_memcpyDonald Sharp
*: memcpy/memset zeroing
2022-05-12bgpd: Check and validate return value for str2ipaddr()Donatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-12bgpd: Check argv_find() value instead of the indexDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-11*: Properly use memset() when zeroingDonatas Abraitis
Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-02bgpd: Implement CEASE/Hard Reset notificationDonatas Abraitis
Also, add N-Bit (Notification) flag for Graceful Restart. This is a preparation for RFC8538. More information: https://datatracker.ietf.org/doc/html/rfc8538 Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-04-09bgpd: Allow setting BGP [large]community in route-mapsDonatas Abraitis
Before: ``` spine1-debian-11(config-route-map)# bgp community alias 65001:65001 test1 spine1-debian-11(config)# route-map rm permit 10 spine1-debian-11(config-route-map)# set community 65001:65001 % Malformed communities attribute ``` After: ``` spine1-debian-11(config)# bgp community alias 65001:65001 test1 spine1-debian-11(config)# route-map rm permit 10 spine1-debian-11(config-route-map)# set community 65001:65001 spine1-debian-11(config-route-map)# ``` Same for large-communities. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-02-25bgpd: Reuse get/set helpers for attr->communityDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-10bgpd: Use get/set helpers for attr->lcommunityDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-04bgpd: Use bgp_attr_[sg]et_ecommunity for struct ecommunityDonatas Abraitis
This is an extra work before moving attr->ecommunity to attra_extra struct. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-01-07bgpd: Increase administrative shutdown message size to 255Donatas Abraitis
Extended BGP Administrative Shutdown Communication (rfc9003): Basically, shutdown message size is increased to 255 from 128. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-01-06bgpd: Adjust symbolic names for cease notifications according to rfc4486Donatas Abraitis
The following subcodes are defined for the Cease NOTIFICATION message: Subcode Symbolic Name 1 Maximum Number of Prefixes Reached 2 Administrative Shutdown 3 Peer De-configured 4 Administrative Reset 5 Connection Rejected 6 Other Configuration Change 7 Connection Collision Resolution 8 Out of Resources Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-06-07bgpd: Generate and advertise gateway IP overlay index with EVPN RT-5Ameya Dharkar
Gateway IP overlay index is generated for EVPN RT-5 when following CLI is configured. router bgp 100 vrf vrf-blue address-family l2vpn evpn advertise ipv4 unicast gateway-ip advertise ipv6 unicast gateway-ip BGP nexthop of the VRF IP/IPv6 route is set as the gateway IP of the corresponding EVPN RT-5 Signed-off-by: Ameya Dharkar <adharkar@vmware.com>