summaryrefslogtreecommitdiff
path: root/bgpd/bgp_vty.c
AgeCommit message (Collapse)Author
2024-12-05bgpd: fix unconfigure asdot neighborPhilippe Guibert
The below command is not successfull on an existing as dot peer > no neighbor 10.0.0.2 remote-as 1.1 > % Create the peer-group or interface first Handle the case where the remote-as argument can be an ASNUM. Fixes: 8079a4138d61 ("lib, bgp: add initial support for asdot format") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-10-29bgpd: add `bgp ipv6-auto-ra` commandMikhail Sokolovskiy
Introduce a command to stop bgpd from enabling IPv6 router advertisement messages sending on interfaces. Signed-off-by: Mikhail Sokolovskiy <sokolmish@gmail.com>
2024-06-24bgpd: Remove redundant whitespace before printing the reason of the failed peerDonatas Abraitis
Before: ``` Neighbor EstdCnt DropCnt ResetTime Reason 127.0.0.1 0 0 never Waiting for peer OPEN (n/a) ``` After: ``` Neighbor EstdCnt DropCnt ResetTime Reason 127.0.0.1 0 0 never Waiting for peer OPEN (n/a) ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org> (cherry picked from commit b5bd626a82b2541bee8e3120139e19ba05e444c8)
2023-11-30bgpd: Free Memory for SRv6 Functions and Locator ChunksKeelan10
Implement proper memory cleanup for SRv6 functions and locator chunks to prevent potential memory leaks. The list callback deletion functions have been set. The ASan leak log for reference: ``` *********************************************************************************** Address Sanitizer Error detected in bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.asan.bgpd.4180 ================================================================= ==4180==ERROR: LeakSanitizer: detected memory leaks Direct leak of 544 byte(s) in 2 object(s) allocated from: #0 0x7f8d176a0d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28) #1 0x7f8d1709f238 in qcalloc lib/memory.c:105 #2 0x55d5dba6ee75 in sid_register bgpd/bgp_mplsvpn.c:591 #3 0x55d5dba6ee75 in alloc_new_sid bgpd/bgp_mplsvpn.c:712 #4 0x55d5dba6f3ce in ensure_vrf_tovpn_sid_per_af bgpd/bgp_mplsvpn.c:758 #5 0x55d5dba6fb94 in ensure_vrf_tovpn_sid bgpd/bgp_mplsvpn.c:849 #6 0x55d5dba7f975 in vpn_leak_postchange bgpd/bgp_mplsvpn.h:299 #7 0x55d5dba7f975 in vpn_leak_postchange_all bgpd/bgp_mplsvpn.c:3704 #8 0x55d5dbbb6c66 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3164 #9 0x7f8d1716f08a in zclient_read lib/zclient.c:4459 #10 0x7f8d1713f034 in event_call lib/event.c:1974 #11 0x7f8d1708242b in frr_run lib/libfrr.c:1214 #12 0x55d5db99d19d in main bgpd/bgp_main.c:510 #13 0x7f8d160c5c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) Direct leak of 296 byte(s) in 1 object(s) allocated from: #0 0x7f8d176a0d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28) #1 0x7f8d1709f238 in qcalloc lib/memory.c:105 #2 0x7f8d170b1d5f in srv6_locator_chunk_alloc lib/srv6.c:135 #3 0x55d5dbbb6a19 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3144 #4 0x7f8d1716f08a in zclient_read lib/zclient.c:4459 #5 0x7f8d1713f034 in event_call lib/event.c:1974 #6 0x7f8d1708242b in frr_run lib/libfrr.c:1214 #7 0x55d5db99d19d in main bgpd/bgp_main.c:510 #8 0x7f8d160c5c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) *********************************************************************************** ``` Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com> (cherry picked from commit 8e7044ba3b806d286ed964746f4e88004035be09)
2023-10-11Revert "lib: register bgp link-state afi/safi"Donald Sharp
This reverts commit 1642a68d60cfade4b2fce72aaef58dea700c65c3. (cherry picked from commit 0dc12c9003a865c7ee829543d40e8c285863abe8)
2023-10-11Revert "bgpd: add bgp link-state address-family configuration context"Donald Sharp
This reverts commit ae2f3bb5b4eed01df1f7a69c7710c9be519390f6. (cherry picked from commit ddd96b51b06e7cd5ff5471aa6f8ddb390708b858)
2023-10-11Revert "bgpd: add bgp default link-state command"Donald Sharp
This reverts commit 38a7e20fc98ed750d9b2cdae1c79d1e19ceadcd3. (cherry picked from commit 7679d6056b96f707c01157fe5cefab06a7a6392b)
2023-10-11Revert "bgpd: add show bgp link-state link-state commands"Donald Sharp
This reverts commit f11f67033fe20f0b4aeb6c885949abb060324749. (cherry picked from commit d3261fd83f921cb2defd17fd93ab5099d48c952d)
2023-09-27Merge pull request #14342 from fdumontet6WIND/fix_crash_snmpDonald Sharp
bgpd: fix crash in *bgpv2PeerErrorsTable"
2023-09-26Merge pull request #12649 from louis-6wind/bgp-link-stateRuss White
bgpd: add basic support of BGP Link-State RFC7752
2023-09-19Merge pull request #14436 from opensourcerouting/fix/set_mss_for_passive_nodesRuss White
bgpd: Set TCP MSS for the socket even if the session is set to passive
2023-09-19Merge pull request #14382 from ↵Russ White
opensourcerouting/feature/long_lived_graceful_restart_dynamic_capability_split bgpd: Handle LLGR capability using dynamic capabilities
2023-09-18bgpd: add show bgp link-state link-state commandsLouis Scalbert
Add the "show bgp link-state link-state" following commands: > r3# show bgp link-state link-state ? > <cr> > all Display the entries for all address families > detail-routes Display detailed version of all routes > json JavaScript Object Notation > neighbors Detailed information on TCP and BGP neighbor connections > regexp Display routes matching the AS path regular expression > summary Summary of BGP neighbor status > version Display prefixes with matching version numbers > wide Increase table width for longer prefixes Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-09-18bgpd: add bgp default link-state commandLouis Scalbert
Add the "bgp default link-state" command to the "router bgp" context. > router bgp 65000 > bgp default link-state When this command is set, the "link-state/link-state" AFI/SAFI is activated on all neighbors that are directly specified within the "router bgp" unless explicitly deactivated: > router bgp 65000 > bgp default link-state > neighbor 10.0.0.1 remote-as 65001 > address-family link-state link-state > no neighbor 10.0.0.1 activate Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-09-18bgpd: Show TCP MSS per neighbor always, despite if it's configured or notDonatas Abraitis
To show the TCP MSS value per neighbor you have to configure it, otherwise you don't see the actual value. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-09-18bgpd: add bgp link-state address-family configuration contextLouis Scalbert
Add the bgp link-state configuration context cli: > router bgp 65001 > address-family link-state link-state > neighbor 192.0.2.2 activate > exit-address-family Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-09-18lib: register bgp link-state afi/safiLouis Scalbert
Register BGP Link-State AFI/SAFI values from RFC7752. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com> Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.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-09-13bgpd: fix forbiding 'redistribute table' usage on non default instancesPhilippe Guibert
The 'redistribute table' command can be used by configuration on a non default BGP instance, but this command does not work for multiple reasons: - The route entries configured on a given table are always configured from the default vrf. This constraint prevents from redistributing a prefix from the default vrf to an other non default bgp instance. - The importation of route entries requires 'ip import-table' on vrfs and this command is not available Fix this by preventing from configuring this kind of redistribution on non default bgp instances. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-09-13bgpd: Handle LLGR capability using dynamic capabilitiesDonatas Abraitis
LLGR stale time is exchanged using OPEN messages. In order to reduce stal time before doing an actual graceful restart + LLGR, it might be useful to increase the time, but this is not possible without resetting the session. With this change, it's possible to send dynamic capability with a new value, and GR will respect a new reset time value when LLGR kicks in. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-09-13bgpd: Show LLGR timers under `show bgp neighbor`Donatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-09-10bgpd: Move the peer->su to connection->suDonald Sharp
The sockunion is per connection. So let's move it over. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-10bgpd: peer_established should be connection orientedDonald Sharp
The peer_established function should be connection oriented. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-09bgpd: bgp_notify_send use peer_connection instead of peerDonald Sharp
The bgp_notify_send function should use a peer_connection Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-09bgpd: move t_pmax_restart to peer_connectionDonald Sharp
The t_pmax_restart event pointer belongs in the peer_connection pointer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-09bgpd: move t_gr_restart and _stale into peer_connectionDonald Sharp
The t_gr_restart and t_gr_stale event pointers belong into the peer_connection pointer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-09bgpd: move t_routeadv to peer_connectionDonald Sharp
The t_routeadv belongs to the peer_connection data structure Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-09bgpd: move t_start into peer_connectionDonald Sharp
The t_start event pointer belongs on the peer_connection Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-09bgpd: t_connect conversion from peer to peer_connectDonald Sharp
Move t_connect into struct peer_connect Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-05Merge pull request #14285 from ↵Russ White
opensourcerouting/feature/graceful_restart_dynamic_capability bgpd: Handle Graceful Restart capability using dynamic capabilities
2023-08-31Merge pull request #14282 from pguibert6WIND/fix_redistribute_table_flushDonatas Abraitis
bgpd: fix redistribute table command after bgp restarts
2023-08-30bgpd: Handle Graceful-Restart capability with dynamic capabilityDonatas Abraitis
Graceful-Restart restart time is exchanged using OPEN messages. In order to reduce restart time before doing an actual graceful restart, it might be useful to increase the time, but this is not possible without resetting the session. With this change, it's possible to send dynamic capability with a new value, and GR will respect a new reset time value. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-29Merge pull request #14288 from ↵Jafar Al-Gharaibeh
opensourcerouting/fix/warn_the_user_if_keepalive_was_changed bgpd: Add a warning for the operator that keepalive was changed
2023-08-29Merge pull request #14243 from opensourcerouting/fix/bgpd_ebgp_multihop_vty_outRuss White
bgpd: Do not explicitly print MAXTTL value for ebgp-multihop vty output
2023-08-29bgpd: Add a warning for the operator that keepalive was changedDonatas Abraitis
``` donatas-pc(config-router)# timers bgp 8 12 % keeplive value 8 is larger than 1/3 of the holdtime, setting to 4 donatas-pc(config-router)# do sh run | include timers bgp timers bgp 4 12 donatas-pc(config-router)# ``` Closes https://github.com/FRRouting/frr/issues/14287 Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-29bgpd: fix redistribute table command after bgp restartsPhilippe Guibert
When the BGP 'redistribute table' command is used for a given route table, and BGP configuration is flushed and rebuilt, the redistribution does not work. Actually, when flushing the BGP configuration with the 'no router bgp' command, the BGP redistribute entries related to the 'redistribute table' entries are not flushed. Actually, at BGP deletion, the table number is not given as parameter in bgp_redistribute_unset() function, and the redistribution entry is not removed in zebra. Fix this by adding some code to flush all the redistribute table instances. Fixes: 7c8ff89e9346 ("Multi-Instance OSPF Summary") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-08-21bgpd: Do not explicitly print MAXTTL value for ebgp-multihop vty outputDonatas Abraitis
1. Create /etc/frr/frr.conf ``` frr version 7.5 frr defaults traditional hostname centos8.localdomain no ip forwarding no ipv6 forwarding service integrated-vtysh-config line vty router bgp 4250001000 neighbor 192.168.122.207 remote-as 65512 neighbor 192.168.122.207 ebgp-multihop ``` 2. Start FRR `# systemctl start frr ` 3. Show running configuration. Note that FRR explicitly set and shows the default TTL (225) ``` Building configuration... Current configuration: ! frr version 7.5 frr defaults traditional hostname centos8.localdomain no ip forwarding no ipv6 forwarding service integrated-vtysh-config ! router bgp 4250001000 neighbor 192.168.122.207 remote-as 65512 neighbor 192.168.122.207 ebgp-multihop 255 ! line vty ! end ``` 4. Copy initial frr.conf to frr.conf.new (no changes) `# cp /etc/frr/frr.conf /root/frr.conf.new ` 5. Run frr-reload.sh: ``` $ /usr/lib/frr/frr-reload.py --test /root/frr.conf.new 2023-08-20 20:15:48,050 INFO: Called via "Namespace(bindir='/usr/bin', confdir='/etc/frr', daemon='', debug=False, filename='/root/frr.conf.new', input=None, log_level='info', overwrite=False, pathspace=None, reload=False, rundir='/var/run/frr', stdout=False, test=True, vty_socket=None)" 2023-08-20 20:15:48,050 INFO: Loading Config object from file /root/frr.conf.new 2023-08-20 20:15:48,124 INFO: Loading Config object from vtysh show running Lines To Delete =============== router bgp 4250001000 no neighbor 192.168.122.207 ebgp-multihop 255 Lines To Add ============ router bgp 4250001000 neighbor 192.168.122.207 ebgp-multihop ``` Closes https://github.com/FRRouting/frr/issues/14242 Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-18bgpd: Convert `struct peer_connection` to dynamically allocatedDonald Sharp
As part of the conversion to a `struct peer_connection` it will be desirable to have 2 pointers one for when we open a connection and one for when we receive a connection. Start this actual conversion over to this in `struct peer`. If this sounds confusing take a look at the bgp state machine for connections and how it resolves the processing of this router opening -vs- this router receiving an open. At some point in time the state machine decides that we are keeping one of the two connections. Future commits will allow us to untangle the peer/doppelganger duality with this abstraction. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-18bgpd: Move status and ostatus to `struct peer_connection`Donald Sharp
The status and ostatus are a function of the `struct peer_connection` move it into that data structure. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-18bgpd: READ and WRITE flags are a part of the connectionDonald Sharp
Move PEER_THREAD_WRITES_ON and PEER_THREAD_READS_ON to be a part of the `struct peer_connection` since this is a connection oriented bit of data. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-18bgpd: Move t_write and t_read into `struct peer_connection`Donald Sharp
Move the peer->t_write and peer->t_read into `struct peer_connection` as that these are properties of the connection. Signed-off-by: Donald Sharp <sharpd@nvidia.com> P# Please enter the commit message for your changes. Lines starting
2023-08-18bgpd: Start abstraction of `struct peer_connection`Donald Sharp
BGP tracks connections based upon the peer. But the problem with this is that the doppelganger structure for it is being created. This has introduced a bunch of fragileness in that the peer exists independently of the connections to it. The whole point of the doppelganger structure was to allow BGP to both accept and initiate tcp connections and then when we get one to a `good` state we collapse into the appropriate one. The problem with this is that having 2 peer structures for this creates a situation where we have to make sure we are configing the `right` one and also make sure that we collapse the two independent peer structures into 1 acting peer. This makes no sense let's abstract out the peer into having 2 connection one for incoming connections and one for outgoing connections then we can easily collapse down without having to do crazy stuff. In addition people adding new features don't need to have to go touch a million places in the code. This is the start of this abstraction. In this commit we'll just pull out the fd and input/output buffers into a connection data structure. Future commits will abstract further. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-16bgpd: Fix CLI descriptions for `bgp confederation identifier`Donatas Abraitis
Before the patch: ``` donatas-laptop(config-router)# bgp confederation identifier AS number in plain <1-4294967295> or dotted <0-65535>.<0-65535> format peers Peer ASs in BGP confederation ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-15Merge pull request #14016 from mjstapp/event_exec_ptrDonald Sharp
* : include event ptr in event_execute api
2023-08-09Merge pull request #14099 from lkClare/formated_sync_0727Donatas Abraitis
bgpd: bgp_path_info_extra memory optimization
2023-08-08bgpd: bgp_path_info_extra memory optimizationValerian_He
Even if some of the attributes in bgp_path_info_extra are not used, their memory is still allocated every time. It cause a waste of memory. This commit code deletes all unnecessary attributes and changes the optional attributes to pointer storage. Memory will only be allocated when they are actually used. After optimization, extra info related memory is reduced by about half(~400B -> ~200B). Signed-off-by: Valerian_He <1826906282@qq.com>
2023-08-05bgpd: Check if peer is established and dynamic capability-awareDonatas Abraitis
Add this logic inside bgp_capability_send() instead of repeating the whole logic before calling bgp_capability_send(). Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-05bgpd: Handle role capability using dynamic capabilityDonatas Abraitis
When setting local-role for the neighbor, force sending ROLE capability via dynamic capability if it's enabled. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-03bgpd: Check if we have such a peer before handling software capabilityDonatas Abraitis
Do not pass NULL for peer_established(), just in case. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-03bgpd: Handle software version capability dynamicalyDonatas Abraitis
We have dynamic capability support, but it handles only MP capability. With this change, we can enable software version capability dynamicaly, without resetting the session. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>