12960 Commits

Author SHA1 Message Date
yanlong
cad2111129 docs:Improve the README of vpp docs
Type:fix

Change-Id: Ie2ae728450ef123379b697cdf9c873d5bec01b47
Signed-off-by: yanlong <dyl_wlc@163.com>
2023-08-08 12:36:33 +00:00
Benoît Ganne
84e6658486 ipsec: add support for RFC-4543 ENCR_NULL_AUTH_AES_GMAC
Type: improvement

Change-Id: I830f7a2ea3ac0aff5185698b9fa7a278c45116b0
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-08-08 10:16:26 +00:00
Gao Feng
96600f9077 vcl: Fix the ldp init check
Maybe some function calls the wrapper funtion like read which invokes
the ldp_init_check in the other libs as a constructor before
ldp_constructor. Then the ldp has been initialized already when
ldp_constructor is invoked. And it's normal case, we shouldn't treat it
as an error.

So ldp_init should return success if ldp is initialized already instead
of an assert.

Type: fix

Change-Id: Ifa2a7b1d5471981a3f840b14a4fa5d48fb1f1374
Signed-off-by: Gao Feng <gfree.wind@outlook.com>
2023-08-08 04:24:58 +00:00
Damjan Marion
6508ed51a8 vlib: support sibling node creation with vlib_register_node()
Type: improvement
Change-Id: I7e82a262692b2b6513f81889d78a43c10ca7bfb2
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-08-07 18:03:19 +00:00
Damjan Marion
40f481037e vppinfra: add clib_file_get_resolved_basename
more generic version of clib_sysfs_link_to_name with support for
format strings...

Type: improvement
Change-Id: I0cb263748970378c661415196eb7e08450370677
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-08-07 18:00:10 +00:00
Damjan Marion
993735913c vppinfra: add vec_foreach_pointer macro
works with vectors of pointers...

Type: improvement
Change-Id: I530653978fcf981be299cf42a1133be000d74d0c
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-08-07 17:33:25 +00:00
Damjan Marion
8d0c0c6821 vppinfra: add unformat_init_path
More conveninet way to unformat file by providing filesystem path.
Takes format string for easier constuction of path...

Type: improvement
Change-Id: I433204fa20dc98e2b11c53914883d047a7fc62c6
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-08-07 17:33:09 +00:00
wanghanlin
696db20e33 vcl: fix error state switch for VCL_STATE_LISTEN_NO_MQ sessions
When a VCL_STATE_LISTEN_NO_MQ session receives an ACCEPTED message,
but then receives either a RESET or DISCONNECTED message from VPP
before the session is unlistened, the listen session state is
switched to DISCONNECT.
The subsequent CLEANUP message handler attempts to send a reset
reply message to VPP, but since the vpp_evt_q for the listen
session is null, this leads to a crash.

Type: fix
Change-Id: Id7e88dcb16df3eda912b3f763730ec8d8973473a
Signed-off-by: wanghanlin <wanghanlin@corp.netease.com>
2023-08-07 16:58:07 +00:00
Nathan Skrzypczak
b22da9c7d1
cnat: Support offloaded check sums
This patch removes zero checks for new_addr, new_port
meaning sessions with zero values will rewrite the packet
with a 0 value instead of leaving it in place. This allows
to reduce branchiness in the code, and sessions are fully
resolved at creation time anyway.

This also adds support for checksum offloads:
- IP checksum offload : we always compute the checksum to
avoid issues with drivers. We'll revert this if we realize
cost gets too important.
- TCP/UDP checksum offload : we add the implementation for
pseudo header checksum computation. This is needed for the
drivers that do not re-compute this pseudo-checksum before
the packet is TX-ed (e.g. a few DPDK drivers).

Type: improvement

Change-Id: I6543f3aec8c120ec50f4219108609138283620ef
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2023-08-07 11:34:48 +02:00
Benoît Ganne
994a58997d nsh: fix nsh gre references
Since gre is a plugin, nsh should not use symbol names directly.

Type: fix
Fixes: cefb178aa487a217d4ac75d7d4fa62db4b7d70fd

Change-Id: I1a1c20740aabdaafd69f507cd71016c3109b0205
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-08-04 16:13:43 +02:00
Damjan Marion
faeadca89e vpp: detect early nosyslog and interactive flags
So error logs are displayed on console earlier....

Type: improvement
Change-Id: If31b76c9d06254b0fec5b5b3f4e92a881b4cf786
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-08-04 10:52:07 +00:00
Damjan Marion
91ff0e965a vppinfra: add pool_foreach_pointer()
Works on pools of pointers...

Type: improvement
Change-Id: I194dec389ca4c5ec2ce3361b54a9968c9caecefc
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-08-02 17:41:22 +00:00
Florin Coras
39a8e16448 quic: fix closing of streams
Avoid explicit manipulation of session state and generate closing event
if need be.

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I07cda1db08a2673b27b496ea1371b0dfd8e6f98a
2023-08-02 16:36:44 +00:00
Damjan Marion
3706636ca0 vlib: remove dependency on libuuid
Type: improvement
Change-Id: I4e2b2e4f227dfcb3df36166db13c8aa5c0b603f5
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-08-02 16:07:06 +00:00
Damjan Marion
f566524a21 vppinfra: add unformat_c_string_array
Type: improvement
Change-Id: Iea5ecca5d4cbc6c7aea69104830afcfe78c708ee
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-07-31 20:10:57 +02:00
Sylvain Cadilhac
83ca6e66d0 ipsec: fix IPv6 IPsec tunnel punting
Type: fix
Buffer needs to be rewinded before being passed to punt-dispatch node.

Change-Id: I43d103515d372e425f4c3b08ca1779398f1fced4
Signed-off-by: Sylvain Cadilhac <sylvain.cadilhac@freepro.com>
2023-07-31 13:00:31 +00:00
Mohsin Kazmi
c709f2cd9d libmemif: add support for buffer size
Type: improvement

buffer size can be configurable:
./test_app -b 9216

Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Change-Id: Id77f6baac27d45dec3d5b7ea8a9a53acf2a302fc
2023-07-31 09:55:41 +00:00
Dave Wallace
054229ebbd vlib: fix gcc build breakage
Type: fix
Fixes: 00ea98ad6

Change-Id: I4ac8c9c5902299d5f283ba4912d52d9bfcedef5c
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2023-07-28 16:36:22 -04:00
Filip Tehlar
543cd57ea2 hs-test: improve get stats
Type: test

Change-Id: Ie681ee43007f4fe787d51d80bda9b433dcb6c09a
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2023-07-28 18:55:55 +00:00
Florin Coras
8f3147d102 session: regrab evt llist elt for app transports tx
App transports like TLS can close sessions on tx and consequently
generate new events. That can realloc the event pool.

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I58a97502acc1182b3d051ba1aa9e0e98c16f4593
2023-07-28 16:05:56 +00:00
Damjan Marion
8797956bac vnet: add vnet_register_device_class function
To allow dynamic registration of device classes..."

Change-Id: Ie8435e8c55b7e300be06abe97b653c0c3ce7f732
Type: improvement
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-07-28 15:52:35 +00:00
Damjan Marion
00ea98ad60 vlib: pci cleanup and improvements
Change-Id: Ieafbed6f2db3dec65e4b43d84a4661f6a1bbe891
Type: improvement
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-07-28 15:51:12 +00:00
Damjan Marion
c5c0d0cf8a vlib: fix coverity issue in vlib_node_set_interrupt_pending
Type: fix
Fixes: cc8249c
Change-Id: Iebfbbd1e00782c4097cc840460b5177d18921131
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-07-28 12:57:24 +02:00
Filip Tehlar
229dab615a hsa: add total bytes parameter to vcl_test_client
Type: test

Change-Id: Ib1131eedb8eeaa9adfed9cfc47beeb1c7c8adb5c
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2023-07-27 17:16:00 +00:00
Filip Tehlar
6fc5311f41 session: remove unused code
Type: improvement

Change-Id: I7525aa81acf073707550b23541fdcc358b9bf49c
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2023-07-27 16:35:34 +00:00
Maxime Peim
f902ba534a ipsec: fix sa bind cli
Small mistake was made, reported by coverty scan.

Type: fix
Change-Id: I98ca16c0275a94b2def99831f9353d4ff3fe93a9
Signed-off-by: Maxime Peim <mpeim@cisco.com>
2023-07-27 16:32:27 +00:00
Denys Haryachyy
2652867480 ikev2: cleanup stuck sessions
The following issues are fixed:
* in responder code: do lookup again as the old pointer could be
  invalidated during the cleanup operation
* in initiar code: do the cleanup of session if there're no child SAs or
  if there's no response from the responder during initial request (this
  can easily happen if the response packet was lost/dropped/etc)
* print the state of ikev2 profile (for easier tshooting)

Type: fix

Change-Id: I853d9851c0cf131696585e3c98fa97e66789badd
Signed-off-by: Stanislav Zaikin <stanislav.zaikin@46labs.com>
2023-07-27 07:45:01 +00:00
Florin Coras
0eff4e722c vcl: allow rx of zero length dgrams
Type: fix

Change-Id: I438ef488357456e9415e51a17355e9eba8518808
Signed-off-by: Florin Coras <fcoras@cisco.com>
2023-07-26 11:28:03 -07:00
Vratko Polak
e9ea7d5216 vlib: rename vnet_log_get_class_data
It is a function in vlib, so no reason to mention vnet.

Type: fix
Fixes: bf179a91d8d224c64d08643a2bb52580f68ce96b

Change-Id: Ic5f601d94d88b667f7ce44a017a0e1d5b4db5da1
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2023-07-26 13:48:20 +02:00
Steven Luong
116392b174 stats: remove extra format line
The extra format line was added for no reason from patch ff27c9f8e.

Type: fix
Fixes: ff27c9f8e

Change-Id: Ib25149cc8a17c29d0c8a0dbc06f0ea12ca4f328c
Signed-off-by: Steven Luong <sluong@cisco.com>
2023-07-26 01:57:13 +00:00
Filip Tehlar
0028e6f316 session: use session error type instead of vnet error
Type: improvement

Change-Id: Ie0bad9e03ac2e29da23af01ee7f63cb44489ad9c
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2023-07-26 01:09:17 +00:00
Damjan Marion
cc8249c5fd vlib: interrupt mode support for pre-input nodes
Type: improvement
Change-Id: Ic6e60597d2be63e3a0ae4399a81dbbd72392f30d
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-07-25 20:10:29 +00:00
Maxime Peim
3f40755749 classify: add bpf support to pcap classifier
Type: feature
Change-Id: I28fb38e49c89f4c4d4cc58c1a5c0aa8502678472
Signed-off-by: Maxime Peim <mpeim@cisco.com>
2023-07-25 10:06:16 +00:00
Tianyu Li
4ab1aa3145 dpdk: fix signed single bit field
clang-16 complains about signed one-bit bitfield value changes
from 1 to -1. Use unsigned type instead.

Type: fix
Signed-off-by: Tianyu Li <tianyu.li@arm.com>
Change-Id: I84f8cf314d36183a5e6f544cd756c01d1d10a1a5
2023-07-25 08:13:26 +00:00
Gabriel Oginski
c3f505fe7b vpp-swan: fix handler API messages
In the current implementation there is a bug related to the incorrect
message handling due to the wrong id.

The fix changes logic responsible for handling incoming API messages
by correcting their ids.

Type: fix
Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: Iea29506053c9fd2e1d01bce83e7f4a6e1de39321
2023-07-24 08:15:21 +00:00
qinyang
af9b7156c8 vcl: ldp support SO_ORIGINAL_DST
Type: improvement

Support SO_ORIGINAL_DST socket option to get original dst_ip4 and dst_port if nat44 rule enabled.

Change-Id: If00e00d03e48f3b78a23a68f1b078954d79dd0f7
Signed-off-by: qinyang <qiny@yusur.tech>
2023-07-21 16:27:14 +00:00
Naveen Joy
ae916b3904 tests: Add checksum offload interface tests
Type: test

Change-Id: I6edc8858b802d3d32159d71c1e867a06cc1025d5
Signed-off-by: Naveen Joy <najoy@cisco.com>
2023-07-21 13:00:05 +00:00
Piotr Bronowski
3a6bc6f127 ipsec: fix logic in ext_hdr_is_pre_esp
When _VEC128 instructions are not enabled logic is buggy.
The function always returned 1.

Type: fix

Signed-off-by: Piotr Bronowski <piotrx.bronowski@intel.com>
Change-Id: I603200637e8d65813f4e49ef15d798e74b79b9cf
2023-07-21 00:28:05 +00:00
Steven Luong
2da272e3da vcl: zero out cmsg for recvmsg API
When msg->msg_controllen is set in recvmsg, the caller wants to receive
additional information about the messages. However, they might not
always be available. In that case, we should clear cmsg since
the caller uses CMSG_NXTHDR which might access uninitialized fields in
cmsg.

Type: fix

Change-Id: Ifdf9634bfcb1427f7ae3812014a46bfd7f4bc473
Signed-off-by: Steven Luong <sluong@cisco.com>
2023-07-19 06:37:29 +00:00
Gabriel Oginski
0e1fe7ba86 vpp-swan: change flow in function for add route
This patch addresses the issue when the list of available interfaces
is not up to date. Due to this issue adding a new route fails
and finally the connection is not established.

Type: fix
Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: I3a63c0dd99ebc28ea149b4b23867440937682761
2023-07-19 02:38:00 +00:00
Gabriel Oginski
efd2350d65 vpp-swan: fix incorrect msg ID in register_event
This patch addresses the issue where the message ID registration
in the register_event function is incorrect. Due to this incorrect
registration, the lookup for the corresponding callback on received
messages fails, eventually leading to a segmentation fault
and double-free memory space.

Type: fix
Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: If95182f972f64adb44d514e18c831cc9627d8f0f
2023-07-19 02:32:11 +00:00
Gabriel Oginski
73d82d1273 vpp-swan: fix function to get sw_if_index
In the current implementation there is a bug in the function
responsible for getting software interface index by the name of the
interface. Incorrect function is used to send the API message, also
the handler with replied message is incorrect.

The fix changes function to send dump message and also adds handler
with replied message in the correct way.

Type: fix
Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: Id1a3ba2ce7e92d216907f344431b9e2acb1d5572
2023-07-19 02:31:21 +00:00
Dave Wallace
f72a32a1e4 docs: add api change process from wiki
- Move the VPP API Change Process documentation
  from the wiki page into the in-tree VPP docs

Type: docs

Change-Id: I42f661618b8632230bebe3aa8fbad455b9a05d01
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2023-07-17 14:55:06 +00:00
Matthew Smith
e870d5b6ac ipip: populate mode in tunnel details
Type: improvement

There is a mode field in ipip_tunnel_details. The handler for the dump
API does not do anything to populate it so it always contains 0
(TUNNEL_API_MODE_P2P). This is correct for p2p tunnels but is wrong for
multipoint tunnels.

Populate the field with the correct mode.

Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Change-Id: I6c1288a0d3929db0f67100748b5760c36b594f97
2023-07-14 17:42:26 +00:00
Florin Coras
5464134288 hsa: fix echo client init
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ieb2d1e6e0949844a70c81b218ca7dc83690776ca
2023-07-13 10:43:19 +00:00
Nobuhiro MIKI
95c2da7c25 lb: Fix src_ip_sticky evaluation bug in per-port-vip case.
Before this fix, the src_ip_sticky flag was passed as an argument to
the lb_node_get_hash function, which computes a hash value for a packet.
However, in per-port-vip case, the value of src_ip_sticky flag may be
different for each port number. As a result, the value is the same for
all port numbers, even though it is a per-port-vip case.

This commit fixes the src_ip_sticky evaluation by delaying it until the
packet is received, so that the correct value is obtained. Also, the
unit test case has been enhanced for this bug fix.

The steps to reproduce this bug are described below:
https://lists.fd.io/g/vpp-dev/message/23248

Type: fix
Fixes: 613e6dc0bf92 ("lb: add source ip based sticky load balancing")
Change-Id: I483492b214a1768e7a21fd86edd5151b3c46528b
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
2023-07-13 08:10:26 +00:00
Alexander Chernavin
df4d342d76 linux-cp: fix crash on processing dump of routes
nl_route_add() recently started to use its optional argument to check
whether replace flag is set for the message. When notification messages
are processed, the argument is a pointer to the corresponding message
info. However, when dump replies are processed, the argument is a null
pointer. This leads to null pointer dereference and crash when dump of
routes is processed.

With this fix, check for replace flag only if message info was passed
to nl_route_add(). Otherwise, assume the flag is not set. Dump replies
do not have it set.

Type: fix
Change-Id: Icb04a1146e09cc965b623018c28f91b347be0eab
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2023-07-12 17:03:49 +00:00
Damjan Marion
cf1880284c avf: remove barrier
Type: improvement

Change-Id: I95023d2e6034b77952e0423d0430b433ea0dab15
Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-07-11 20:37:23 +00:00
Adrian Pistol
44b3abe86a linux-cp: Basic MPLS support.
1) Imports ENCAP_MPLS labels from IPv4/IPv6 routes.
Note that this requires libnl 3.6.0 or newer.

In previous patches, the fib_path_ext_t had a path ID of -1.
After a long investigation, it turned out to be caused by route weight
being set to 0. There is a comment explaining more details.

2) Handles MPLS routes.
MPLS routes were wrongly added as IPv4 routes before.

POP and SWAP are now both supported.
All the routes are installed as NON-EOS and EOS routes,
as the Linux kernel does not differentiate.

EOS POP used in PHP uses the next-hop address family
to determine the resulting address family.

This patch is sufficient for P setups.
PE setups with implicit null should also function okay, as long as a
seperate label gets programmed per address family.

PE setups with explicit null will also forward packets,
but punting is a bit odd and needs MPLS input enabled on the LCP host
device.

3) Propagate MPLS input state to LCP Pair and Linux.
Since the Linux kernel uses the MPLS routes itself,
the LCP pair tap needs MPLS enabled to allow host originated packets.

This also syncs the Linux `net.mpls.conf.<host_if>.input` sysctl to
allow punted packets to have MPLS labels, mostly explicit nulls.

In addition, a special feature is enabled to cross connect MPLS packets
coming from Linux directly to interface-output untouched.

Make sure to enable MPLS/add a table in VPP first and load the
MPLS kernel modules!!

Type: feature
Change-Id: Ie4184bb4cc96905bf8b483a27e7ca6d251697374
Signed-off-by: Adrian Pistol <vifino@posteo.net>
Signed-off-by: Pim van Pelt <pim@ipng.nl>
2023-07-11 17:09:25 +00:00
Steven Luong
ff27c9f8ec stats: fix duplicate /if/names entry
stats entries /if/names are never deleted as it is a vector of the
sw_if_index value. When the interface is deleted and then created again
later, and if the new interface takes a different sw_if_index, we may
end up with duplicate entries for the same interface name. For example,
the following configuration sequence causes problem

create loopback interface
create loopback interface
delete loopback interface intfc loop0
delete loopback interface intfc loop1
create loopback interface

vpp_get_stats dump /if/names
[0]: local0 /if/names
[1]: loop0 /if/names
[2]: loop0 /if/names

The fix is to set the delete /if/names entry to deleted when the interface is deleted.

Type: fix

Change-Id: I7d811b12d56e3cf8c7deffe14736ea0f24814d02
Signed-off-by: Steven Luong <sluong@cisco.com>
2023-07-07 16:55:31 +00:00