Commit Graph

22862 Commits

Author SHA1 Message Date
Donald Sharp
555691e96e ospfd: Prevent duplicate packet read in certain vrf situations
Currently if the sysctl net.ipv4.raw_l3mdev_accept is 1, packets
destined to a specific vrf also end up being delivered to the default
vrf.  We will see logs like this in ospf:

2021/02/10 21:17:05.245727 OSPF: ospf_recv_packet: fd 20(default) on interface 1265(swp1s1.26)
2021/02/10 21:17:05.245740 OSPF: Hello received from [9.9.36.12] via [swp1s1.26:200.254.26.13]
2021/02/10 21:17:05.245741 OSPF:  src [200.254.26.14],
2021/02/10 21:17:05.245743 OSPF:  dst [224.0.0.5]
2021/02/10 21:17:05.245769 OSPF: ospf_recv_packet: fd 45(vrf1036) on interface 1265(swp1s1.26)
2021/02/10 21:17:05.245774 OSPF: Hello received from [9.9.36.12] via [swp1s1.26:200.254.26.13]
2021/02/10 21:17:05.245775 OSPF:  src [200.254.26.14],
2021/02/10 21:17:05.245777 OSPF:  dst [224.0.0.5]

This really really makes ospf unhappy in the vrf we are running in.

I am approaching the problem by just dropping the packet if read in the
default vrf because of:

commit 0556fc33c7
Author: Donald Sharp <sharpd@cumulusnetworks.com>
Date:   Fri Feb 1 11:54:59 2019 -0500

    lib: Allow bgp to always create a listen socket for the vrf

Effectively if we have `router ospf vrf BLUE` but no ospf running
in the default vrf, we will not have a listener and that would
require a fundamental change in our approach to handle the ospf->fd
at a global level.  I think this is less than ideal at the moment
but it will get us moving again and allow FRR to work with
a bunch of vrf's and ospf neighbors.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-11 07:31:05 -05:00
Russ White
d887c7bf04
Merge pull request #7973 from sworleys/Pbr-More-Fixes
zebra,pbrd,doc: PBR more fixes
2021-02-09 07:37:09 -05:00
Russ White
a384dd69d8
Merge pull request #7980 from gromit1811/fix_ospf6_lsa_str_oob
Fix ospf6 LSA formatting out-of-bounds access
2021-02-09 07:36:29 -05:00
Donatas Abraitis
7e6295a4b0
Merge pull request #8042 from donaldsharp/smaller_timers_blackhole
tests: Modify timers on bgp_blackhole_community
2021-02-09 12:04:33 +02:00
Donald Sharp
04aabf1b27
Merge pull request #8027 from ton31337/fix/remove_json_aggregatorasmalformed
bgpd: Remove aggregatorAsMalformed related outputs JSON and non-JSON
2021-02-08 20:11:54 -05:00
Donald Sharp
350bdbdd95 tests: Modify timers on bgp_blackhole_community
Modify the timers on the bgp_blackhole_community test to
be more aggressive so our test system will recover faster
when we drop packets.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-08 19:37:58 -05:00
Donald Sharp
7a0df480c4
Merge pull request #8028 from ton31337/fix/aggregator_dump_attributes_if_zero
bgpd: Dump BGP attrs to check what's the actual prefix with aggr_as 0
2021-02-08 16:02:17 -05:00
Donald Sharp
8920ec2827
Merge pull request #8038 from imzyxwvu/same-attr
bgpd: Do not compare attr again.
2021-02-08 15:31:43 -05:00
zyxwvu Shi
aeadbd9e19 bgpd: Do not compare attr again.
`same_attr` has been computed and `hook_call(bgp_process)` (calling
BMP module) would not change it. We could reuse the value to filter
same attribute updates, avoiding an extra comparison.

Signed-off-by: zyxwvu Shi <i@shiyc.cn>
2021-02-08 20:09:02 +08:00
Donatas Abraitis
d6b92dded3
Merge pull request #8032 from donaldsharp/dp_uninited
Some bfd valgrind issues
2021-02-08 12:03:25 +02:00
Donatas Abraitis
95cf9cb58a
Merge pull request #8031 from donaldsharp/duplicate
bgpd: Remove the double decleration of bgp_global_evpn_node_lookup
2021-02-08 10:04:14 +02:00
Quentin Young
5609ba6ad4
Merge pull request #7946 from ckishimo/ospfv3_json_2
tests: add ospf6 support via json files
2021-02-08 01:23:25 -05:00
Quentin Young
e8b731e86a
Merge pull request #8030 from anlancs/fix-pim-debug-double-check
Fix double check, remove one
2021-02-08 00:43:06 -05:00
anlancs
3655f3549e pimd: check debug flag one time
debug flag checked twice, just keep one.

Signed-off-by: anlancs <anlan_cs@tom.com>
2021-02-08 09:15:32 +08:00
Donald Sharp
14b3514806 bfdd: Prevent use after free ( again )
Valgrind is still reporting:

466020-==466020==    by 0x11B9F4: main (bfdd.c:403)
466020-==466020==  Address 0x5a7d544 is 84 bytes inside a block of size 272 free'd
466020:==466020==    at 0x48399AB: free (vg_replace_malloc.c:538)
466020-==466020==    by 0x490A947: qfree (memory.c:140)
466020-==466020==    by 0x48F2AE8: if_delete (if.c:322)
466020-==466020==    by 0x48F250D: if_destroy_via_zapi (if.c:195)
466020-==466020==    by 0x497071E: zclient_interface_delete (zclient.c:2040)
466020-==466020==    by 0x49745F6: zclient_read (zclient.c:3687)
466020-==466020==    by 0x4955AEC: thread_call (thread.c:1684)
466020-==466020==    by 0x48FF64E: frr_run (libfrr.c:1126)
466020-==466020==    by 0x11B9F4: main (bfdd.c:403)
466020-==466020==  Block was alloc'd at
466020:==466020==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
466020-==466020==    by 0x490A805: qcalloc (memory.c:115)
466020-==466020==    by 0x48F23D6: if_new (if.c:160)
466020-==466020==    by 0x48F257F: if_create_name (if.c:214)
466020-==466020==    by 0x48F3493: if_get_by_name (if.c:558)
466020-==466020==    by 0x49705F2: zclient_interface_add (zclient.c:1989)
466020-==466020==    by 0x49745E0: zclient_read (zclient.c:3684)
466020-==466020==    by 0x4955AEC: thread_call (thread.c:1684)
466020-==466020==    by 0x48FF64E: frr_run (libfrr.c:1126)
466020-==466020==    by 0x11B9F4: main (bfdd.c:403)

Apparently the bs->ifp pointer is being set even in cases when
the bs->key.ifname is not being set.  So go through and just
match the interface pointer and cut-to-the-chase.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-07 15:03:51 -05:00
Donald Sharp
37a74717c7 *: Fix usage of bfd_adj_event
Valgrind reports:

469901-==469901==
469901-==469901== Conditional jump or move depends on uninitialised value(s)
469901:==469901==    at 0x3A090D: bgp_bfd_dest_update (bgp_bfd.c:416)
469901-==469901==    by 0x497469E: zclient_read (zclient.c:3701)
469901-==469901==    by 0x4955AEC: thread_call (thread.c:1684)
469901-==469901==    by 0x48FF64E: frr_run (libfrr.c:1126)
469901-==469901==    by 0x213AB3: main (bgp_main.c:540)
469901-==469901==  Uninitialised value was created by a stack allocation
469901:==469901==    at 0x3A0725: bgp_bfd_dest_update (bgp_bfd.c:376)
469901-==469901==
469901-==469901== Conditional jump or move depends on uninitialised value(s)
469901:==469901==    at 0x3A093C: bgp_bfd_dest_update (bgp_bfd.c:421)
469901-==469901==    by 0x497469E: zclient_read (zclient.c:3701)
469901-==469901==    by 0x4955AEC: thread_call (thread.c:1684)
469901-==469901==    by 0x48FF64E: frr_run (libfrr.c:1126)
469901-==469901==    by 0x213AB3: main (bgp_main.c:540)
469901-==469901==  Uninitialised value was created by a stack allocation
469901:==469901==    at 0x3A0725: bgp_bfd_dest_update (bgp_bfd.c:376)

On looking at bgp_bfd_dest_update the function call into bfd_get_peer_info
when it fails to lookup the ifindex ifp pointer just returns leaving
the dest and src prefix pointers pointing to whatever was passed in.

Let's do two things:

a) The src pointer was sometimes assumed to be passed in and sometimes not.
Forget that.  Make it always be passed in
b) memset the src and dst pointers to be all zeros.  Then when we look
at either of the pointers we are not making decisions based upon random
data in the pointers.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-07 14:59:53 -05:00
Donald Sharp
c39b56205a bgpd: Remove the double decleration of bgp_global_evpn_node_lookup
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-07 07:35:38 -05:00
Donatas Abraitis
4877b70b53 bgpd: Dump BGP attrs to check what's the actual prefix with aggr_as 0
Just for more debug information regarding malformed aggregator_as.

```
bgpd[5589]: [EC 33554434] 192.168.10.25: AGGREGATOR AS number is 0 for aspath: 65030
bgpd[5589]: bgp_attr_aggregator: attributes: nexthop 192.168.10.25, origin i, path 65030
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-02-06 14:01:13 +02:00
Donatas Abraitis
88d495a961 bgpd: Remove aggregatorAsMalformed related outputs JSON and non-JSON
Already not necessary, because if BGP aggregator AS attribute is with
value of 0, then the attribute is already discarded at early processing.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-02-06 13:45:30 +02:00
Quentin Young
658186e8b6
Merge pull request #7937 from pjdruddy/topotest-evpn-svi-advertise
tests: update EVPN VXLAN for SVI behaviour change
2021-02-05 14:30:55 -05:00
Quentin Young
684b9f2447
Merge pull request #7981 from gromit1811/fix_ospf6_lsa_str_retval
ospf6d: Fix LSA formatting inconsistent retvals
2021-02-05 14:08:37 -05:00
Donald Sharp
503f20e40e
Merge pull request #8019 from ton31337/fix/bgpd_aggregator_0
bgpd: Unset only aggregator flag when AGGREGATOR_AS is 0
2021-02-05 12:33:29 -05:00
Donald Sharp
6ddbc710cc
Merge pull request #7218 from kuldeepkash/multicast_pim_bsm
tests: Add multicast-pim-bsm-topo1 suite
2021-02-05 10:20:15 -05:00
Donatas Abraitis
e836423849 bgpd: Unset only aggregator flag when AGGREGATOR_AS is 0
Avoid mangling packet size which is expected to be the same as received.

Stream pointer advancing is necessary to avoid changing the packet and
reseting BGP sessions.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-02-05 16:47:55 +02:00
Donald Sharp
1889e8e876
Merge pull request #7126 from vijaykug/multicast_with_static_rp
tests: Add multicast-pim-static-rp-topo1 test suite
2021-02-05 09:37:40 -05:00
Donald Sharp
5c0d9617e5
Merge pull request #7998 from volta-networks/fix_isis_attach_bit
isisd: When adjacencies go up and down add support to modify attached-bit
2021-02-04 18:46:19 -05:00
Mark Stapp
d5b342eb75
Merge pull request #8010 from ton31337/fix/drop_aggregate_as_attribute_if_malformed
bgpd: Drop aggregator_as attribute if malformed in case of BGP_AS_ZERO
2021-02-04 15:02:42 -05:00
Mark Stapp
2c521eb47c
Merge pull request #7709 from donaldsharp/vrf_doc
zebra: Slightly touch on the vrf route lookup semantics
2021-02-04 13:53:07 -05:00
Donald Sharp
4b24d96930
Merge pull request #8009 from pjdruddy/evpn-cleanup
zebra: resolve multiple functions for local MAC delete
2021-02-04 13:37:24 -05:00
Mark Stapp
4a9178f2f4
Merge pull request #7961 from mobash-rasool/ospfv3-feature
ospf6d: add CLI to control maximum paths for routes.
2021-02-04 13:32:34 -05:00
Mark Stapp
7534d64f0f
Merge pull request #8007 from wesleycoakley/xcompile-writeup
doc: cross compilation guide
2021-02-04 13:31:49 -05:00
Mark Stapp
a6e75217aa
Merge pull request #7941 from donaldsharp/instance_data
zebra: Display instance id as part of `show zebra client summ`
2021-02-04 12:16:15 -05:00
Donald Sharp
eff8e8a2b0 doc: Slightly touch on the vrf route lookup semantics
People keep asking about the default unreachable route
in the linux vrf table.  Add a bit of color about the
design choices and what is going on.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-04 09:08:41 -05:00
Donald Sharp
99a30b4760 zebra: Display instance id as part of show zebra client summ
When displaying `show zebra client summ` when we have instances
running, display the instance number as well.

New Output:

sharpd@eva ~/frr7 (instance_data)> vtysh -c "show zebra client summ"
Name      Connect Time    Last Read  Last Write  IPv4 Routes       IPv6 Routes
--------------------------------------------------------------------------------
ospf[1]       00:00:02     00:00:02    00:00:02       0/0              0/0
ospf[5]       00:00:02     00:00:02    00:00:02       0/0              0/0
sharp         00:00:02     00:00:02    00:00:02       0/0              0/0
static        00:00:02     00:00:02    00:00:02       0/0              0/0
Routes column shows (added+updated)/deleted

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-04 08:35:14 -05:00
Russ White
98e3dfaee0
Merge pull request #6049 from sarav511/ovrdhold
pimd: SGRpt prune received during prune didn't override holdtime
2021-02-04 07:14:31 -05:00
Donald Sharp
d459ca2e5a
Merge pull request #8013 from mjstapp/fix_topo_ospf6_topo1
tests: fix ospf6_topo1 missing ref files
2021-02-03 19:59:49 -05:00
Mark Stapp
ecd32c7741 tests: fix ospf6_topo1 missing ref files
Only one of the four reference files was present; add the missing
three. The test just silently passed if a ref file was missing:
change that to a failure.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-02-03 16:28:18 -05:00
Wesley Coakley
8cc2aca441
doc: cross compilation guide
Wrote a little guide for cross-compiling FRR, gleaned from notes I took
while compiling for a RPi 3B+ on a Gentoo x86_64 system.

Care was taken to keep this documentation as generic as possible so
these steps could be applied to any cross-compile targeting a supported
architecture.

Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
2021-02-03 14:33:56 -05:00
Donald Sharp
fd5e11240c
Merge pull request #8004 from opensourcerouting/xref-cxx
lib/xref: fix C++ issues
2021-02-03 11:23:15 -05:00
Donatas Abraitis
8085c9a7a5 bgpd: Drop aggregator_as attribute if malformed in case of BGP_AS_ZERO
An UPDATE message that contains the AS number of zero in the AS_PATH
   or AGGREGATOR attribute MUST be considered as malformed and be
   handled by the procedures specified in [RFC7606].

An UPDATE message with a malformed AGGREGATOR attribute SHALL be
   handled using the approach of "attribute discard".

Attribute discard: In this approach, the malformed attribute MUST
      be discarded and the UPDATE message continues to be processed.
      This approach MUST NOT be used except in the case of an attribute
      that has no effect on route selection or installation.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-02-03 14:58:23 +02:00
Pat Ruddy
46d6f5a2c6 zebra: resolve multiple functions for local MAC delete
the old VXLAN function for local MAC deletion was still in
existence and being called from the VXLAN code whilst the new
generic function was not being called at all. Resolve this so
the generic function matches the old function and is called
exclusively.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-02-03 12:22:00 +00:00
David Lamparter
cbb1337a30 lib/xref: fix initializer order for C++
[v2: drop designated initializer names]

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-03 11:54:24 +01:00
Donatas Abraitis
fe7bc9964e
Merge pull request #7449 from sudhanshukumar22/bgp-update-connect-timer
bgpd: config connect timer not applied immediately for non-established peers.
2021-02-03 12:15:04 +02:00
David Lamparter
6c3aa850ea lib/xref: fix frrtrace() calls in thread code
This didn't exist yet when the xref code came around, and since
frrtrace() gets collapsed to nothing by the preprocessor when
tracepoints are disabled, it didn't cause any compiler errors...

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-03 00:55:07 +01:00
David Lamparter
08a73c422d lib/xref: work around GCC bug 41091
gcc fucks up global variables with section attributes when they're used
in templated C++ code.  The template instantiation "magic" kinda breaks
down (it's implemented through COMDAT in the linker, which clashes with
the section attribute.)

The workaround provides full runtime functionality, but the xref
extraction tool (xrelfo.py) won't work on C++ code compiled by GCC.

FWIW, clang gets this right.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-03 00:55:07 +01:00
David Lamparter
96a7061450 lib/xref: restore lost extern "C" beginning
The `}` is still there, but the `extern "C" {` got lost somewhere,
probably in a rebase...

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-03 00:54:59 +01:00
Mark Stapp
1190d1b111
Merge pull request #8002 from idryzhov/fix-all-backets
*: fix all backets
2021-02-02 15:42:58 -05:00
Quentin Young
4794708949
Merge pull request #8001 from ton31337/fix/bgpd_replace_65535_with_const
bgpd: Replace 65535 with UINT16_MAX
2021-02-02 13:43:15 -05:00
Igor Ryzhov
1ac88792c0 *: fix all backets
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-02 19:11:25 +03:00
Donald Sharp
cc73a06499
Merge pull request #7314 from kuldeepkash/multicast-sm-topo1
Add multicast-pim-sm-topo1 test suite
2021-02-02 10:43:09 -05:00