Commit Graph

688 Commits

Author SHA1 Message Date
Mark Stapp
a2700b5071 *: use gmtime_r, localtime_r exclusively
Stop using gmtime() or localtime() everywhere.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-05 13:26:16 -05:00
Donatas Abraitis
15569c58f8 *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__
Just keep the code cool.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05 20:23:23 +02:00
Quentin Young
fbb0740683
Merge pull request #5911 from ton31337/fix/no_check_if_assert
bgpd: Remove a test and return statement after assert
2020-03-05 13:16:30 -05:00
Donatas Abraitis
ce089777d4 bgpd: Remove a test and return statement after assert
No need to check if the variable is NULL and return after assert.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-04 20:19:12 +02:00
Donatas Abraitis
a8f58eb6a5 *: Use short version of bool expressions
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-04 15:04:23 +02:00
Donatas Abraitis
0bdcc3e3ef
Merge pull request #5809 from donaldsharp/vrf_name
Print out vrf name as well as id
2020-02-19 14:23:32 +01:00
Donald Sharp
137147c66a bgpd: Print out vrf name as well as id
The vrf_id is not enough context for people.  Use the
actual name of the vrf if you can.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-14 08:44:27 -05:00
Donald Sharp
469cbb0ffe bgpd: Further peer_sort refinements
Track the returned peer_sorted value and use it where
we can and recalculate where necessary.

This is an effort to reduce the amount of work done here.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-12 14:45:06 -05:00
Donald Sharp
bf0d28dcf7 bgpd: Create peer_sort_lookup()
The act of peer_sort() being called always set this value
even when we are just looking it up.  We need to seperate
out the idea of lookup from set.

For those places that this is immediately obvious that
this is a lookup switch over to using this function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-12 14:45:06 -05:00
Russ White
8d61adbf07
Merge pull request #5785 from ton31337/fix/replace_gtsm_hops_to_readable_macros
bgpd: Use readable macros for peer->gtsm_hops instead of literals
2020-02-11 10:40:35 -05:00
Donatas Abraitis
e2521429a6 bgpd: Use readable macros for peer->gtsm_hops instead of literals
Do the same way like BGP_DEFAULT_TTL

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-10 16:23:09 +02:00
Donatas Abraitis
892fedb611 bgpd: Replace bgp_flag_* to [UN]SET/CHECK_FLAG macros
Most of the code uses macros, thus let's keep the code unified.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-06 17:11:38 +02:00
Donatas Abraitis
975a328e2e *: Replace s_addr 0 => INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-06 09:00:12 +02:00
Donatas Abraitis
85c58de773
Merge pull request #5761 from qlyoung/fix-bgp-gr-cruft
Fix bgp gr style
2020-02-06 08:16:25 +02:00
Renato Westphal
ecaeb3b697
Merge pull request #5750 from qlyoung/fix-null-after-xfree
*: don't null after XFREE; XFREE does this itself
2020-02-05 01:49:08 -03:00
Quentin Young
362353195a bgpd, lib: fix style from BGP GR code
This patch fixes the noncompliant style for the following commit range:

4a6e80fbf
2ba1fe695
efcb2ebbb
8c48b3b69
dc95985fe
0f0444fbd
85ef4179a
eb451ee58
2d3dd828d
9e3b51a7f
d6e3c15b6
34aa74486
6102cb7fe
d7b3cda6f
2bb5d39b1
5f9c1aa29
5cce3f054
3a75afa4b
f009ff269
cfd47646b
2986cac29
055679e91
034e185dc
794b37d52
b0965c44e
949b0f24f
63696f1d8

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-04 15:19:04 -05:00
Quentin Young
e1b36e132b *: remove null check before XFREE
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-04 13:19:37 -05:00
Quentin Young
b3ba5dc7fe *: don't null after XFREE; XFREE does this itself
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-03 11:22:13 -05:00
Donald Sharp
13909c4fbc bgpd: Cleanup some bad formating
Some recent commits got some bad formating.  Clean this up.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-31 09:59:57 -05:00
bisdhdh
2ba1fe6951 bgpd: BGP Garaceful Restart debug logs.
Reorganizing bgp gr debug logs and code review comments.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:36:33 +05:30
bisdhdh
dc95985fe8 bgpd: Add rib-stale-time(running in Zebra).
* Added CLI commands to update rib-stale-time, running in
Cmd : "bgp gaceful-restart rib-stale-time (1-3000)".
Cmd : "no bgp gaceful-restart rib-stale-time".
* Integrating the hooks function for signalling from BGPD
to ZEBRA to ZEBRA to enable or disable GR feature in ZEBRA
depending on bgp per peer gr configuration.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:36:33 +05:30
bisdhdh
d7b3cda6f7 bgpd: BGP tcp session failed to apply GR configuration on the transferred
bgp tcp connection.

When the BGP peer is configured between two bgp routes  both routers would create
peer structure , when they receive each other’s open message. In this event both
speakers, open duplicate TCP sessions and send OPEN messages on each socket
simultaneously, the BGP Identifier is used to resolve which socket should be closed.
If BGP GR is enabled the old tcp session is dumped and the new session is retained.
So while this transfer of connection is happening, if all the bgp gr config
is not migrated to the new connection, the new bgp gr mode will never get applied.
Fix Summary:
1.  Replicate GR configuration from the old session to the new session in bgp_accept().
2.  Replicate GR configuration from stub to full-fledged peer in bgp_establish().
3.  Disable all NSF flags, clear stale routes (if present), stop  restart & stale timers
    (if they are running) when the bgp GR mode is changed to “Disabled”.
4.  Disable R-bit in cap, if it is not set the received open message.

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
cfd47646b3 bgpd: Adding changes for Selection Deferral Timer config cmd
and DS.

* Added config commands and data structures for deferral timer
configuration and processing.
Cmd : bgp graceful-restart select-defer-time (0-3600)
Cmd : no bgp graceful-restart select-defertime (0-3600)

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
Signed-off-by: Soman K S <somanks@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
2986cac299 bgpd: Adding BGP GR Per Neighbor show commands.
* Added new show command to show the graceful restart
information for each neighbor.
Cmd: show bgp [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] graceful-restart
* Changes to show neighbors commands for displaying
graceful restart information.
Cmd :show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
bisdhdh
794b37d521 bgpd: Adding BGP GR Global & Per Neighbour FSM changes
* Added FSM for peer and global configuration for graceful restart
 * Added debug option BGP_GRACEFUL_RESTART for logs specific to
 graceful restart processing

Signed-off-by: Biswajit Sadhu <sadhub@vmware.com>
2020-01-23 09:34:25 +05:30
David Lamparter
5d5393b943 bgpd: use new defaults system (v2)
This moves all the DFLT_BGP_* stuff over to the new defaults mechanism.
bgp_timers_nondefault() added to get better file-scoping.

v2: moved everything into bgp_vty.c so that the core BGP code is
independent of the CLI-specific defaults.  This should make the future
northbound conversion easier.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06 15:13:32 +01:00
David Lamparter
dd65f45ebc bgpd: move config-write to bgp_vty.c
There's no good reason to have this in bgpd.c;  it's just there
historically.  Move it to bgp_vty.c where it makes more sense.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-06 15:13:32 +01:00
Donald Sharp
2d3c8c2957
Merge pull request #5305 from ton31337/feature/draft-ietf-idr-deprecate-as-set-confed-set
bgpd: Reject incoming and outgoing UPDATES for AS_SET and AS_CONFED_SET
2019-12-03 21:29:09 -05:00
Donatas Abraitis
c8d6f0d6c4 bgpd: Replace magic number 1 for TTL to BGP_DEFAULT_TTL
For readability and maintainability purposes.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-27 10:48:17 +02:00
Russ White
20a4c5f4f1
Merge pull request #5285 from ton31337/fix/send_BGP_NOTIFY_CEASE_PEER_UNCONFIG_after_no_neighbor
bgpd: Notify "Peer De-configured" after entering 'no neighbor <neighb…
2019-11-19 11:39:13 -05:00
Donatas Abraitis
fb29348a19 bgpd: Reject routes having AS_SET or AS_CONFED_SET
This is the first step towards eliminating AS_SET and AS_CONFED_SET types
and obsolete them in the future.

More information:
https://datatracker.ietf.org/doc/html/draft-ietf-idr-deprecate-as-set-confed-set-02

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-14 19:19:04 +02:00
Donatas Abraitis
a935f597fc bgpd: Rework BGP dampening to be per AFI/SAFI
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>
2019-11-11 09:52:40 +02:00
Donatas Abraitis
4e2786df3e bgpd: Notify "Peer De-configured" after entering 'no neighbor <neighbor> cmd'
Before changes:

~# vtysh -c 'show ip bgp neighbors 192.168.0.2 json' | \
	jq '."192.168.0.2".lastNotificationReason'
null

After changes:

~# vtysh -c 'show ip bgp neighbors 192.168.0.2 json' | \
	jq '."192.168.0.2".lastNotificationReason'
"Cease/Peer Unconfigured"

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-06 20:38:02 +02:00
Donald Sharp
63265b5c1f *: Convert prefix_free to double pointer
Have the prefix_free code take a double pointer to free the data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02 16:13:44 -04:00
Rafael Zalamena
2b31007ca2 bgpd: expose sender side AS path loop detection
The sender side AS path loop detection code was implemented since the
import of Quagga code, however it was always disabled by a `ifdef`
guard.

Lets allow the user to decide whether or not to enable this feature on
run-time.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-10-29 16:29:09 -03:00
Donald Sharp
36f12ed703 bgpd: write variable is never used in cli function
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25 21:35:04 -04:00
Donald Sharp
2d50e11896
Merge pull request #5216 from ton31337/fix/override_peers_ttl_if_peer_group_configured
bgpd: Override peer's TTL only if peer-group is configured with TTL
2019-10-25 14:03:06 -04:00
Donatas Abraitis
a0903cd24c bgpd: Override peer's TTL only if peer-group is configured with TTL
When a peer-group is configured for an already configured eBGP neighbor,
ebgp-multihop command is removed for that peer.

This fix remains configured peer's ebgp-multihop value if peer-group does
not have ebgp-multihop configured.

!
router bgp 100
 neighbor A8 peer-group
 neighbor A9 peer-group
 neighbor A9 ebgp-multihop 12
 neighbor 3.3.3.3 remote-as 123
 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 4.4.4.4 remote-as 123
 !

spine1-debian-9#
spine1-debian-9# conf
spine1-debian-9(config)# router bgp 100
spine1-debian-9(config-router)# neighbor 3.3.3.3 peer-group A8
spine1-debian-9(config-router)# do sh run

!
router bgp 100
 neighbor A8 peer-group
 neighbor A9 peer-group
 neighbor A9 ebgp-multihop 12
 neighbor 3.3.3.3 remote-as 123
 neighbor 3.3.3.3 peer-group A8
 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 4.4.4.4 remote-as 123
!

spine1-debian-9(config-router)# neighbor 4.4.4.4 peer-group A9
spine1-debian-9(config-router)# do sh run

!
router bgp 100
 neighbor A8 peer-group
 neighbor A9 peer-group
 neighbor A9 ebgp-multihop 12
 neighbor 3.3.3.3 remote-as 123
 neighbor 3.3.3.3 peer-group A8
 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 4.4.4.4 remote-as 123
 neighbor 4.4.4.4 peer-group A9
!

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-10-23 18:04:14 +03:00
Donald Sharp
c2d020ad71 bgpd: Add ability to set tcp socket buffer size
Add -s X or --socket_size X to the bgp cli to allow
the end user to specify the outgoing bgp tcp kernel
socket buffer size.

It is recommended that this option is only used on
large scale operations.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-16 07:42:05 -04:00
Donatas Abraitis
a0a87037ac bgpd: Use uint32_t for maximum-prefix
Currently we have unsigned long which is not what we defined
in CLI (1-4294967295).

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-10-04 15:46:21 +03:00
Lou Berger
ef5307f23f
Merge pull request #4861 from NaveenThanikachalam/logs
BGP: Rectifying the log messages.
2019-09-17 11:33:43 -04:00
Quentin Young
b9b4c0610a lib: handle frr_pthread_init/fini in libfrr init
Make sure we are always cleaning init'ing and cleaning up pthread infra.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-09-16 16:12:04 +00:00
Naveen Thanikachalam
4cb5e18ba5 BGP: Rectifying the log messages.
This change addresses the following:
1) Ensures logs under DEBUG macro checks are categorized
   as zlog_debug instead of zlog_info.
2) Error logs are categorized as zlog_err instead of zlog_info.
3) Rephrasing certain logs to make them appear more intuitive.

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
2019-09-09 22:59:22 -07:00
Dinesh G Dutt
05912a17e6 bgpd: Fixes to error message printed for failed peerings
There was a silly bug introduced when the command to show failed sessions
was added. A missing "," caused the wrong error message to be printed.
Debugging this led down a path that:
   - Led to discovering one more error message that needed to be added
   - Providing the error code along with the string in the JSON output
     to allow programs to key off numbers rather than strings.
   - Fixing the missing ","
   - Changing the error message to "Waiting for Peer IPv6 LLA" to
     make it clear that we're waiting for the link local addr.

Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
2019-09-03 19:55:49 +00:00
Donald Sharp
0a6469e55e bgpd: Shut off keepalives as soon as we shutdown a peer
We have this crash:

2019-08-18T07:58:44.831656-04:00 rch2-140-fwK2b bgpd[1791]: %NOTIFICATION: sent to neighbor 10.73.248.8 4/0 (Hold Timer Expired) 0 bytes
2019-08-18T07:58:44.832164-04:00 rch2-140-fwK2b bgpd[1791]: Assertion `!((peer->thread_flags) & ((1 << 0)))' failed in file bgpd.c, line 2173, function peer_delete
2019-08-18T07:58:44.832548-04:00 rch2-140-fwK2b bgpd[1791]: Backtrace for 11 stack frames:
2019-08-18T07:58:44.832942-04:00 rch2-140-fwK2b bgpd[1791]: [bt 0] /usr/lib/libfrr.so.0(zlog_backtrace+0x3a) [0x7f5503c7c31a]
2019-08-18T07:58:44.833311-04:00 rch2-140-fwK2b bgpd[1791]: [bt 1] /usr/lib/libfrr.so.0(_zlog_assert_failed+0x61) [0x7f5503c7c891]
2019-08-18T07:58:44.833684-04:00 rch2-140-fwK2b bgpd[1791]: [bt 2] /usr/lib/frr/bgpd(peer_delete+0x4d5) [0x1432ceea15]
2019-08-18T07:58:44.834095-04:00 rch2-140-fwK2b bgpd[1791]: [bt 3] /usr/lib/frr/bgpd(+0x430e9) [0x1432cfc0e9]
2019-08-18T07:58:44.834479-04:00 rch2-140-fwK2b bgpd[1791]: [bt 4] /usr/lib/frr/bgpd(bgp_event_update+0x121) [0x1432cfe1c1]
2019-08-18T07:58:44.834852-04:00 rch2-140-fwK2b bgpd[1791]: [bt 5] /usr/lib/frr/bgpd(+0x453f1) [0x1432cfe3f1]
2019-08-18T07:58:44.835388-04:00 rch2-140-fwK2b bgpd[1791]: [bt 6] /usr/lib/libfrr.so.0(thread_call+0x60) [0x7f5503c9e3c0]
2019-08-18T07:58:44.835829-04:00 rch2-140-fwK2b bgpd[1791]: [bt 7] /usr/lib/libfrr.so.0(frr_run+0xb8) [0x7f5503c79de8]
2019-08-18T07:58:44.836292-04:00 rch2-140-fwK2b bgpd[1791]: [bt 8] /usr/lib/frr/bgpd(main+0x229) [0x1432ce4a69]
2019-08-18T07:58:44.836729-04:00 rch2-140-fwK2b bgpd[1791]: [bt 9] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f550271bb45]
2019-08-18T07:58:44.837198-04:00 rch2-140-fwK2b bgpd[1791]: [bt 10] /usr/lib/frr/bgpd(+0x2cefc) [0x1432ce5efc]
2019-08-18T07:58:44.837670-04:00 rch2-140-fwK2b bgpd[1791]: Current thread function (bgp_holdtime_timer), scheduled from file bgp_fsm.c, line 380

This is the code:
	bgp_reads_off(peer);
	bgp_writes_off(peer);
	assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON));
	assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_READS_ON));

The line crashing is the first assert.  We know in bgp_writes_off we unset this flag:

void bgp_writes_off(struct peer *peer)
{
        struct frr_pthread *fpt = bgp_pth_io;
        assert(fpt->running);

        thread_cancel_async(fpt->master, &peer->t_write, NULL);
        THREAD_OFF(peer->t_generate_updgrp_packets);

        UNSET_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON);
}

We also know that the keepalives are not being turned off until we call
bgp_fsm_change_status(peer, Deleted);

later in the function.  We know that the keepalive pthread will
write to individual peers and issue a bgp_write_on(), which sets
this flag.

Modify the code base so that we explicitly turn off the keepalives
immediately before the turning of writes off.

Ticket: CM-26119
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-27 16:12:07 -04:00
Dinesh Dutt
dcc1615e1b bgpd: Display received and advertised EVPN routes from neighbors
"show bgp l2vpn evpn neighbors <neighbor> [advertised-routes|routes]' did
not work due to various bugs. First, the command only accepted IPv4
addresses as valid neighbor ID, thereby rejecting unnumbered BGP and IPv6
neighbor address. Second, the SAFI was hardcoded to MPLS_VPN even though
we were passing the safi. Third, "all" made no sense in the command context
and to make the command uniform across all address families, I removed the
"all" keyword from the command.

Signed-off-by: Dinesh G Dutt <ddps4u@gmail.com>
2019-08-08 04:17:26 +00:00
David Lamparter
2b9bcf306d bgpd: add instance delete & config write hooks
Both of these hooks are necessary for proper operation of extensions
that need to latch on to a particular instance.

- without the delete hook, it's impossible to get rid of stale
  references, leading to crashes with invalid instance pointers.
- the config-write hook is necessary because per-instance config needs
  to be written inside the "router bgp" block to have the appropriate
  context; adding a separate config node can't do that.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-07-03 16:56:22 +02:00
David Lamparter
2ed9fe4a2b bgpd: autocomplete "router bgp" ASN
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-07-03 16:55:24 +02:00
Quentin Young
2951a7a4c2 *: s/TRUE/true/, s/FALSE/false/
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-07-01 17:26:05 +00:00
Donald Sharp
a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
Donald Sharp
a12bb225a6
Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2
Ospf missing interface handling 2
2019-06-22 13:35:45 -04:00
Donald Sharp
d5568431f7 bgpd: BGP_ERR_MULTIPLE_INSTANCE_NOT_SET is an impossible condition
This code is not returned anywhere in the system as that bgp
is by default multiple-instance 'only' now.  So remove
the last remaining bits of it from the code base.

Remove BGP_ERR_MULTIPLE_INSTANCE_USED too.

Make bgp_get explicitly return BGP_SUCCESS
instead of 0.

Remove the multi-instance error code too.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-18 09:26:00 -04:00
Quentin Young
dec5b24733
Merge pull request #4505 from ton31337/feature/autocomplete_bgp_peer-group
bgpd: List all groups dynamically for commands with peer-group
2019-06-17 13:53:48 -04:00
Sri Mohana Singamsetty
0590d2d209
Merge pull request #4512 from mjstapp/fix_bgp_auto_rid
bgpd: auto router-id should not change configured vpn RD/RT
2019-06-13 17:55:59 -07:00
Mark Stapp
e65fe398f6 bgpd: auto router-id should not change configured vpn RD/RT
A router-id change that isn't explicitly configured (a change
from zebra, for example) should not replace a configured vpn
RD/RT.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-06-12 11:37:05 -04:00
Philippe Guibert
f11e98eca3 *: change if_lookup_by_name() api with vrf
the vrf_id parameter is replaced by struct vrf * parameter.
this impacts most of the daemons that look for an interface based on the
name and the vrf identifier.
Also, it fixes 2 lookup calls in zebra and sharpd, where the vrf_id was
ignored until now.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 08:37:54 +02:00
Donatas Abraitis
d7b9898c7f bgpd: List all groups dynamically for commands with peer-group
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-06-11 23:29:32 +03:00
Soman K S
9f822fa2db bgpd: Process core when bgp instance is deleted
* When the bgp is being deleted and routes are in clear workqueue
  and new aggregate address being allocated
* Added flag BGP_FLAG_DELETE_IN_PROGRESS in bgp structure to
  bgp instance is being  deleted
* When adding aggregate route check this flag and  peer_self is valid

Signed-off-by: Soman K S <somanks@vmware.com>
2019-06-11 06:20:09 -07:00
Donald Sharp
d8a9922d58 bgpd: Remove BGP_OPT_CONFIG_CISCO
The BGP_OPT_CONFIG_CISCO command could no longer be set
as such remove it from the system as a viable option to
be used.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-03 15:06:16 -04:00
Donald Sharp
8fbb485392 bgpd: Remove BGP_OPT_MULTIPLE_INSTANCE flag
Since we no-longer allow you to select multiple-instance
or not from the cli, let's completely remove the flag
as well.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-03 14:53:55 -04:00
Philippe Guibert
e8ba52931a bgpd: upon peer unconfiguration, remove bfd context if any
upon peer unconfiguration, remove bfd context if necessary.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-05-21 18:02:28 +02:00
Renato Westphal
6982ab8f68 bgpd: remove deprecated "bgp enforce-first-as" command
The one-year deprecation period has passed, remove it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-05-20 22:04:52 -03:00
Quentin Young
d8b87afe7c lib: hashing functions should take const arguments
It doesn't make much sense for a hash function to modify its argument,
so const the hash input.

BGP does it in a couple places, those cast away the const. Not great but
not any worse than it was.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-14 21:23:08 +00:00
Naveen Thanikachalam
6c3247bd2a lib, bgpd: Disallow processing of duplicate config.
This fix aims to reduce the load on BGPD when certain
exisiting configurations are replayed.
Specifically, the fix prevents BGPD from processing
routes when the following already existing configurations
are replayed:
1) A match criteria is configured within a route-map.
2) When "call" is invoked within a route-map.
3) When a route-map is tied to a BGP neighbor.

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
2019-05-08 21:22:23 -07:00
Donald Sharp
5e76ce5069
Revert "bgpd: Prevent IPv6 routes received via a ibgp session with own ip as nexthop " 2019-05-02 07:15:39 -04:00
Biswajit Sadhu
2f6197b044 bgpd: Prevent IPv6 routes received via a ibgp session with own ip as nexthop
Prevent IPv6 routes received via a ibgp session with one of its own interface
ip as nexthop from getting installed in the BGP table.

Implemented IPV6 HASH table, where we need to add any ipv6 address as they
gets configured and delete them from the HASH table as the ipv6 addresses
get unconfigured. The above hash table is used to verify if any route learned
via BGP has nexthop which is equal to one of its its connected ipv6 interface.

Signed-off-by: Biswajit Sadhu sadhub@vmware.com
2019-04-24 00:40:01 -07:00
Quentin Young
9e7d9a61ac bgpd: add support for MD5 auth on listen ranges
Co-authored-by: Donald Sharp <sharpd@cumulusnetworks.com>
Co-authored-by: Quentin Young <qlyoung@cumulusnetworks.com>
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-04-16 15:26:20 +00:00
Donald Sharp
06566f41f7
Merge pull request #3923 from Tuetuopay/evpn-session-vrf
Add support for EVPN session in the non-default VRF
2019-04-03 08:00:14 -04:00
Russ White
febe440bc4
Merge pull request #3931 from chiragshah6/evpn_dev1
bgpd: vrf route-leak router-id change reflect to vpn auto rd rt
2019-04-02 11:59:35 -04:00
Tuetuopay
d074383c62
Merge branch 'master' into evpn-session-vrf 2019-03-28 18:41:38 +01:00
Tuetuopay
e2f3a930c5 bgpd: Allow non-default instance to be EVPN one
This makes the instance bearing the advertise-all-vni config option
register to zebra as the EVPN one, forwarding it the option.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:14 +01:00
Donald Sharp
86dd09667a
Merge pull request #3920 from AkhileshSamineni/show_bgp_ipv6_summary_fix_master
bgpd: Incorrect number of peers count in "show bgp ipv6 summary" output
2019-03-15 08:54:03 -04:00
Chirag Shah
636f76088d bgpd: router-id change reflect to vpn auto rd rt
VRF route leak auto RD and RT uses router-id,
when a router-id changes for a bgp instance, change
associated vpn RD and RT values. Withdraw
old RD/RT routes from vpn and with new
RD/RT values advertise new routes to vpn.

One of the sceanrio is restarting frr:
A router-id change may not have reflected
for bgp vrf instance X, while import vrf X
under bgp vrf instance Y.
Once router-id changes for bgp VRF X,
change RD and RTs from export VRF and
imported VRFs. Readvertise routes with new
values to VPN.

Ticket:CM-24149
Reviewed By:CCR-8394
Testing Done:

Validated via configured multiple bgp VRF instances
and enable route leaks among them, restart frr
and all instance received correct RD and RT values.
Checked 'show bgp vrf all ipv4 unicast route-leak'
and vpn table 'show bgp ipv4 vpn all' output.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-03-11 13:46:46 -07:00
David Lamparter
83152933da
Merge pull request #3898 from dslicenc/peer-group-remote-as
bpgd: resolve more neighbor peer-group issues
2019-03-11 19:40:24 +01:00
Akhilesh Samineni
210ec2a0d6 bgpd: Incorrect number of peers count in "show bgp ipv6 summary output
The "show bgp ipv6 summary" output displays incorrect number of peers count.

sonic# show bgp ipv6 summary

IPv6 Unicast Summary:
BGP router identifier 10.1.0.1, local AS number 65100 vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 5, using 103 KiB of memory
Peer groups 1, using 64 bytes of memory

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2003::1 4 65099 0 0 0 0 0 never Active
2088::1 4 65100 0 0 0 0 0 never Active
3021::2 4 65100 0 0 0 0 0 never Active

Total number of neighbors 3
sonic#
In the above output, the peers count displays as 5 but the actual peer count is 3, i.e.. 3 neighbors are activated in ipv6 unicast address family.
Displayed peer count (5) is the number of the neighbors activated in a BGP instance.

Fix : Now the peers count displays the number of neighbors activated per afi/safi.
After Fix:
sonic# show bgp ipv6 summary

IPv6 Unicast Summary:
BGP router identifier 10.1.0.1, local AS number 65100 vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 3, using 62 KiB of memory
Peer groups 1, using 64 bytes of memory

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2003::1 4 65099 0 0 0 0 0 never Active
2088::1 4 65100 0 0 0 0 0 never Active
3021::2 4 65100 0 0 0 0 0 never Active

Total number of neighbors 3
sonic#

Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
2019-03-07 13:17:25 +05:30
David Lamparter
d3b05897ed
Merge pull request #3869 from qlyoung/cocci-fixes
Assorted Coccinelle fixes
2019-03-06 15:54:44 +01:00
Don Slice
390485fdc9 bpgd: resolve more neighbor peer-group issues
Found in testing that in a certain sequence, a neighbor's peer-group
membership would be lost.  This fix resolves that issue. Additionally
found that "no neighbor swp1 remote-as 2" would sometimes leave the
config with "neighbor swp1 remote-as 0" rather than removing from the
config. That one is also resolved.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-03-02 19:44:10 +00:00
Quentin Young
9f5dc3192e *: remove casts of XMALLOC / XCALLOC
No cast necessary for void *

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:46 +00:00
Quentin Young
0a22ddfbb1 *: remove null check before XFREE
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:46 +00:00
Quentin Young
d8729f8cb5 *: use proper bool initializers & fix comparisons
- bools should be initialized with true/false
- bools do not need to be compared

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:16 +00:00
Donatas Abraitis
afad5cedf1 bgpd: Add peer action for PEER_FLAG_IFPEER_V6ONLY flag
peer_flag_modify() will always return BGP_ERR_INVALID_FLAG because
the action was not defined for PEER_FLAG_IFPEER_V6ONLY flag.

```
global PEER_FLAG_IFPEER_V6ONLY = 16384;
global BGP_ERR_INVALID_FLAG = -2;

probe process("/usr/lib/frr/bgpd").statement("peer_flag_modify@/root/frr/bgpd/bgpd.c:3975")
{
	if ($flag == PEER_FLAG_IFPEER_V6ONLY && $action->type == 0)
		printf("action not found for the flag PEER_FLAG_IFPEER_V6ONLY\n");
}

probe process("/usr/lib/frr/bgpd").function("peer_flag_modify").return
{
	if ($return == BGP_ERR_INVALID_FLAG)
		printf("return BGP_ERR_INVALID_FLAG\n");
}
```
produces:
action not found for the flag PEER_FLAG_IFPEER_V6ONLY
return BGP_ERR_INVALID_FLAG

$ vtysh -c 'conf t' -c 'router bgp 20' -c 'neighbor eth1 interface v6only remote-as external'

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-02-25 21:19:37 +02:00
David Lamparter
cbcaac3fb1
Merge pull request #3746 from ton31337/feature/rfc_8212
bgpd: Implement RFC8212
2019-02-19 13:54:23 +01:00
Donatas Abraitis
9dac9fc80e bgpd: Implement RFC8212
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-02-17 23:17:00 +02:00
Philippe Guibert
ee66b77f0e bgpd: if vrf is unknown, bgp deletion not complete
there are some cases where the bgp deletion will not be complete, while
the vrf identifier of the bgp instance is not completely identified. The
vrf search based on the bgp name is the better protection, since the bgp
vrf instance is created, even if the vrf identifier is not yet known.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-02-11 14:04:52 +01:00
rgirada
b4897fa524 bgpd: Added changes to track route-map usage
Made changes and updated the routemap applied counter in the following flows.
1.Increment when route map attached to a list.
2.Decrement when route map removed / modified from a  list.
3.Increment/decrement when route map create/delete callback triggered.
4.Besides ,This counter need not be updated when a route map is got updated.
  i.e changing/adding a match value to the existing routemap.

In BGP , same update api called for all three add/delete/update operation .
But this counter have to be updated only for routemap addition.
Addressed this specific change by identifying the routemap operation based
on routemap pointer.

Signed-off-by: RajeshGirada <rgirada@vmware.com>
2019-02-04 05:27:56 -08:00
Donald Sharp
37c9b64746
Merge pull request #3690 from pguibert6WIND/detach_vrf_labels_del_bgp
bgpd: detach vrf labels allocated, when removing bgp instance
2019-01-30 07:36:57 -05:00
Russ White
fc6da51705
Merge pull request #3653 from dslicenc/bgpd-remote-as
bgpd: improve peer-group remote-as definitions
2019-01-29 09:58:02 -05:00
Philippe Guibert
dfd17258d2 bgpd: detach vrf labels allocated, when removing bgp instance
bgp instance is disabling the label allocated to reach vrf entity.
previously, only vrf disabling was removing the label. now, when bgp
leaves, bgp instance also frees the label used.

PR=62306
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Acked-by: Julien Floret <julien.floret@6wind.com>
2019-01-29 08:54:22 +01:00
Donald Sharp
dc2f50f378 bgpd: interface based peers should automatically override it's peer group
When a interface based peer is setup and if it is part of a peer
group we should ignore this and just use the PEER_FLAG_CAPABILITY_ENHE
no matter what.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-25 20:40:05 -05:00
Ruben Kerkhof
4d762f2607 Treewide: use ANSI function definitions
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2019-01-24 11:21:59 +01:00
Don Slice
faa16034cb bgpd: improve peer-group remote-as definitions
Problem reported that with certain sequences of defining the
remote-as on the peer-group and the members, the configuration would
become wrong, with configured remote-as settings not reflected in
the config but peers unable to come up.  This fix resolves these
inconsistencies.

Ticket: CM-19560
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-01-23 12:23:47 +00:00
Renato Westphal
1c4213d862
Merge pull request #3198 from donaldsharp/mac_rejection
Mac rejection
2019-01-10 11:21:18 -02:00
Donald Sharp
3c195d60db bgpd: Fix confederation identifier unsigned display
The confederation identifier is a `as_t` type which is a
uint32_t underneath the covers.  Display it using a %u

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-16 09:43:40 -05:00
Donald Sharp
48ecf8f510 bgpd: Add code to dump the forthcoming mac hash
Add a bit of code that allows us to dump the mac hash.  Future
commits will actually add entries to the mac hash and then operate
on it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-12 16:11:45 -05:00
Lou Berger
9bdb632c68
Merge pull request #3093 from donaldsharp/bgp_node_continued
Bgp node continued
2018-12-11 11:13:25 -05:00
Philippe Guibert
0768f289e0 bgpd: delay destruction of label pool
label pool finalisation must be delayed after route deletion on bgp.
otherwise a crash will happen, while labels will be released.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-12-05 18:24:12 +01:00
Russ White
19e5a46591
Merge pull request #3176 from chiragshah6/evpn_dev
zebra: duplicate address detection and dampening
2018-11-25 22:17:33 -05:00
root
36dc75886d bgpd: Creating Loopback Interface Flaps BGPd (#2865)
* The function bgp_router_id_zebra_bump() will check for active bgp
  peers before chenging the router ID.
  If there are established peers, router ID is not modified
  which prevents the flapping of established peer connection

* Added field in bgp structure to store the count of established peers

Signed-off-by: kssoman <somanks@vmware.com>
2018-11-19 04:35:32 -08:00
Chirag Shah
85c8d83b81 bgpd: dup addr detect data struct for cfg
Enable/disable duplicate address detection
there are 3 actions
warning-only: Default action which generates
only frr warning (syslog) to user for any
duplicate detecton
freeze: Permanently freezes address, manual
intervene required.
freeze with time: An address will recover once
the time has expired (auto-recovery).

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-11-17 19:22:16 -08:00
Donald Sharp
67009e2200 bgpd: Abstract bgp_table retrieving/setting from info pointer
Convert the set/get of bgp_table's from the info pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-16 09:43:35 -05:00