aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/fib
AgeCommit message (Collapse)AuthorFilesLines
2023-12-07vnet: allow format deleted swifidxNathan Skrzypczak1-4/+2
This patch prevents the sw interfaces format function to fail when the interface was deleted. It also prints the swifindex alongside the 'DELETED' keyword. Printing deleted swifindex should not happen, but it is still helpful to have these safeguards for troubleshooting in the case invariants get corrupted (e.g. fib entry refcounts, ...) Type: improvement Change-Id: I66711049db2eebe0ad17e37c3a260ac81d1e5134 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2023-11-27fib: fix fib_path_create() with drop targetsAlexander Skorichenko1-1/+2
Properly set type path->fp_type = FIB_PATH_TYPE_SPECIAL for paths with (path->fp_cfg_flags & FIB_PATH_CFG_FLAG_DROP) Type: fix Change-Id: Id61dbcda781d872b878e6a6410c05b840795ed46 Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
2023-10-25fib: only update glean for interface if necessaryMatthew Smith2-8/+81
Type: improvement If an interface address is added, the glean adjacency for it's covering prefix is updated with that address. In the case of multiple addresses within the same prefix being added, the most recently added one will end up being used as the sender protocol address for ARP requests. Similar behavior occurs when an interface address is deleted. The glean adjacency is updated to some appropriate entry under it's covering prefix. If there were multiple interface addresses configured, we may update the address on the adjacency even though the address currently in use is not the one being deleted. Add a new value PROVIDES_GLEAN to fib_entry_src_flag_t. The flag identifies whether a source interface entry is being used as the address for the glean adjacency for the covering prefix. Update logic so that the glean is only updated on adding an interface address if there is not already a sibling entry in use which has the flag set. Also, only update the glean on deleting an interface address if the address being deleted has the flag set. Also update unit test which validates expected behavior in the case where multiple addresses within a prefix are configured on an interface. Signed-off-by: Matthew Smith <mgsmith@netgate.com> Change-Id: I7d918b8dd703735b20ec76e0a60af6d7e571b766
2023-10-01fib: Crash when specify a big prefix length from CLI.Gavril Florian1-0/+3
The VPP is crashing when specify a very big prefix length, like ip route add 1.1.1.1/55 via 2.2.2.2 Type: fix Signed-off-by: Gavril Florian <gflorian@3nets.io> Change-Id: Ic491c0b24e07be897ff35ae1e835280f04ab3ea5
2023-09-24fib: Don't use an address from an attached prefix when sending ARP requests.Neale Ranns1-1/+5
Change-Id: I4c3144794dd0bd7de6150929e53f6d305c496b17 Type: fix Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I7b0c2c2dec5e867970599b8f2f2da17f2ff0b17c
2023-05-31fib: fix memory leak in fib_attached_export_purgeStanislav Zaikin1-0/+1
Type: fix Change-Id: I879594fcade4e081190e8dfb1dbcfc53e8431edf Signed-off-by: Stanislav Zaikin <stanislav.zaikin@46labs.com>
2023-05-16ip_session_redirect: add session redirect pluginBenoît Ganne2-2/+4
This feature enables the use of the classifier and ip-in-out-acl nodes to redirect matching sessions via arbitrary fib paths instead of relying on additional VRFs. Type: feature Change-Id: Ia59d35481c2555aec96c806b62bf29671abb295a Signed-off-by: Benoît Ganne <bganne@cisco.com>
2022-10-11fib: fix crash when create vxlan/vxlan-gpe/geneve/gtpu tunnel.Huawei LI3-10/+14
Fix vpp crash when create vxlan/vxlan-gpe/geneve/gtpu tunnel with 0.0.0.0 dst ip in debug build. The ASSERT should be move out of fib_prefix_from_ip46_addr, which may be called when create vxlan/vxlan-gpe/geneve/gtpu tunnel with 0.0.0.0 dst ip. How to reproduce: 1. build debug vpp and run vpp 2. create vxlan t src 192.168.0.2 dst 0.0.0.0 vni 1 instance 1 create vxlan-gpe tunnel local 192.168.0.2 remote 0.0.0.0 vni 1 create geneve tunnel local 192.168.0.2 remote 0.0.0.0 vni 1 create gtpu tunnel src 192.168.0.2 dst 0.0.0.0 teid 1 Type: fix Change-Id: I19972f6af588f4ff7fd17de1b16b9301e43d596f Signed-off-by: Huawei LI <lihuawei_zzu@163.com>
2022-10-07fib: add fib_entry_get_path_list_for_sourceDamjan Marion2-0/+22
Type: improvement Change-Id: Ie035bebf64226691cffc84484e4bf7310287d1b7 Signed-off-by: Damjan Marion <dmarion@me.com>
2022-09-20fib: add cli support for explicit link typeBenoît Ganne1-0/+12
This adds the ability to specify we want an IPv4 route via an IPv6 adj and vice-versa. Type: improvement Change-Id: I5f7f1ab89fc60244d31c26155bbd9b0db690257c Signed-off-by: Benoît Ganne <bganne@cisco.com>
2022-09-09fib: fix path copy function to deal with provided DPO in exclusive pathDamjan Marion1-0/+6
DPO in the new copy was not locked ... Type: fix Fixes: 0bfe5d8 Change-Id: I39f1368de459af91c4bb857d98a4b531bd5692a6 Signed-off-by: Damjan Marion <dmarion@me.com>
2022-08-29fib: fix coverity 249175Andrew Yourtchenko1-0/+1
Add an assert to express the constraint to coverity without incurring the overhead in release builds. Type: fix Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com> Change-Id: I2c22f8b2565c645d95c9c0be37381060e151420f
2022-04-04vppinfra: make _vec_len() read-onlyDamjan Marion2-3/+2
Use of _vec_len() to set vector length breaks address sanitizer. Users should use vec_set_len(), vec_inc_len(), vec_dec_len () instead. Type: improvement Change-Id: I441ae948771eb21c23a61f3ff9163bdad74a2cb8 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-03-18vppinfra: refactor *_will_expand() functionsDamjan Marion2-4/+2
Type: refactor Change-Id: I3625eacf9e04542ca8778df5d46075a8654642c7 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-02-22fib: fix mpls db label overflowDmitry Valter1-1/+1
mpls fib DB size was 2^20 instead of intended 2^21. Therefore large mpls labels caused DB to overflow and write to other tables or some random objects. Or crash with ASAN. Sometimes. Type: fix Signed-off-by: Dmitry Valter <d-valter@yandex-team.ru> Change-Id: I6db65680037a266fe47e8213464a0c16de63c06c
2022-02-14fib: fix incorrect display of mpls fib_indexRajith P R1-1/+1
Type: fix Signed-off-by: Rajith P R <rajith@rtbrick.com> Change-Id: I8c9c85081c27bfe7ee71b5b620a2a761e027789c
2022-02-10tests: Fix the FIB UTNeale Ranns1-2/+1
Type: test The FIB UT fails in debug mode because there is no string associated woth its fib_node_type_t. Change the tests to register their own type, which will give it a name. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I36e546718faa7241c088494cbae10939aca51d5a
2022-02-09fib: ip6 and mpls fib_table memory leaks on fib_table->ft_locksSteven Luong2-0/+2
ip6 and mpls fib_table->ft_locks memory leaked when the table is deleted. name tag is leaked for mpls table parsing. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ife68c0ddc3a6f9437a149b308310f042799c2116
2022-01-09fib: multiple memory leaks upon deleting a VRF tableSteven Luong1-0/+1
fib_table->ft_locks name string for parsing the ip table add|del name <tag> command path list for ip4_specials in mfib mfib->fib_entry_by_dst_address[0..32] mfib entry path_ext, msrc->mfes_exts Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ia1e0cac577a73608ee1e4b1664b60a66322e81ce
2021-12-21fib: MPLS EOS chains built for attached prefixes should link to a lookup DPONeale Ranns7-61/+51
Type: fix Presently a local label associated with an attached or connected prefix will link to the glean. This is a problem since it will never use the adj-fibs that are installed for that attached prefix. Instead link the local label to a lookup in the table in which the attached link is bound. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Iad49fb6168b9ba47216a9a52bd262363b49c3c43
2021-12-19fib: Incorrect logic for IPv6 link-local attached export.Neale Ranns1-1/+1
Type: fix IPv6 link-local FIB entries are never needed for attached export. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I08aad78e754d89ad54d07a211fb7a0d7fbc7a0fe
2021-12-07fib: fix coverity warning/don't dereference NULLKlement Sekera1-1/+1
fib_sas6_get is called with NULL dst explicitly so add a NULL check to avoid a NULL dereference. Type: fix Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I8ebcba98832f374991f5442c1b83a4b6e64771d0
2021-12-03fib: Fix the display (or lack of) for fib node types in dependent children listsNeale Ranns2-20/+33
Type: fix When registering a new FIB node type, no name was required on the API, and so no name was printed. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I8a99cf29c194637a550061b0a5e9782ffe8b31dd
2021-11-15fib: re-evaluate the import/export state of a prefix.Neale Ranns4-76/+166
Type: fix re-evaluate the import/export state of a prefix when the interface it is attached to rebinds to a different table. Only attached routes have import/export requirements, so we can back walk from the glean adjacency when the interface rebinds tables. There are two cases to consider. 1. the rebind may change the prefix from/to import 2. the import VRF may change Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I25b6af43b3b2d8f701dfbe7a08710dc56b3f5778
2021-10-25bier: Disposition paths don't set the next-hopNeale Ranns1-14/+9
Type: fix Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I3c4152219e5307ac0fe773e16d597f0e4b9a7d4c
2021-10-22fib: Don't back walk from a path-list when a child fist attaches.Neale Ranns1-11/+7
Type: fix If the walk is triggered when the child is added, then that child is visited in the walk. However, since it is just attahcing to the path-list it may not, or indeed cannot, have all the context it needs to successfully handle the walk. In the case of MPLS tunnel, it does not have the path extensions ready, and cannot since the path extensions need to resolve on the path-list. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I027af8cf2f522d2f6e37931bea60c767f0cb667d
2021-10-20ip6: fix IPv6 address calculation error using "ip route add" CLIJieqiang Wang2-0/+58
Using VPP CLI "ip route add" to add static IPv6 entries outputs wrong results. Fix this error by correctly calculating IPv6 addresses with different increased ranges and grouping ip4/ip6 prefix calculation functionality into two functions. Type: fix Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com> Reviewed-by: Lijian Zhang <lijian.zhang@arm.com> Reviewed-by: Tianyu Li <tianyu.li@arm.com> Change-Id: If954876301ca2095f9331799a086f75db936f246
2021-10-11ip: fix fib and mfib locksNathan Skrzypczak1-2/+39
This patches fixes an issue that could cause fib locks to underflow: if an API user deletes a fib and quickly recreates it, the fib may not have been actually deleted. As a result, the lock would not be incremented on the create call leading to the fib potentially disappearing afterwards - or to the lock to underflow when the fib is deleted again. In order to keep the existing API semantics, we use the locks with API and CLI source as flags. This means we need to use a different counter for the interface-related locks. This also prevents an issue where an interface being bound to a vrf via API and released via CLI could mess up the lock counter. Finally, this will help with cleaning up the interface-related locks on interface deletion in a later patch. Type: fix Change-Id: I93030a7660646d6dd179ddf27fe4e708aa11b90e Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> Signed-off-by: Aloys Augustin <aloaugus@cisco.com>
2021-10-04fib: fix unitialized padding in fib_api_next_hop_decodeBenoît Ganne1-4/+2
If the type is IPv4, makes sure the padding bytes are set to 0 as this is used by ip46_address_is_ip4() to detect the type. Type: fix Change-Id: I6a81fa05a6b227086853901bf3dcdc66e6d04d2c Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-09-30fib: doc nitfixesNathan Skrzypczak6-7/+7
Type: improvement Change-Id: I29346c849a5e1ff3c2ea399671f9f50d075e9f18 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-09-29fib: add barrier lock for fib_urpf_list_pool and fib_entry_poolStanislav Zaikin2-0/+22
Pools fib_urpf_list_pool and fib_entry_pool can grow while ip6_urpf_loose_check/fib_entry_get_flags_for_source are being executed. That may result as a crash in mt environment. Type: fix Change-Id: I44ca2cb70255e7aaf2e1f7a7d2eecd25cbdd0aaa Signed-off-by: Stanislav Zaikin <zstaseg@gmail.com>
2021-09-27fib: fix crash on exporter tracker removeVladislav Grishenko1-4/+3
Exported entries are tracked only when the prefix found in the export FIB is really attached, exporter tracker is not set if the export entry is not valid for export, ex. for special FIB entries - default route, zeronet, mcast and broadcast prefixes. When imported entries need to be purged, such unset exporter tracker is being removed by non-initialized index with absent delegate entries, causing corresponding assert and crash. Type: fix Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: Ib24a2e7853a03a960577872480213e1e8097da5a
2021-09-22ip: add ip_table_allocate to apiAloys Augustin1-1/+2
Set tableID = ~0 for auto selection unused ID https://jira.fd.io/browse/VPP-1993 Type: improvement Change-Id: I4eec2cc1d18fc025196cb6ac4c9a4b374388eb56 Signed-off-by: Artem Glazychev <artem.glazychev@xored.com> Signed-off-by: Aloys Augustin <aloaugus@cisco.com>
2021-08-25fib: fix source address get error for p2p ifjxm1-0/+24
Type: fix Signed-off-by: jxm <jiangxiaoming@outlook.com> Change-Id: I5a6a1ce9f232d4ed0fd4707cd5aa9b46cc8a2a5a
2021-08-20ip: check if interface has link-local addressStanislav Zaikin1-1/+6
Type: fix Change-Id: I9d3344374738f8cf883cffb4715c76b50bb4bfce Signed-off-by: Stanislav Zaikin <zstaseg@gmail.com>
2021-08-11fib: Compiile time option to use 8-8-8-8 stride tries for FIB ratherNeale Ranns1-0/+121
than 16-8-8-8 Type: feature the memory trade-off is: for 8-8-8-8 tries DBGvpp# sh ip fib mtrie mem ipv4-VRF:0 mtrie:8068 hash:3499 totals: mtrie:8068 hash:3499 all:11567 for 16-8-8 DBGvpp# sh ip fib mtrie mem ipv4-VRF:0 mtrie:333056 hash:3499 totals: mtrie:333056 hash:3499 all:336555 Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I5271a4322d786de6e47613cff9bd432762dbed2a
2021-08-11fib: A 16-8-8 and a 8-8-8-8 versions of an ip4_fib_tNeale Ranns8-386/+907
Type: feature The difference being the MTRIE type they contain. THE FIB continues to use the 16-8-8 version. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I5a54d4e6e6cc639f18a3fb65ef2925507a7ef1de
2021-08-11ip: [re]introduce the 8-8-8-8 stride MTRIENeale Ranns1-14/+14
Type: improvement there's a time-space trade-off between the 16-8-8 and 8-8-8-8 stride. FIB continues to use the 16-8-8. Other features are now free to make the choice. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I6691a163486ce62e75e629f6ef0c990f253df8e5
2021-08-11ip: Rename the ip4 mtrie function to be 16_8_8 specificNeale Ranns2-44/+44
Type: improvement the existing mtrie functions use the existing 16_8_8 mtrie. Rename them to make that explicit. Then we can add the 8_8_8_8 types and functions alongside. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: If5ce7a282d5d3742dc65bcd0523220235d9c510d
2021-08-10ip: Use the IP4 lookup functionsNeale Ranns1-1/+43
Type: refactor as opposed to wrtiing out the mtrie steps one by one each time. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I1248861350f9189f9a67ac6e68940813af279e03
2021-07-13fib: Set the GLEAN flag on attached export routes so that the SAS worksNeale Ranns4-38/+63
correctly. Type: fix Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I4bc2eb394a8f9d01c5a12de2ce963c22209d5439
2021-06-17fib: changing parsing order to avoid corner caseArthur de Kerhor1-3/+3
mfib interface flags are parsed before the interface name. For some specific names, this creates a bug when adding routes. ex: ip route add 10.0.2.0/24 via FortyGigabitEthernetd8/0/0 The 'F' at the beginnig of the interface name is parsed as the "Forward" flag. Because of that, the interface name parsed is "ortyGigabitEthernetd8/0/0" which results in a parsing error. Type: fix Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com> Change-Id: Ib76c2f86416455841f910f7b466b467001072b70
2021-06-16fib: copy the path extentions when creating fib src rr entryStanislav Zaikin1-0/+11
Type: fix Signed-off-by: Stanislav Zaikin <zstaseg@gmail.com> Change-Id: Ib4957bfc03b0dfc90fd28689d5b32cc3d82e7b74
2021-06-08fib: make sure dpo is valid even when path pool expandsBenoît Ganne1-8/+22
The path pool can expand during in fib_path_attached_next_hop_get_adj() when calling adj_nbr_add_or_lock(). If dpo points to a path->fp_dpo, its reference becomes stale. Use a temporary copy instead. Type: fix Change-Id: Ie966cb5f3f7b416425964dca12f1f586bfc2010c Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-06-03fib: fix flags updates when adding routes with a udp encap pathArthur de Kerhor1-1/+1
When adding a route via a udp encap instance, FIB_ENTRY_FLAG_IMPORT should not be set. In particular, fib_route_attached_cross_table should always return false for such paths. Modified test_udp_encap to leverage the bug that needed to be fixed. Type: fix Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com> Change-Id: Iaa9489e96d1cff09751f92c62caf7999d924fd7f
2021-05-29udp: add udp decapsulationArthur de Kerhor1-1/+3
Possibility to register a port via CLI or API to decap incoming UDP packets: - For CLI, a user needs to specify the inner protocol (only MPLS supported for now) - For API, the protocol is specified by index Added unittests Type: feature Change-Id: Ifedd86d8db2e355b7618472554fd67d77a13a4aa Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com>
2021-05-13tests: move test source to vpp/testDave Wallace2-458/+0
- Generate copyright year and version instead of using hard-coded data Type: refactor Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: I6058f5025323b3aa483f5df4a2c4371e27b5914e
2021-04-14misc: clang-12 supportDamjan Marion1-6/+2
Type: improvement Change-Id: Ie8ebbbcf5e93337036998d6ba8dac393b20ebc72 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-03-16fib: Allow the creation of new source on the APINeale Ranns6-20/+201
Type: feature an client can dump the existing sources, examine their priorities, then define thier own source. Usefull if a client wants to distingusih between say, static, ospf, bgp, etc routes it has added over the API. Signed-off-by: Neale Ranns <nranns@cisco.com> Signed-off-by: Alexander Chernavin <achernavin@netgate.com> Change-Id: I5158b4fa1ebe87381ff8707bb173217f56ea274a
2021-02-15ip: Path MTUNeale Ranns3-2/+25
Type: feature Support setting the MTU for a peer on an interface. The minimum value of the path and interface MTU is used at forwarding time. the path MTU is specified for a given peer, by address and table-ID. In the forwarding plane the MTU is enfored either: 1 - if the peer is attached, then the MTU is set on the peer's adjacency 2 - if the peer is not attached, it is remote, then a DPO is added to the peer's FIB entry to perform the necessary fragmentation. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I8b9ea6a07868b50e97e2561f18d9335407dea7ae