Commit Graph

19653 Commits

Author SHA1 Message Date
Donatas Abraitis
b9ad14e5e8 bgpd: Use sizeof() in bgp_dump_attr()
Missed this in 5022c8331d

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-08-19 15:59:30 +03:00
Donatas Abraitis
6e03b29bb0 bgpd: Use sizeof() in bgp_dump_attr()
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-08-19 15:54:05 +03:00
Donatas Abraitis
45fa94a942 bgpd: Dump attributes before returning from bgp_attr_malformed()
This would be handy for situations when a notification was sent, but it's
absolutely not clear who triggered that.

Just in case dumping all attributes under the debug mode would help finding
the _bad_ attribute.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-08-14 07:22:22 +03:00
Renato Westphal
e9faa35ccd
Merge pull request #6865 from volta-networks/fix_ldp_oc_withdraw_7.4
ldpd: ldp-oc withdraw fix
2020-08-05 20:59:34 -03:00
lynne
93580adb9c ldpd: ldp-oc withdraw fix
When LDP is configured in Order Control mode and we receive a
label withdraw message, we should only resend label withdraws to
peers that are the NH for that fec being withdrawn.  This is a
double commit.   Original fix in master is #6864.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2020-08-05 17:11:28 -04:00
Donatas Abraitis
599a268911
Merge pull request #6846 from sworleys/Evpn-Fix_74
[7.4] Zebra macfdb fixup
2020-08-04 09:22:01 +03:00
vivek
f0b014fdae zebra: Install bridge FDB entries with correct VTEP IP
Fixes: zebra: adapt and export rmac netlink functions

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2020-08-03 17:06:33 -04:00
vivek
9c0a2e5a29 zebra: Pass correct buffer to MAC FDB netlink message build
Fixes: zebra: adapt and export rmac netlink functions

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2020-08-03 17:06:22 -04:00
Donald Sharp
2c44ac162c
Merge pull request #6794 from ton31337/fix/handle_bgp_vrf_all_statistics_crash_7.4
bgpd: [7.4] Handle default bgp vrf all for statistics
2020-07-27 07:49:24 -04:00
Quentin Young
78292ed227
Merge pull request #6772 from opensourcerouting/7.4/netbsd-tls-buf
[7.4] lib: fix TLS log buffer on NetBSD
2020-07-24 14:53:35 -04:00
Donatas Abraitis
ad30a4304f bgpd: Do not crash if bgp argument is NULL for bgp_table_stats()
```
(gdb) bt
0  0x00007f45a6f0a781 in raise () from /lib/x86_64-linux-gnu/libc.so.6
1  0x00007f45a6ef455b in abort () from /lib/x86_64-linux-gnu/libc.so.6
2  0x00007f45a7781920 in core_handler (signo=11, siginfo=0x7fffac7b84b0, context=<optimized out>) at lib/sigevent.c:228
3  <signal handler called>
4  0x000055a4133c0f32 in bgp_table_stats (vty=vty@entry=0x55a415acb240, bgp=0x0, afi=AFI_IP, safi=SAFI_UNICAST, json_array=json_array@entry=0x0) at bgpd/bgp_route.c:11412
5  0x000055a4133c13fb in show_ip_bgp_afi_safi_statistics (self=<optimized out>, vty=0x55a415acb240, argc=6, argv=<optimized out>) at bgpd/bgp_route.c:10749
6  0x00007f45a773917d in cmd_execute_command_real (vline=vline@entry=0x55a415ab7e10, vty=vty@entry=0x55a415acb240, cmd=cmd@entry=0x0, filter=FILTER_RELAXED)
    at lib/command.c:909
7  0x00007f45a773afdf in cmd_execute_command (vline=vline@entry=0x55a415ab7e10, vty=vty@entry=0x55a415acb240, cmd=0x0, vtysh=vtysh@entry=0) at lib/command.c:968
8  0x00007f45a773b135 in cmd_execute (vty=vty@entry=0x55a415acb240, cmd=cmd@entry=0x55a415ace950 "show ip bgp vrf all statistics", matched=matched@entry=0x0,
    vtysh=vtysh@entry=0) at lib/command.c:1122
9  0x00007f45a7794d62 in vty_command (vty=vty@entry=0x55a415acb240, buf=0x55a415ace950 "show ip bgp vrf all statistics") at lib/vty.c:526
10 0x00007f45a7794fb6 in vty_execute (vty=vty@entry=0x55a415acb240) at lib/vty.c:1293
11 0x00007f45a7797804 in vtysh_read (thread=<optimized out>) at lib/vty.c:2126
12 0x00007f45a778f641 in thread_call (thread=thread@entry=0x7fffac7bb040) at lib/thread.c:1550
13 0x00007f45a775b6d8 in frr_run (master=0x55a415542820) at lib/libfrr.c:1098
14 0x000055a4133815d6 in main (argc=10, argv=0x7fffac7bb2a8) at bgpd/bgp_main.c:509
```

"show ip bgp vrf all statistics" should show statistics for all VRFs if "all"
is specified.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-23 15:56:45 +03:00
Donatas Abraitis
b5bae2c827 bgpd: Show the instance name when displaying statistics
```
exit1-debian-9# sh ip bgp vrf all statistics json
{
  "ipv4Unicast":[
    {
      "instance":"VRF default",
      "totalAdvertisements":2,
      "totalPrefixes":2,
      "averagePrefixLength":24,
      "unaggregateablePrefixes":2,
      "maximumAggregateablePrefixes":0,
      "bgpAggregateAdvertisements":0,
      "addressSpaceAdvertised":512,
      "%announced":1.1920928955078125e-05,
      "\/8equivalent":3.0517578125e-05,
      "\/24equivalent":2,
      "advertisementsWithPaths":2,
      "longestAsPath":0,
      "averageAsPathLengthHops":0,
      "largestAsPath":0,
      "averageAsPathSizeBytes":0,
      "highestPublicAsn":0
    },
    {
      "instance":"VRF testas",
      "totalAdvertisements":0,
      "totalPrefixes":0,
      "averagePrefixLength":0,
      "unaggregateablePrefixes":0,
      "maximumAggregateablePrefixes":0,
      "bgpAggregateAdvertisements":0,
      "addressSpaceAdvertised":0,
      "%announced":0,
      "\/8equivalent":0,
      "\/24equivalent":0,
      "advertisementsWithPaths":0,
      "longestAsPath":0,
      "averageAsPathLengthHops":0,
      "largestAsPath":0,
      "averageAsPathSizeBytes":0,
      "highestPublicAsn":0
    }
  ]
}
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-23 15:56:39 +03:00
David Lamparter
cacc6cc95e lib: fix TLS log buffer on NetBSD
... this didn't work on NetBSD.  Like, at all.  It returns a positive
error code from posix_fallocate() and then we bang our head against a
brick wall trying to write to the mmap'd buffer.

Signed-off-by: David Lamparter <equinox@diac24.net>
(cherry picked from commit 6a3b431b85)
2020-07-20 06:30:00 +02:00
Rafael Zalamena
5693f6e1c8
Merge pull request #6768 from ton31337/fix/bgp_mrai_bug_7.4
bgpd: [7.4] Fix the bug that BGP MRAI does not work
2020-07-19 11:39:52 -03:00
Richard Wu
2bbe7133eb bgpd: Fix the bug that BGP MRAI does not work.
Issue: bgp_process_writes will be called when the fd is writable.
       And it will bgp_generate_updgrp_packets to generate the
       update packets no matter MRAI is set or not.
Fix:   bgp_generate_updgrp_packets thread will return without sending
       any update when MRAI timer is still running.

Signed-off-by: Richard Wu <wutong23@baidu.com>
2020-07-18 21:44:49 +03:00
Rafael Zalamena
57fe007c77
Merge pull request #6744 from ton31337/fix/bgp_hostname_nexthop_if_unchanged_7.4
bgpd: [7.4] Show the real next-hop address in addition to hostname
2020-07-16 09:53:16 -03:00
Donatas Abraitis
8df39282ea doc: Add some words about bgp default show-[nexthop]-hostname
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-15 21:27:22 +03:00
Donatas Abraitis
104dfe5258 bgpd: Add "hostname" in JSON output for show bgp family outputs
This adds hostname regardless if `bgp default show-hostname` enabled or not.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-15 21:27:19 +03:00
Donatas Abraitis
e7cc3d2145 bgpd: Show the real next-hop address in addition to hostname in show bgp
It's hard to cope with cases when next-hop is changed/unchanged or
peers are non-direct.

It would be better to show the hostname and nexthop IP address (both)
under `show bgp` to quickly identify the source and the real next-hop
of the route.

If `bgp default show-nexthop-hostname` is toggled the output looks like:
```
spine1-debian-9# show bgp
BGP table version is 1, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 65002
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
*  2a02:4780::/64   fe80::a00:27ff:fe09:f8a3(exit1-debian-9)
                                             0             0 65001 ?

spine1-debian-9# show ip bgp
BGP table version is 5, local router ID is 2.2.2.2, vrf id 0
Default local pref 100, local AS 65002
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
*> 10.255.255.0/24  192.168.0.1(exit1-debian-9)
                                             0             0 65001 ?
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-15 21:27:15 +03:00
Donatas Abraitis
c6a5994609 tests: Remove bgp_show_ip_bgp_fqdn test
Not really relevant for now.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-15 21:27:10 +03:00
Donatas Abraitis
40858a3c7e
Merge pull request #6728 from idryzhov/vtysh-fixes
[7.4] cherry-pick vtysh fixes
2020-07-15 12:11:40 +03:00
Donatas Abraitis
80acc95357
Merge pull request #6733 from idryzhov/fix-changelog
[7.4] debian: fix changelog
2020-07-15 08:34:32 +03:00
Donatas Abraitis
62fd6027f9
Merge pull request #6737 from opensourcerouting/74-bfdd-frr-reload
[7.4] Add BFD peer awareness to frr-reload.py and vtysh markfile
2020-07-15 08:33:54 +03:00
Paul Manley
2604086c3d vtysh: properly exit BFD_PEER_NODE when marking file
vtysh needs to be aware of how to properly exit a bfd peer when subsequent commands only succeed in a higher context.

https://github.com/FRRouting/frr/issues/6511#issuecomment-656166206

Signed-off-by: Paul Manley <paul.manley@wholefoods.com>
(cherry picked from commit b727c12aab)
2020-07-14 13:44:40 -03:00
Paul Manley
692ce87393 tools: create sub-context for bfd peers
add lines starting with 'peer' to the list of sub-contexts that are handled by frr-reload.py.

https://github.com/FRRouting/frr/issues/6511#issuecomment-655163833

Signed-off-by: Paul Manley <paul.manley@wholefoods.com>
(cherry picked from commit 1c23a0aaa1)
2020-07-14 13:44:30 -03:00
Igor Ryzhov
ffaaa348f4 debian: fix changelog
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-07-14 14:29:56 +03:00
Donald Sharp
3e4d90ec55 vtysh: Improve lookup performance
When we find the line we are interested in, stop looking.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-07-13 19:07:04 +03:00
Donald Sharp
cc5934ed59 vtysh: master is a non-sorted list
The commit:
a798241265

attempted to use sorted master lists to do faster lookups
by using a RB Tree.  Unfortunately the original code
was creating a list->cmp function *but* never using it.
If you look at the commit, it clearly shows that the
function listnode_add is used to insert but when you
look at that function it is a tail push.

Fixes: #6573

Namely now this ordering is preserved:
bgp as-path access-list originate-only permit ^$
bgp as-path access-list originate-only deny .*

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-07-13 19:06:56 +03:00
Donald Sharp
0615c09282
Merge pull request #6714 from ton31337/feature/bgp_show_only_established_sessions_7.4
bgpd: [7.4] Add command to show only established sessions
2020-07-10 16:09:08 -04:00
Donatas Abraitis
2600443342 doc: Add 'show bgp summary established' command
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-10 11:23:30 +03:00
Donatas Abraitis
2939f712d1 bgpd: Add command to show only established sessions
```
exit1-debian-9# show bgp summary

IPv4 Unicast Summary:
BGP router identifier 192.168.0.1, local AS number 100 vrf-id 0
BGP table version 8
RIB entries 15, using 2880 bytes of memory
Peers 2, using 43 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
192.168.0.2     4        200        10         6        0    0    0 00:00:35            8        8
2a02:4780::2    4          0         0         1        0    0    0    never       Active        0

Total number of neighbors 2
exit1-debian-9# show bgp summary established

IPv4 Unicast Summary:
BGP router identifier 192.168.0.1, local AS number 100 vrf-id 0
BGP table version 8
RIB entries 15, using 2880 bytes of memory
Peers 2, using 43 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
192.168.0.2     4        200        10         6        0    0    0 00:00:39            8        8

Total number of neighbors 2
exit1-debian-9# show bgp summary failed

IPv4 Unicast Summary:
BGP router identifier 192.168.0.1, local AS number 100 vrf-id 0
BGP table version 8
RIB entries 15, using 2880 bytes of memory
Peers 2, using 43 KiB of memory

Neighbor        EstdCnt DropCnt ResetTime Reason
2a02:4780::2          0       0     never Waiting for peer OPEN

Total number of neighbors 2
exit1-debian-9#
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-10 11:23:26 +03:00
Donatas Abraitis
e5589cd8d2
Merge pull request #6683 from opensourcerouting/74-rmap-desc-leak-fix
[7.4] lib: fix route map description memory leak
2020-07-07 07:33:51 +03:00
Rafael Zalamena
cc45875e0d lib: fix route map description memory leak
Route map entries are not getting a chance to call `description` string
deallocation on shutdown or when the parent entry is destroyed, so lets
add a code to handle this in the `route_map_index_delete` function.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit f095133583)
2020-07-06 14:40:59 -03:00
Sri Mohana Singamsetty
738d473366
Merge pull request #6679 from ton31337/fix/large-community-list-set_sequence_7.4
bgpd: Some backports to 7.4
2020-07-06 10:38:54 -07:00
Donatas Abraitis
d5a157b7c3 bgpd: Actually find the sequence number for large-community-list
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-05 22:08:10 +03:00
Donatas Abraitis
acf6f22d15 bgpd: Return bool type for ecommunity_add_val and subgroup_announce_check
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-05 22:08:01 +03:00
Donatas Abraitis
71be4bd9ab
Merge pull request #6664 from donaldsharp/cpick_7.4
bgpd: Actually find the sequence number for `bgp extcommunity-list...`
2020-07-02 08:03:53 +03:00
Donald Sharp
34f6d0c67a bgpd: Actually find the sequence number for bgp extcommunity-list...
The code in the bgp extcommunity-list function was using
argv_find to get the correct idx.  The problem was that
we had already done argv_finds before and idx was non-zero
thus having us always set the seq pointer to what was last
looked up.  This causes us to pass in a value to the
underlying function and it would just wisely ignore it
causing a seq number of 0.

We would then write this seq number of 0 and then immediately
reject it on read in again.  BOO!

Actually handle argv_find the way it was meant to be.

Ticket:CM-29926
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-07-01 14:03:31 -04:00
Martin Winter
e4dcf108d6
FRRouting Release 7.4
BGPd
   Use sequence numbers for community lists
   Fixes to nexthop groups
   Add feature to limit outgoing number of routes
   Per Neighbor Graceful Restart
   Multiple Graceful Restart fixes
   Support sub-Type-4 and sub-Type-5 for the VPNv4 SRv6 backend
   rfc7606 support: treat certain malformed routes as withdraw
   allow origin override for route aggregates
   rfc6608 support: Subcodes for BGP Finite State Machine Error
   rfc7607 support: Codification of AS 0 Processing
   rfc6286 support: Autonomous-System-Wide Unique BGP Identifier for BGP-4
   Unequal cost multipath (a.ka. weighted ECMP) with BGP link-bandwidth
   Enable rfc8212 by default except datacenter profile
staticd
   Add debug support
vtysh
   Add copy command to copy config from file into running config
LDPd
   adding support for LDP ordered label distribution control
ISISd
   IS-IS Segment Routing support
SHARPd
   add initial support to add/remove lsps
Zebra
   fix broadcast address in IPv4 networks with /31 mask
   Add Graceful Restart support for Protocol Daemon restarts
lib
   migrate route-maps to use northbound interface
plus countless bug fixes and other improvements

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2020-06-30 13:08:57 +02:00
Russ White
08d14c8157
Merge pull request #6629 from ton31337/fix/network_check_import_for_static_bgp_7.4
bgpd: [7.4] Do not treat the route as martian for static BGP routes
2020-06-23 11:46:56 -04:00
Donatas Abraitis
7ca4ef12b8 bgpd: Do not treat the route as martian for static BGP routes
If we have something like:
```
ip route 1.1.1.0/24 Null0
!
router bgp 100
 no bgp ebgp-requires-policy
 neighbor 192.168.0.2 remote-as 200
 !
 address-family ipv4 unicast
  network 1.1.1.0/24
  redistribute connected
 exit-address-family
!
line vty
!
```

1.1.1.0/24 is not advertised due to martian nexthop (0.0.0.0). It starts
working only when we use `redistribute static`.

By checking if it's a BGP static route we able to announce
1.1.1.0/24 with `network 1.1.1.0/24` without redistribute even when
`bgp import-check` is enabled.

Disabling `bgp import-check` works as well, but it's enabled by default
since 7.4.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-06-23 16:45:39 +03:00
Donald Sharp
e28f42625e
Merge pull request #6570 from mjstapp/fix_daemon_fini_7_4
[7.4] Daemons should call frr_fini() on shutdown
2020-06-11 18:47:49 -04:00
Mark Stapp
70504ec45a *: have daemons call frr_fini() at termination
Fix a number of library and daemon issues so that daemons can
call frr_fini() during normal termination. Without this,
temporary logging files are left behind in /var/tmp/frr/.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-11 15:41:52 -04:00
Mark Stapp
5812b45fb3 lib: don't try to change/reset capabilities if process has none
A couple of daemons take/use no capabilities/privs; allow cleanup
of the privs/capabilities library module even if a daemon has no
caps.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-11 15:41:52 -04:00
Donald Sharp
c8296ab8af
Merge pull request #6558 from opensourcerouting/7.4/zlogbuf-litter
[7.4] lib: set up TLS log buffer after forking
2020-06-10 19:04:39 -04:00
Donald Sharp
9bf78e1b50
Merge pull request #6560 from ton31337/fix/configuration_for_labeled_unicast_in_place_7.4
bgpd: [7.4] Make sure network/aggregate-address commands lay down under labeled safi
2020-06-10 18:52:47 -04:00
Donatas Abraitis
48b38d5b27 bgpd: Make sure network/aggregate-address commands lay down under labeled safi
unicast and labeled-unicast share the same table, but configuration should
be visible for both independently. Without this fix it confuses a bit
because when you enter `network 10.0.0.0/24` under labeled-unicast it's
written in unicast family block.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-06-10 23:12:36 +03:00
David Lamparter
0f133bad7f lib: set up TLS log buffer after forking
... it contains our pid, so doing it before fork leads to littering
buffers since we try to clean up with the forked pid...

Fixes: #6541
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-06-10 20:38:02 +02:00
Donald Sharp
b286cd18e9
Merge pull request #6553 from ton31337/fix/bgp_dampening_vty_bug_7.4
bgpd: [7.4] Duplicate `bgp dampening ...` stuff
2020-06-10 11:08:03 -04:00
Donatas Abraitis
923e64a83b bgpd: Print dampening configuration per AF, not per neighbor
This caused duplicate `bgp dampening ...` to be printed per neighbor.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-06-10 16:25:00 +03:00