Commit Graph

31325 Commits

Author SHA1 Message Date
Donald Sharp
19d5895827
Merge pull request #12841 from opensourcerouting/topofix_bgp_gr_retain_routes
tests: Change bgp_gr_retained_routes to use json output of "ip route"
2023-02-24 09:24:28 -05:00
anlan_cs
b7d890dd45 lib: some ASNUMs should be forbidden
In current code, some ASNUMs with redundant zero are legal,
e.g. "1.01", "01.1", "1.001", "001.1", and more.  They should
be forbidden.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-02-24 21:13:19 +08:00
Martin Winter
3d3c67d681
Merge pull request #12881 from donaldsharp/bgp_rpki_take_two 2023-02-24 05:09:59 -08:00
Sarita Patra
d77da853f0 pimd, pim6d: Fix join prune handling
When upstream RPF address is secondary address, and
neighborship is built with primary address,
then pim_neighbor_find() fails.

Verify the upstream  RPF address is present in the
neighbor primary and secondary address list.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2023-02-24 04:40:38 -08:00
Sarita Patra
689b9f10fc pimd, pim6d: Fix pim upstream rpf change
When upstream RPF address is secondary, and
neighborship is built with primary address,
then pim_neighbor_find() fails, due to which when there
is upstream change it wont send prune.

Verify the nexthop is present in the neighbor primary
and secondary address list.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2023-02-24 04:40:38 -08:00
Sarita Patra
e14ba24874 pimd, pim6d: fix pim neighbor check in pim_nexthop_lookup
When there is a mismatch in nexthop address (secondary address)
and neighborship address(primary address) on the same interface,
RPF check fails.

This is fixed now.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2023-02-24 04:40:38 -08:00
Sarita Patra
ae5bcac0ae pimd, pim6d: Fix RP Unknown IIF
When route to RP is having nexthop secndary address,
neighborship is built with primary address,
then pim_neighbor_find() fails, which causes RP IIF
Unknown.

Fix:
Verify pim neighborship on the RP connected interface.

Issue: #11526

Signed-off-by: Sarita Patra <saritap@vmware.com>
2023-02-24 04:40:38 -08:00
Sarita Patra
2c6a32f9be pimd, pim6d: Fix BSM packet process
Problem 1:
When route to BSR is having nexthop secondary address,
neighborship is built with primary address,
then pim_neighbor_find() fails, which cause drop of BSM
packet.

Fix 1:
Verify pim neighborship on the BSM received interface.
Problem 2:

Problem 2:
Source IP BSM address is primary address, where
as nexthop also can be primary or secondary address.

Fix 2:
Avoiding the check (nhaddr == src_ip) for PIMV6

Issue: #11957

Signed-off-by: Sarita Patra <saritap@vmware.com>
2023-02-24 04:40:38 -08:00
Sarita Patra
3dbf370ac0 pimd,pim6d: Modify pim_neighbor_find() API
Modify pim_neighbor_find() API to find the neighbor
in neighbor secondary list.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2023-02-24 04:40:38 -08:00
Sarita Patra
ed9323604a zebra: Send nexthop ifindex for type NEXTHOP_TYPE_IPV6
Once RP/BSR address is learned in PIMD, PIMD does nexthop tracking
in Zebra.
For IPV6 address, the nexthop type is either NEXTHOP_TYPE_IPV6
or NEXTHOP_TYPE_IPV6_IFINDEX.
Zebra should send nexthop ifindex information along with nexthop address
to the client (PIMD).

Issue: #11526
Issue: #11957

Signed-off-by: Sarita Patra <saritap@vmware.com>
2023-02-24 04:40:38 -08:00
Donald Sharp
7cedcf270e
Merge pull request #12889 from LabNConsulting/chopps/fix-nb-context-arg
lib: fix init. use of nb_context to be by value not by reference
2023-02-24 07:37:09 -05:00
Donatas Abraitis
ba995a720b
Merge pull request #12751 from Pdoijode/pdoijode/ospf-vrf-neighbor-detail-1
ospfd: Added missing fields and option to query specific neighbor in VRF
2023-02-24 11:56:28 +02:00
Donatas Abraitis
b44f0900c2
Merge pull request #12885 from donaldsharp/bmp_afi_str
lib, bgpd: bmp was not specifying l2vpn afi
2023-02-24 11:36:12 +02:00
Christian Hopps
b1867d4292
Merge pull request #12884 from donaldsharp/flowspec_overflow
bgpd: Flowspec overflow issue
2023-02-24 02:52:49 -05:00
Christian Hopps
3ef4868715
Merge pull request #12887 from donaldsharp/remove_ospf_unused_function
ospfd: Remove unused function
2023-02-24 02:49:45 -05:00
Philippe Guibert
6a38127745 bgpd: apply clang style changes to bgp_attr
Now that an additional attribute has been added, clang
format has to be applied.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-02-24 08:18:18 +01:00
Philippe Guibert
7171949de5 bgpd: attr evpn attributes should be modified before interning attr
As remind, the attr attribute is a structure that contains
the attributes for a given BGP update. In order to avoid too much
memory consumption, the attr structure is stored in a hash table.
As consequence, other BGP updates may reuse the same attr. The
storage in the hash table is done when calling bgp_attr_intern(),
and a key is calculated based on all the attributes values of the
structure.

In BGP EVPN, when modifying the attributes of the attr structure
after having interned it, this means that some BGP updates will
want to use the old reference, whereas a new attr value is used.
Because in BGP EVPN, the modifications are done on a per BGP update
basis, a new attr entry specific to that BGP update should be created.
This is why a local_attr structure is done, modified, then later
interned.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-02-24 08:16:36 +01:00
Philippe Guibert
6fafecdc67 rfapi: free useless attr
The attr pointer has been interned during the process of the
function, but has to be uninterned at the end.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-02-24 08:16:27 +01:00
Christian Hopps
41ef7327e3 lib: fix init. use of nb_context to be by value not by reference
Pass context argument by value on initialization to be clear that the
value is used/saved but not a pointer to the value. Previously the
northbound code was incorrectly holding a pointer to stack allocated
context structs.

However, the structure definition also had some musings (ifdef'd out
code) and a comment that might be taken to imply that user data could
follow the structure and thus be maintained by the code; it won't; so it
can't; so get rid of the disabled misleading code/text from the
structure definition.

The common use case worked b/c the transaction which cached the pointer
was created and freed inside a single function
call (`nb_condidate_commit`) that executed below the stack allocation.

All other use cases (grpc, confd, sysrepo, and -- coming soon -- mgmtd)
were bugs.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-02-23 20:59:17 -05:00
Donatas Abraitis
5acfd822be tests: Check if peer->af_flags can be higher than uint32_t
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-24 00:24:20 +02:00
Donatas Abraitis
47017b846f bgpd: Renumber peer->af_flags to be without any gaps
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-23 23:52:08 +02:00
Donald Sharp
b2a4c02cc9 ospfd: Remove unused function
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-23 16:47:47 -05:00
Donatas Abraitis
d782e3ffa2 bgpd: Convert missing uint32_t to uint64_t for for af_flags/flags
It was hard to catch those unless using higher values than uint32_t, but
already hit, it's time to fix completely.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-23 23:02:35 +02:00
Donatas Abraitis
2c722516c3 bgpd: Convert peer_af_flag_check() to bool
Since we increased peer->af_flags from uint32_t to uint64_t,
peer_af_flag_check() was historically returning integer, and not bool
as should be.

The bug was that if we have af_flags higher than uint32_t it will never
returned a right value.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-23 22:54:12 +02:00
Donald Sharp
ce8194bcd0
Merge pull request #12876 from opensourcerouting/fix/align_show_bgp_with_confederation
bgpd: Align `show bgp ...` output with the header for wide option
2023-02-23 15:48:06 -05:00
Donald Sharp
0884f1644b lib, bgpd: bmp was not specifying l2vpn afi
The l2vpn afi was not being properly displayed
when a show run was being issued.  Add a
afi2str_lower function and use it.

Fixes: #12867
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-23 14:23:24 -05:00
Donald Sharp
0b999c886e bgpd: Flowspec overflow issue
According to the flowspec RFC 8955 a flowspec nlri is <length, <nlri data>>
Specifying 0 as a length makes BGP get all warm on the inside.  Which
in this case is not a good thing at all.  Prevent warmth, stay cold
on the inside.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-23 13:29:32 -05:00
Donald Sharp
4b0d6b4244
Merge pull request #12879 from opensourcerouting/pim-ssm-no-rp
pimd: don't try to check RPF for incoming SSM data
2023-02-23 10:42:14 -05:00
Donald Sharp
c389069195 bgpd: Another rpki fix
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-23 10:02:59 -05:00
David Lamparter
c86b4ff4ba pimd: don't try to check RPF for incoming SSM data
For incoming no-receiver SSM traffic, there isn't going to be a RP, much
less a RPF.  We should install an MFC entry with empty oif regardless,
so we don't get swamped with further notifications.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-23 09:51:17 +01:00
David Lamparter
d650b3c79a pimd: try to reinstall MFC when we get NOCACHE
Whether due to a pimd bug, some expiry, or someone just deleting MFC
entries, when we're in NOCACHE we *know* there's no MFC entry.  Add an
install call to make sure pimd's MFC view aligns with the actual kernel
MFC.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-23 09:42:19 +01:00
Diogo Oliveira
e77a0e27bb tests: Add test for IS-IS advertise-passive-only configuration
Signed-off-by: Diogo Oliveira <14191454+dorDiogo@users.noreply.github.com>
2023-02-22 13:46:53 -08:00
Diogo Oliveira
3f3608d8d7 isisd,doc: Add support for isis advertise-passive-only
Signed-off-by: Diogo Oliveira <14191454+dorDiogo@users.noreply.github.com>
2023-02-22 13:44:48 -08:00
Donatas Abraitis
ee0aaff4bc
Merge pull request #12869 from donaldsharp/cleanup_debug_log
bgpd: Give better debug message when configuration is being read in
2023-02-22 22:30:04 +02:00
Donatas Abraitis
fccd7e53db bgpd: Align show bgp ... output with the header for wide option
Before:

```
r1# sh ip bgp wide
BGP table version is 1, local router ID is 192.168.2.1, vrf id 0
Default local pref 100, local AS 65001
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
RPKI validation codes: V valid, I invalid, N Not found

   Network                                      Next Hop                                  Metric LocPrf Weight Path
 *  172.16.255.254/32                            192.168.2.2                                    0             0 (65003) i
 *>                                              192.168.1.2                                    0             0 (65002) i

Displayed  1 routes and 2 total paths
r1#
```

After:

```
r1# sh ip bgp wide
BGP table version is 1, local router ID is 192.168.2.1, vrf id 0
Default local pref 100, local AS 65001
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
RPKI validation codes: V valid, I invalid, N Not found

    Network                                      Next Hop                                  Metric LocPrf Weight Path
 *  172.16.255.254/32                            192.168.2.2                                    0             0 (65003) i
 *>                                              192.168.1.2                                    0             0 (65002) i

Displayed  1 routes and 2 total paths
r1#
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-22 22:27:18 +02:00
Donatas Abraitis
6357915a68
Merge pull request #12865 from mjstapp/fix_rfapi_timer_wcb
bgpd: free rfapi callback object always
2023-02-22 21:49:42 +02:00
Mark Stapp
8014afb934
Merge pull request #12868 from taspelund/evpn_prefix_guard_debug
lib: add missing debug guards for route-map
2023-02-22 14:01:23 -05:00
Donatas Abraitis
f6bbbeb0b5
Merge pull request #12864 from donaldsharp/fix_warnings
bgpd: Fixup rpki and asn parsing
2023-02-22 19:17:54 +02:00
Donald Sharp
71286b6dcb
Merge pull request #12861 from opensourcerouting/fix/bgp_confederation_with_astype
bgpd: Confederation fixes with remote-as external/internal
2023-02-22 12:17:25 -05:00
Donald Sharp
941778e854
Merge pull request #12863 from sri-mohan1/sri-mohan-ldp
ldpd: changes for code maintainability
2023-02-22 12:14:23 -05:00
Donald Sharp
7c5062fb27 bgpd: Give better debug message when configuration is being read in
Sometimes bgp connections can be rejected for a variety of reasons.  Give
a bit more context about what is going wrong so that the operator can
make better decisions about their network.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-22 11:41:18 -05:00
Trey Aspelund
2336d279e0 lib: add missing debug guards for route-map
Fixes missing debug guards for EVPN prefix conversion for optimized
route-map lookup.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-02-22 16:30:24 +00:00
Mark Stapp
870d3d2cb8 bgpd: free rfapi callback object always
An rfapi timer callback is responsible for the memory in a
context object, even in special-case exit paths. Always
free that object.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-02-22 11:29:22 -05:00
David Lamparter
dbd596f637 pimd: make logs useful for input drops
This path here is pretty far on top of the list of issues that operators
will run into and have to debug when setting up PIM.  Make the log
messages actually tell what's going on.  Also escalate some from
`debug mroute detail` to `debug mroute`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-22 16:08:10 +01:00
Donald Sharp
29bb9deb1e bgpd: Fixup rpki and asn parsing
Commit  6ccfd1030b
did not properly handle asn parsing of the new
asn format.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-22 08:56:55 -05:00
sri-mohan1
575f30cea0 ldpd: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2023-02-22 15:08:50 +05:30
Donatas Abraitis
caf65e4a27 tests: Check if BGP confederation works with AS_EXTERNAL (!AS_SPECIFIED)
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-22 10:08:40 +02:00
Donatas Abraitis
db5a5ee6e4 bgpd: Pass global ASN for confederation peers if not AS_SPECIFIED
When we specify remote-as as external/internal, we need to set local_as to
bgp->as, instead of bgp->confed_id. Before this patch, (bgp->as != *as) is
always valid for such a case because *as is always 0.

Also, append peer->local_as as CONFED_SEQ to avoid other side withdrawing
the routes due to confederation own AS received and/or malformed as-path.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-22 00:00:53 +02:00
Donatas Abraitis
5d94142668
Merge pull request #12839 from taspelund/evpn_prefix
lib: skip route-map optimization if !AF_INET(6)
2023-02-21 21:31:33 +02:00
Isabella de Leon
3b0e97e150 isisd: Fix isisd to generate lsps after config processing is complete
Before:
isisd generates its initial lsp before fully processing the written config. Ex: lsp_generate() is called in isis_instance_area_address_create(), before other configs that may affect the lsp are loaded in, like set-overload-bit.

After:
isisd generates its initial lsp as soon as the config is fully processed. This was done by utilizing the initialization config callbacks, similar to bgp's implementation.

Signed-off-by: Isabella de Leon <ideleon@microsoft.com>
2023-02-21 08:49:34 -08:00