summaryrefslogtreecommitdiff
path: root/bgpd/bgp_damp.h
AgeCommit message (Collapse)Author
2024-05-03bgpd: Pass the right reuse_list when handling it via bgp_reuse_timer threadDonatas Abraitis
This fixes the crash: ``` ==14759== Invalid read of size 8 ==14759== at 0x31032B: bgp_reuselist_del (bgp_damp.c:51) ==14759== by 0x310392: bgp_damp_info_unclaim (bgp_damp.c:69) ==14759== by 0x310CD6: bgp_damp_info_free (bgp_damp.c:387) ==14759== by 0x311016: bgp_reuse_timer (bgp_damp.c:230) ==14759== by 0x4F227CC: thread_call (thread.c:2008) ==14759== by 0x4EDB7D7: frr_run (libfrr.c:1216) ==14759== by 0x1EF748: main (bgp_main.c:525) ==14759== Address 0x48 is not stack'd, malloc'd or (recently) free'd ==14759== ==14759== ==14759== Process terminating with default action of signal 11 (SIGSEGV) ==14759== at 0x59CC7F5: raise (raise.c:46) ==14759== by 0x4F10CEB: core_handler (sigevent.c:261) ==14759== by 0x59CC97F: ??? (in /lib/x86_64-linux-gnu/libpthread-2.27.so) ==14759== by 0x31032A: bgp_reuselist_del (bgp_damp.c:51) ==14759== by 0x310392: bgp_damp_info_unclaim (bgp_damp.c:69) ==14759== by 0x310CD6: bgp_damp_info_free (bgp_damp.c:387) ==14759== by 0x311016: bgp_reuse_timer (bgp_damp.c:230) ==14759== by 0x4F227CC: thread_call (thread.c:2008) ==14759== by 0x4EDB7D7: frr_run (libfrr.c:1216) ==14759== by 0x1EF748: main (bgp_main.c:525) ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-03bgpd: cleanup bgp_damp_info_freeIgor Ryzhov
bgp_damp_config, afi and safi are never used. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com> Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-03bgpd: fix incorrect usage of slist in dampeningIgor Ryzhov
Current code is a complete misuse of SLIST structure. Instead of just adding a SLIST_ENTRY to struct bgp_damp_info, it allocates a separate structure to be a node in the list. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-05-03bgpd: Drop double-pointer for bgp_damp_info_free()Donatas Abraitis
This causes a crash using `clear ip bgp dampening <prefix>`. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com> Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-03bgpd: clear ip bgp dampening was not triggering the route calculation for ↵sudhanshukumar22
the prefix Description: clear ip bgp dampening was not triggering the route calculation for the prefix, Due to this prefix are not install in RIB(Zebra) and not adv to neighbor Problem Description/Summary : clear ip bgp dampening was not triggering the route calculation for the prefix, Due to this prefix are not install in RIB(Zebra) and not adv to neighbor Fix: When clear ip bgp dampening, route are put for route-calculation as that it is install in the Zebra and adv to neighbor. Signed-off-by: sudhanshukumar22 <sudhanshu.kumar@broadcom.com>
2024-05-03bgpd: peer / peer group dampening profilesDavid Schweizer
Changes implement dampening profiles for peers and peer groups. This is achieved by introducing the possibility to have multible existing dampening configurations with their own sets of parameters and lists of associated paths. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org> Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2024-01-30bgpd: Optimize memory usage for bgp_damp_config structDonatas Abraitis
``` struct bgp_damp_config { unsigned int suppress_value; /* 0 4 */ unsigned int reuse_limit; /* 4 4 */ time_t max_suppress_time; /* 8 8 */ time_t half_life; /* 16 8 */ unsigned int reuse_list_size; /* 24 4 */ unsigned int reuse_index_size; /* 28 4 */ unsigned int ceiling; /* 32 4 */ unsigned int decay_rate_per_tick; /* 36 4 */ unsigned int decay_array_size; /* 40 4 */ unsigned int reuse_scale_factor; /* 44 4 */ double scale_factor; /* 48 8 */ double * decay_array; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ int * reuse_index; /* 64 8 */ struct bgp_damp_info * * reuse_list; /* 72 8 */ int reuse_offset; /* 80 4 */ safi_t safi; /* 84 4 */ struct bgp_damp_info * no_reuse_list; /* 88 8 */ struct event * t_reuse; /* 96 8 */ afi_t afi; /* 104 4 */ /* size: 112, cachelines: 2, members: 19 */ /* padding: 4 */ /* last cacheline: 48 bytes */ }; /* saved 8 bytes! */ ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-12bgpd: Drop dampening `tmax` variable from structDonatas Abraitis
Not used anywhere. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.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>
2022-05-12bgpd: Align bgp_damp.h to our standardsDonald Sharp
bgp_damp.h has function declarations that are not properly aligned with our standard on how to do so. Fix. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-08-03Revert "bgpd: peer / peer group dampening profiles"Igor Ryzhov
This reverts commit 40ec3340be9cdda62eea349fe9ee21e65156f422. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-03Revert "bgpd: clear ip bgp dampening was not triggering the route ↵Igor Ryzhov
calculation for the prefix" This reverts commit c8ddbd48040be6bf33c4f0ab3e470f290f9b165a.
2021-08-03Revert "bgpd: Drop double-pointer for bgp_damp_info_free()"Igor Ryzhov
This reverts commit 19971c9a9218b31e6e1c3f7ebb23654f833bb4ef.
2021-08-03Revert "bgpd: fix incorrect usage of slist in dampening"Igor Ryzhov
This reverts commit 5054cfcbbc8c776a91e9390d36cff891d0890b4f.
2021-08-03Revert "bgpd: cleanup bgp_damp_info_free"Igor Ryzhov
This reverts commit 97766ac8aa40ff8868a854ba8515c9e6441e4b7c.
2021-07-30Revert "bgpd: use double-linked list instead of single-linked list in dampening"Donatas Abraitis
Tested with full feed, this stucks and bgpd even stops responding. ``` [T58XM-TP956][EC 268435457] bgpd state -> unresponsive : no response yet to ping sent 90 seconds ago ``` This reverts commit db0e636dc45f9bd2c76528a8368332c56f2c8f1e. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-30bgpd: use double-linked list instead of single-linked list in dampeningIgor Ryzhov
This code always used double-linked list before this rework in 8.0 that introduced all these crashes and memory leaks. Using single-linked list is actually a performance regression, because there are frequent removes here and single-linked list obviously handles removes much worse. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-30bgpd: cleanup bgp_damp_info_freeIgor Ryzhov
bgp_damp_config, afi and safi are never used. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-30bgpd: fix incorrect usage of slist in dampeningIgor Ryzhov
Current code is a complete misuse of SLIST structure. Instead of just adding a SLIST_ENTRY to struct bgp_damp_info, it allocates a separate structure to be a node in the list. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-29bgpd: Drop double-pointer for bgp_damp_info_free()Donatas Abraitis
This causes a crash using `clear ip bgp dampening <prefix>`. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-06-08bgpd: add terse display option on show bgp summaryLouis Scalbert
Add a terse option to show bgp summary to shorten output. Do not show the following information about the BGP instances: the number of RIB entries, the table version and the used memory. The "terse" option can be used in combination with the "remote-as", "neighbor", "failed" and "established" filters, and with the "wide" option as well. Before patch: ubuntu# show bgp summary remote-as 123456 IPv4 Unicast Summary (VRF default): BGP router identifier X.X.X.X, local AS number XXX vrf-id 0 BGP table version 0 RIB entries 3, using 552 bytes of memory Peers 5, using 3635 KiB of memory Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc 10.200.200.2 4 123456 81432 4 0 56092 0 00:00:13 572106 0 N/A Displayed neighbors 1 Total number of neighbors 4 IPv6 Unicast Summary (VRF default): BGP router identifier X.X.X.X, local AS number XXX vrf-id 0 BGP table version 0 RIB entries 3, using 552 bytes of memory Peers 5, using 3635 KiB of memory Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc % No matching neighbor Total number of neighbors 5 After patch: ubuntu# show bgp summary remote-as 123456 terse IPv4 Unicast Summary (VRF default): BGP router identifier X.X.X.X, local AS number XXX vrf-id 0 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc 10.200.200.2 4 123456 81432 4 0 56092 0 00:00:13 572106 0 N/A Displayed neighbors 1 Total number of neighbors 4 IPv6 Unicast Summary (VRF default): BGP router identifier X.X.X.X, local AS number XXX vrf-id 1 % No matching neighbor Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2021-02-02bgpd: clear ip bgp dampening was not triggering the route calculation for ↵sudhanshukumar22
the prefix Description: clear ip bgp dampening was not triggering the route calculation for the prefix, Due to this prefix are not install in RIB(Zebra) and not adv to neighbor Problem Description/Summary : clear ip bgp dampening was not triggering the route calculation for the prefix, Due to this prefix are not install in RIB(Zebra) and not adv to neighbor Fix: When clear ip bgp dampening, route are put for route-calculation as that it is install in the Zebra and adv to neighbor. Signed-off-by: sudhanshukumar22 <sudhanshu.kumar@broadcom.com>
2020-11-02bgpd: peer / peer group dampening profilesDavid Schweizer
Changes implement dampening profiles for peers and peer groups. This is achieved by introducing the possibility to have multible existing dampening configurations with their own sets of parameters and lists of associated paths. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org> Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2020-09-03bgpd: show < ip > bgp < ipv4 | ipv6 > allMadhuri Kuruganti
This commit => provides "all" option, to display the table entries for all(or specific) AFI/SAFIs. => Also introduced "show_flags" to avoid passing multiple arguments(use_json, wide, all) to functions 1. show <ip> bgp <ipv4/ipv6> <all> <wide|json> 2. show <ip> bgp <ipv4/ipv6> <all> summary <json> 3. show <ip> bgp <ipv4/ipv6> <all> cidr-only <wide|json> 4. show <ip> bgp <ipv4/ipv6> <all> community <wide|json> 5. show <ip> bgp <ipv4/ipv6> <all> dampening <dampened-paths|flap-statistics|parameters> <wide|json> 6. show <ip> bgp <ipv4/ipv6> <all> neighbors A.B.C.D advertised-routes|filtered-routes|received-routes <wide|json> show bgp all summary == show ip bgp all summary => output is same => display entries for all AFIs and for each SAFI. show bgp ipv4 all summary == show ip bgp ipv4 all summary => output is same => display entries for each SAFI in AFI_IP show bgp ipv6 all summary == show ip bgp ipv6 all summart => output is same => display entries for each SAFI in AFI_IP6 similarly for all other commands. sample output 1. show <ip> bgp <ipv4/ipv6> <all> <wide|json> router# show ip bgp all wide For address family: IPv4 Unicast BGP table version is 6, local router ID is 1.1.1.1, vrf id 0 Default local pref 100, local AS 1 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.1/32 0.0.0.0 0 32768 ? *>i2.2.2.2/32 192.168.56.152 0 100 0 ? * i10.0.2.0/24 192.168.56.152 0 100 0 ? *> 0.0.0.0 0 32768 ? * i192.168.56.0/24 192.168.56.152 0 100 0 ? *> 0.0.0.0 0 32768 ? *>i192.168.123.245/32 192.168.56.152 0 100 0 ? *>i192.168.223.245/32 192.168.56.152 0 100 0 ? Displayed 6 routes and 8 total paths For address family: IPv6 Unicast BGP table version is 3, local router ID is 1.1.1.1, vrf id 0 Default local pref 100, local AS 1 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::1/128 :: 0 32768 ? *>i2001:db8::2/128 fe80::a00:27ff:fefc:2aa 0 100 0 ? *> 2001:db8:85a3::8a2e:370:7334/128 :: 0 32768 ? Displayed 3 routes and 3 total paths router# router# show ip bgp ipv4 all wide For address family: IPv4 Unicast BGP table version is 6, local router ID is 1.1.1.1, vrf id 0 Default local pref 100, local AS 1 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.1/32 0.0.0.0 0 32768 ? *>i2.2.2.2/32 192.168.56.152 0 100 0 ? * i10.0.2.0/24 192.168.56.152 0 100 0 ? *> 0.0.0.0 0 32768 ? * i192.168.56.0/24 192.168.56.152 0 100 0 ? *> 0.0.0.0 0 32768 ? *>i192.168.123.245/32 192.168.56.152 0 100 0 ? *>i192.168.223.245/32 192.168.56.152 0 100 0 ? Displayed 6 routes and 8 total paths router# router# router# show ip bgp ipv6 all wide For address family: IPv6 Unicast BGP table version is 3, local router ID is 1.1.1.1, vrf id 0 Default local pref 100, local AS 1 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::1/128 :: 0 32768 ? *>i2001:db8::2/128 fe80::a00:27ff:fefc:2aa 0 100 0 ? *> 2001:db8:85a3::8a2e:370:7334/128 :: 0 32768 ? Displayed 3 routes and 3 total paths router# router# show bgp all wide For address family: IPv4 Unicast BGP table version is 6, local router ID is 1.1.1.1, vrf id 0 Default local pref 100, local AS 1 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.1/32 0.0.0.0 0 32768 ? *>i2.2.2.2/32 192.168.56.152 0 100 0 ? * i10.0.2.0/24 192.168.56.152 0 100 0 ? *> 0.0.0.0 0 32768 ? * i192.168.56.0/24 192.168.56.152 0 100 0 ? *> 0.0.0.0 0 32768 ? *>i192.168.123.245/32 192.168.56.152 0 100 0 ? *>i192.168.223.245/32 192.168.56.152 0 100 0 ? Displayed 6 routes and 8 total paths For address family: IPv6 Unicast BGP table version is 3, local router ID is 1.1.1.1, vrf id 0 Default local pref 100, local AS 1 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::1/128 :: 0 32768 ? *>i2001:db8::2/128 fe80::a00:27ff:fefc:2aa 0 100 0 ? *> 2001:db8:85a3::8a2e:370:7334/128 :: 0 32768 ? Displayed 3 routes and 3 total paths router# router# router# show bgp ipv4 all wide For address family: IPv4 Unicast BGP table version is 6, local router ID is 1.1.1.1, vrf id 0 Default local pref 100, local AS 1 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.1/32 0.0.0.0 0 32768 ? *>i2.2.2.2/32 192.168.56.152 0 100 0 ? * i10.0.2.0/24 192.168.56.152 0 100 0 ? *> 0.0.0.0 0 32768 ? * i192.168.56.0/24 192.168.56.152 0 100 0 ? *> 0.0.0.0 0 32768 ? *>i192.168.123.245/32 192.168.56.152 0 100 0 ? *>i192.168.223.245/32 192.168.56.152 0 100 0 ? Displayed 6 routes and 8 total paths router# router# show bgp ipv6 all wide For address family: IPv6 Unicast BGP table version is 3, local router ID is 1.1.1.1, vrf id 0 Default local pref 100, local AS 1 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::1/128 :: 0 32768 ? *>i2001:db8::2/128 fe80::a00:27ff:fefc:2aa 0 100 0 ? *> 2001:db8:85a3::8a2e:370:7334/128 :: 0 32768 ? Displayed 3 routes and 3 total paths router# Router1# show bgp all dampening parameters For address family: IPv4 Unicast Half-life time: 15 min Reuse penalty: 750 Suppress penalty: 2000 Max suppress time: 60 min Max suppress penalty: 12000 For address family: IPv4 Multicast Half-life time: 20 min Reuse penalty: 1000 Suppress penalty: 10000 Max suppress time: 40 min Max suppress penalty: 4000 For address family: IPv4 VPN dampening not enabled for IPv4 VPN For address family: IPv4 Encap dampening not enabled for IPv4 Encap For address family: IPv4 Labeled Unicast dampening not enabled for IPv4 Labeled Unicast For address family: IPv4 Flowspec dampening not enabled for IPv4 Flowspec For address family: IPv6 Unicast dampening not enabled for IPv6 Unicast For address family: IPv6 Multicast Half-life time: 10 min Reuse penalty: 1500 Suppress penalty: 15000 Max suppress time: 20 min Max suppress penalty: 6000 For address family: IPv6 VPN dampening not enabled for IPv6 VPN For address family: IPv6 Encap dampening not enabled for IPv6 Encap For address family: IPv6 Labeled Unicast dampening not enabled for IPv6 Labeled Unicast For address family: IPv6 Flowspec dampening not enabled for IPv6 Flowspec For address family: L2VPN EVPN dampening not enabled for L2VPN EVPN router# bgpd: all option with json-c apis used Replaced vty_out with json-c wrapper functions for all option support to show <ip> bgp commands Sample output: Router2# show bgp all json { "ipv4Unicast":{ "vrfId": 0, "vrfName": "default", "tableVersion": 8, "routerId": "128.16.16.1", "defaultLocPrf": 100, "localAS": 2, "routes": { "128.16.16.0/24": [ { "valid":true, "bestpath":true, "pathFrom":"external", "prefix":"128.16.16.0", "prefixLen":24, "network":"128.16.16.0\/24", "metric":0, "weight":32768, "peerId":"(unspec)", "path":"", "origin":"IGP", "nexthops":[ { "ip":"0.0.0.0", "hostname":"router", "afi":"ipv4", "used":true } ] } ],"130.130.0.0/16": [ { "valid":true, "bestpath":true, "pathFrom":"external", "prefix":"130.130.0.0", "prefixLen":16, "network":"130.130.0.0\/16", "metric":0, "weight":32768, "peerId":"(unspec)", "path":"", "origin":"IGP", "nexthops":[ { "ip":"0.0.0.0", "hostname":"router", "afi":"ipv4", "used":true } ] } ],"192.168.50.0/24": [ { "valid":true, "bestpath":true, "pathFrom":"external", "prefix":"192.168.50.0", "prefixLen":24, "network":"192.168.50.0\/24", "metric":0, "weight":0, "peerId":"10.10.20.3", "path":"3", "origin":"IGP", "nexthops":[ { "ip":"10.10.20.3", "hostname":"router", "afi":"ipv4", "used":true } ] } ],"200.200.200.0/24": [ { "valid":true, "bestpath":true, "pathFrom":"external", "prefix":"200.200.200.0", "prefixLen":24, "network":"200.200.200.0\/24", "metric":0, "weight":0, "peerId":"10.10.10.1", "path":"1", "origin":"IGP", "nexthops":[ { "ip":"10.10.10.1", "hostname":"router", "afi":"ipv4", "used":true } ] } ] } } , "ipv4Multicast":{ "vrfId": 0, "vrfName": "default", "tableVersion": 0, "routerId": "128.16.16.1", "defaultLocPrf": 100, "localAS": 2, "routes": { } } , "ipv4Flowspec":{ "vrfId": 0, "vrfName": "default", "tableVersion": 0, "routerId": "128.16.16.1", "defaultLocPrf": 100, "localAS": 2, "routes": { } } , "ipv6Unicast":{ "vrfId": 0, "vrfName": "default", "tableVersion": 11, "routerId": "128.16.16.1", "defaultLocPrf": 100, "localAS": 2, "routes": { "2001:db8::2/128": [ { "valid":true, "bestpath":true, "pathFrom":"external", "prefix":"2001:db8::2", "prefixLen":128, "network":"2001:db8::2\/128", "metric":0, "weight":32768, "peerId":"(unspec)", "path":"", "origin":"incomplete", "nexthops":[ { "ip":"::", "hostname":"router", "afi":"ipv6", "scope":"global", "used":true } ] } ],"2001:db8::3/128": [ { "valid":true, "bestpath":true, "pathFrom":"external", "prefix":"2001:db8::3", "prefixLen":128, "network":"2001:db8::3\/128", "metric":0, "weight":0, "peerId":"10.10.20.3", "path":"3", "origin":"incomplete", "nexthops":[ { "ip":"2001:db8:0:20::3", "hostname":"router", "afi":"ipv6", "scope":"global" }, { "ip":"fe80::a00:27ff:fe76:6738", "hostname":"router", "afi":"ipv6", "scope":"link-local", "used":true } ] } ],"2001:db8:0:20::/64": [ { "valid":true, "pathFrom":"external", "prefix":"2001:db8:0:20::", "prefixLen":64, "network":"2001:db8:0:20::\/64", "metric":0, "weight":0, "peerId":"10.10.20.3", "path":"3", "origin":"incomplete", "nexthops":[ { "ip":"2001:db8:0:20::3", "hostname":"router", "afi":"ipv6", "scope":"global" }, { "ip":"fe80::a00:27ff:fe76:6738", "hostname":"router", "afi":"ipv6", "scope":"link-local", "used":true } ] }, { "valid":true, "bestpath":true, "pathFrom":"external", "prefix":"2001:db8:0:20::", "prefixLen":64, "network":"2001:db8:0:20::\/64", "metric":0, "weight":32768, "peerId":"(unspec)", "path":"", "origin":"incomplete", "nexthops":[ { "ip":"::", "hostname":"router", "afi":"ipv6", "scope":"global", "used":true } ] } ] } } , "ipv6Multicast":{ "vrfId": 0, "vrfName": "default", "tableVersion": 0, "routerId": "128.16.16.1", "defaultLocPrf": 100, "localAS": 2, "routes": { } } } Router2# Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
2020-06-23bgp: rename bgp_node to bgp_destDonald Sharp
This is the bulk part extracted from "bgpd: Convert from `struct bgp_node` to `struct bgp_dest`". It should not result in any functional change. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-11-11bgpd: Rework BGP dampening to be per AFI/SAFIDonatas Abraitis
Before we had: ! router bgp 65031 bgp dampening 1 2 3 4 ! exit2-debian-9(config)# router bgp 65031 exit2-debian-9(config-router)# address-family ipv4 multicast exit2-debian-9(config-router-af)# bgp dampening 5 6 7 8 exit2-debian-9(config-router-af)# end exit2-debian-9# show running-config ! router bgp 65031 bgp dampening 1 2 3 4 ! After fix: ! router bgp 65031 neighbor 192.168.1.2 remote-as 100 ! address-family ipv4 unicast bgp dampening 1 2 3 4 exit-address-family ! address-family ipv4 multicast bgp dampening 5 6 7 8 exit-address-family ! exit2-debian-9# show ip bgp ipv4 unicast dampening parameters Half-life time: 1 min Reuse penalty: 2 Suppress penalty: 3 Max suppress time: 4 min Max suppress penalty: 32 exit2-debian-9# show ip bgp ipv4 multicast dampening parameters Half-life time: 5 min Reuse penalty: 6 Suppress penalty: 7 Max suppress time: 8 min Max suppress penalty: 18 Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2018-10-09bgpd: Convert binfo to pathDonald Sharp
Convert the binfo variable to path. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09bgpd: Convert all bgp_info_XXX functions to bgp_path_XXX functionsDonald Sharp
Rename all bgp_info_XXX functions to bgp_path_XXX functions Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09bgpd: Convert `struct bgp_info` to `struct bgp_path_info`Donald Sharp
Do a straight conversion of `struct bgp_info` to `struct bgp_path_info`. This commit will setup the rename of variables as well. This is being done because `struct bgp_info` is not descriptive of what this data actually is. It is path information for routes that we keep to build the actual routes nexthops plus some extra information. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-30bgpd/ospfd: resolve warnings for bgp/ospf json commitDon Slice
Signed-off-by: Don Slice <dslice@cumulusnetwork.com>
2018-08-30bgpd/ospfd: make bgp and ospf json response a bit more consistentDon Slice
Problem reported that some bgp and ospf json commands did not return any json output at all if the bgp/ospf instance did not exist. Additionally, some bgp and ospf json commands did not return any json output if the instance existed but no neighbors were defined. This fix makes these commands more consistent in returning empty braces for json output and issue a message if not using json output. Additionally, made the flag "use_json" a bool to make it consistent since previously, it had been defined as an int, char, u_char, and bool at various places. Ticket: CM-21040 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-03-27*: use C99 standard fixed-width integer typesQuentin Young
The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-05-26bgpd: Display of configured dampening parametersBalaji
Function to display configured bgp dampening parameters. Signed-off-by: Balaji.G <balajig81@gmail.com> [DL: formatting adjustments] Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 06bd420d4646333bc7ed9964e348f19a942fcfe2)
2015-08-12Added json formating support to show-...-neighbors-... bgp commands.Morgan Stewart
Ticket: CM-6789 Reviewed By: CCR-3263 Testing Done: Manual Testing and smoke tests Whenever some sort of output is encountered, added a json version with proper logic as well.
2015-06-12Key changes:Donald Sharp
- The aspath and community structures now have a json_object where we store the json representation. This is updated at the same time the "str" for aspath/community are updated. We do this so that we do not have to compute the json rep - Added a small wrappper to libjson0, the wrapper lives in quagga's lib/json.[ch]. - Added more structure to the json output. Sample output: show ip bgp summary json ------------------------ BGP router identifier 10.0.0.1, local AS number 10 BGP table version 2400 RIB entries 4799, using 562 KiB of memory Peers 17, using 284 KiB of memory Peer groups 4, using 224 bytes of memory Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 1.1.1.1 4 10 0 0 0 0 0 never Active 10.0.0.2 4 10 104 7 0 0 0 00:02:29 600 10.0.0.3 4 10 104 7 0 0 0 00:02:29 600 10.0.0.4 4 10 204 7 0 0 0 00:02:29 1200 20.1.1.6 4 20 406 210 0 0 0 00:02:44 600 20.1.1.7 4 20 406 210 0 0 0 00:02:44 600 40.1.1.2 4 40 406 210 0 0 0 00:02:44 600 40.1.1.6 4 40 406 210 0 0 0 00:02:44 600 40.1.1.10 4 40 406 210 0 0 0 00:02:44 600 Total number of neighbors 9 { "as": 10, "dynamic-peers": 0, "peer-count": 17, "peer-group-count": 4, "peer-group-memory": 224, "peer-memory": 291312, "peers": { "1.1.1.1": { "inq": 0, "msgrcvd": 0, "msgsent": 0, "outq": 0, "prefix-advertised-count": 0, "prefix-received-count": 0, "remote-as": 10, "state": "Active", "table-version": 0, "uptime": "never", "version": 4 }, "10.0.0.2": { "hostname": "r2", "inq": 0, "msgrcvd": 104, "msgsent": 7, "outq": 0, "prefix-advertised-count": 1200, "prefix-received-count": 600, "remote-as": 10, "state": "Established", "table-version": 0, "uptime": "00:02:21", "version": 4 }, "10.0.0.3": { "hostname": "r3", "inq": 0, "msgrcvd": 104, "msgsent": 7, "outq": 0, "prefix-advertised-count": 1200, "prefix-received-count": 600, "remote-as": 10, "state": "Established", "table-version": 0, "uptime": "00:02:21", "version": 4 }, "10.0.0.4": { "hostname": "r4", "inq": 0, "msgrcvd": 204, "msgsent": 7, "outq": 0, "prefix-advertised-count": 1200, "prefix-received-count": 1200, "remote-as": 10, "state": "Established", "table-version": 0, "uptime": "00:02:21", "version": 4 }, "20.1.1.6": { "hostname": "r6", "inq": 0, "msgrcvd": 406, "msgsent": 210, "outq": 0, "prefix-advertised-count": 2400, "prefix-received-count": 600, "remote-as": 20, "state": "Established", "table-version": 0, "uptime": "00:02:36", "version": 4 }, "20.1.1.7": { "hostname": "r7", "inq": 0, "msgrcvd": 406, "msgsent": 210, "outq": 0, "prefix-advertised-count": 2400, "prefix-received-count": 600, "remote-as": 20, "state": "Established", "table-version": 0, "uptime": "00:02:36", "version": 4 }, "40.1.1.10": { "hostname": "r10", "inq": 0, "msgrcvd": 406, "msgsent": 210, "outq": 0, "prefix-advertised-count": 2400, "prefix-received-count": 600, "remote-as": 40, "state": "Established", "table-version": 0, "uptime": "00:02:36", "version": 4 }, "40.1.1.2": { "hostname": "r8", "inq": 0, "msgrcvd": 406, "msgsent": 210, "outq": 0, "prefix-advertised-count": 2400, "prefix-received-count": 600, "remote-as": 40, "state": "Established", "table-version": 0, "uptime": "00:02:36", "version": 4 }, "40.1.1.6": { "hostname": "r9", "inq": 0, "msgrcvd": 406, "msgsent": 210, "outq": 0, "prefix-advertised-count": 2400, "prefix-received-count": 600, "remote-as": 40, "state": "Established", "table-version": 0, "uptime": "00:02:36", "version": 4 } }, "rib-count": 4799, "rib-memory": 575880, "router-id": "10.0.0.1", "table-version": 2400, "total-peers": 9 } show ip bgp json ---------------- *> 40.1.1.2 0 0 100 200 300 400 500 40 i * 40.3.88.0/24 40.1.1.6 0 0 100 200 300 400 500 40 i * 40.1.1.10 0 0 100 200 300 400 500 40 i *> 40.1.1.2 0 0 100 200 300 400 500 40 i * 40.3.89.0/24 40.1.1.6 0 0 100 200 300 400 500 40 i * 40.1.1.10 0 0 100 200 300 400 500 40 i *> 40.1.1.2 0 0 100 200 300 400 500 40 i "40.3.88.0/24": [ { "aspath": "100 200 300 400 500 40", "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.6", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 }, { "aspath": "100 200 300 400 500 40", "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.10", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 }, { "aspath": "100 200 300 400 500 40", "bestpath": true, "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.2", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 } ], "40.3.89.0/24": [ { "aspath": "100 200 300 400 500 40", "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.6", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 }, { "aspath": "100 200 300 400 500 40", "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.10", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 }, { "aspath": "100 200 300 400 500 40", "bestpath": true, "med": 0, "nexthops": [ { "afi": "ipv4", "ip": "40.1.1.2", "used": true } ], "origin": "IGP", "path-from": "external", "valid": true, "weight": 0 } ], show ip bgp x.x.x.x json ------------------------ BGP routing table entry for 40.3.86.0/24 Paths: (3 available, best #3, table Default-IP-Routing-Table) Advertised to non peer-group peers: 10.0.0.2 10.0.0.3 10.0.0.4 20.1.1.6 20.1.1.7 40.1.1.2 40.1.1.6 40.1.1.10 100 200 300 400 500 40 40.1.1.6 from 40.1.1.6 (40.0.0.9) Origin IGP, metric 0, localpref 100, valid, external Community: 1:1 2:2 3:3 4:4 10:10 20:20 Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66 Last update: Fri May 8 21:23:41 2015 100 200 300 400 500 40 40.1.1.10 from 40.1.1.10 (40.0.0.10) Origin IGP, metric 0, localpref 100, valid, external Community: 1:1 2:2 3:3 4:4 10:10 20:20 Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66 Last update: Fri May 8 21:23:41 2015 100 200 300 400 500 40 40.1.1.2 from 40.1.1.2 (40.0.0.8) Origin IGP, metric 0, localpref 100, valid, external, best Community: 1:1 2:2 3:3 4:4 10:10 20:20 Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66 Last update: Fri May 8 21:23:41 2015 { "advertised-to": { "10.0.0.2": { "hostname": "r2" }, "10.0.0.3": { "hostname": "r3" }, "10.0.0.4": { "hostname": "r4" }, "20.1.1.6": { "hostname": "r6" }, "20.1.1.7": { "hostname": "r7" }, "40.1.1.10": { "hostname": "r10" }, "40.1.1.2": { "hostname": "r8" }, "40.1.1.6": { "hostname": "r9" } }, "paths": [ { "aspath": { "length": 6, "segments": [ { "list": [ 100, 200, 300, 400, 500, 40 ], "type": "as-sequence" } ], "string": "100 200 300 400 500 40" }, "community": { "list": [ "1:1", "2:2", "3:3", "4:4", "10:10", "20:20" ], "string": "1:1 2:2 3:3 4:4 10:10 20:20" }, "extended-community": { "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66" }, "last-update": { "epoch": 1431120222, "string": "Fri May 8 21:23:42 2015\n" }, "localpref": 100, "med": 0, "nexthops": [ { "accessible": true, "afi": "ipv4", "ip": "40.1.1.6", "metric": 0, "used": true } ], "origin": "IGP", "peer": { "hostname": "r9", "peer-id": "40.1.1.6", "router-id": "40.0.0.9", "type": "external" }, "valid": true }, { "aspath": { "length": 6, "segments": [ { "list": [ 100, 200, 300, 400, 500, 40 ], "type": "as-sequence" } ], "string": "100 200 300 400 500 40" }, "community": { "list": [ "1:1", "2:2", "3:3", "4:4", "10:10", "20:20" ], "string": "1:1 2:2 3:3 4:4 10:10 20:20" }, "extended-community": { "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66" }, "last-update": { "epoch": 1431120222, "string": "Fri May 8 21:23:42 2015\n" }, "localpref": 100, "med": 0, "nexthops": [ { "accessible": true, "afi": "ipv4", "ip": "40.1.1.10", "metric": 0, "used": true } ], "origin": "IGP", "peer": { "hostname": "r10", "peer-id": "40.1.1.10", "router-id": "40.0.0.10", "type": "external" }, "valid": true }, { "aspath": { "length": 6, "segments": [ { "list": [ 100, 200, 300, 400, 500, 40 ], "type": "as-sequence" } ], "string": "100 200 300 400 500 40" }, "bestpath": { "overall": true }, "community": { "list": [ "1:1", "2:2", "3:3", "4:4", "10:10", "20:20" ], "string": "1:1 2:2 3:3 4:4 10:10 20:20" }, "extended-community": { "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66" }, "last-update": { "epoch": 1431120222, "string": "Fri May 8 21:23:42 2015\n" }, "localpref": 100, "med": 0, "nexthops": [ { "accessible": true, "afi": "ipv4", "ip": "40.1.1.2", "metric": 0, "used": true } ], "origin": "IGP", "peer": { "hostname": "r8", "peer-id": "40.1.1.2", "router-id": "40.0.0.8", "type": "external" }, "valid": true } ], "prefix": "40.3.86.0", "prefixlen": 24 }
2015-05-19Add json output support for a few BGP show commandsDonald Sharp
2009-06-23Fix "show ip bgp dampened-paths" garbage output.Chris Caputo
* bgpd/bgp_damp.c: Make bgp_damp_reuse_time_vty() accept a buffer and length, rather than returning a local var buffer whose contents can get trounced. Remove duplicate BGP_UPTIME_LEN define. * bgpd/bgp_damp.h: bgp_damp_reuse_time_vty() prototype change. * bgpd/bgp_route.c: Provide bgp_damp_reuse_time_vty() with a buffer and length. Remove duplicate BGP_UPTIME_LEN define. This problem was noticed in 2005... http://hibernia.jakma.org/~paul/patches/quagga-test.diff ...but the fix didn't make it into the code. Signed-off-by: Chris Caputo <ccaputo@alt.net>
2009-06-18[BGP/cleanup] make some damp function staticStephen Hemminger
2008-08-22[bgpd] remove useless check and return in bgp_config_write_dampStephen Hemminger
2008-08-17 Stephen Hemminger <stephen.hemminger@vyatta.com> * bgp_damp.?: (bgp_config_write_damp) remove useless check of statically allocated config storage, and useless return value Signed-off-by: Paul Jakma <paul@quagga.net>
2005-06-282005-06-28 Paul Jakma <paul.jakma@sun.com>paul
* (global) The great bgpd extern and static'ification. * bgp_routemap.c: remove unused ROUTE_MATCH_ASPATH_OLD code (route_set_metric_compile) fix u_int32_t to ULONG_MAX comparison warnings. * bgp_route.h: (bgp_process, bgp_withdraw, bgp_update) export these used by various files which had their own private declarations, in the case of mplsvpn - incorrect.
2005-05-232005-05-23 Paul Jakma <paul@dishone.st>paul
* bgp_fsm.h: Add extern qualifier to exported functions * bgp_nexthop.c: add static to nexthop specific globals * *.h: Add guard defines
2004-10-132004-10-13 Paul Jakma <paul@dishone.st>paul
* (global) more const'ification and fixups of types to clean up code. * bgp_mplsvpn.{c,h}: (str2tag) fix abuse. Still not perfect, should use something like the VTY_GET_INTEGER macro, but without the vty_out bits.. * bgp_routemap.c: (set_aggregator_as) use VTY_GET_INTEGER_RANGE (no_set_aggregator_as) ditto. * bgpd.c: (peer_uptime) fix unlikely bug, where no buffer is returned, add comments about troublesome return value.
2002-12-13Initial revisionpaul