12535 Commits

Author SHA1 Message Date
Ofer Heifetz
701ba9cfe3 tls: openssl: fix SSL_read partial read scenario
When application performs SSL_read from the app rx-fifo, it can
pre-allocate multiple segments, but there is an issue if the OpenSSL
manages to partially fill in the first segment, in this case, since
data is assumed to be copied over by OpenSSL to the pre-allocated
segments(s), vpp uses svm_fifo_enqueue_nocopy API which performs
zero copy by passing the pre-allocated segment to SSL_read.

If the decrypted data size is smaller than the pre-allocated fifo
segment buffer size, application will fetch buffers including zero
in the area not filled in by SSL_read.

Type: fix

Signed-off-by: Ofer Heifetz <oferh@marvell.com>
Change-Id: I941a89b17d567d86e5bd2c35785f1df043c33f38
(cherry picked from commit 905ec8797790380e134714e15ff3341eeeabb05e)
2023-02-03 03:58:51 +00:00
Andrew Yourtchenko
42b5a8767c misc: Initial changes for stable/2302 branch
Type: docs
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: Icea0f6987e3fd240167cab4d2304cd3962997a41
v23.02-rc1
2023-01-18 13:08:39 +00:00
Nobuhiro MIKI
613e6dc0bf lb: add source ip based sticky load balancing
This patch adds source ip based sticky session, which is already
implemented in many hardware LBs and software LBs. Note that sticky
sessions may be reset if the hash is recalculated as ASs are added
or deleted.

Since this feature is unrelated to the other existing options, the
lb_add_del_vip API version has been upgraded to v2 and a new option
"src_ip_sticky" has been added.

Type: feature
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Change-Id: I3eb3680a28defbc701f28c873933ec2fb54544ab
2023-01-18 10:53:23 +00:00
Guillaume Solignac
893a0c3130 build: use CMAKE_C_COMPILER_LAUNCHER for ccache
In some situations, CMake will find ccache in /usr/bin but /usr/bin
might not present in PATH. The former fix for this was to place the
ccache configuration logic before the project() declaration, but since
CMake 3.4 there is a new variable to be used which handles this case.

For the original problem, see also
https://crascit.com/2016/04/09/using-ccache-with-cmake/

Type: fix
Signed-off-by: Guillaume Solignac <gsoligna@cisco.com>
Change-Id: Ie026e02b2b06e2dca2d62da5fea7b1a104bcc7c3
2023-01-18 10:10:59 +00:00
Ole Troan
5d2346801b vppapigen: include comments in json
Type: feature
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: Ibd796adea734b64d9209c5e18c5b9800cbaf62c6
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2023-01-18 01:32:24 +00:00
Florin Coras
f4fe0168a6 hs-test: zero timeout on docker stop
Should drop execution time for all tests by about 80%.

Type: test

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ib6b4ef9fb4e7745a61b40c0b34e53e4046ccdbcc
2023-01-18 01:06:19 +00:00
Tianyu Li
531ac242a7 pppoe: fix memcpy out of bounds with gcc-11 on arm
In function ‘memcpy’,
    inlined from ‘clib_memcpy_fast’ at /home/vpp/src/vppinfra/string.h:86:10,
    inlined from ‘memcpy_s_inline’ at /home/vpp/src/vppinfra/string.h:157:7,
    inlined from ‘vnet_pppoe_add_del_session’ at /home/vpp/src/plugins/pppoe/pppoe.c:356:7:
 error: ‘__builtin_memcpy’ offset [0, 5] is out of the bounds [0, 0] [-Werror=array-bounds]
   34 |   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cc1: all warnings being treated as errors

Hardware address is zero length vector for PPP, use vec_len instead.

Type: fix
Fixes: 62f9cdd82c52 ("Add PPPoE Plugin")
Signed-off-by: Tianyu Li <tianyu.li@arm.com>
Change-Id: If9fb409cfbbac77c15559d103987f0130bf30255
2023-01-18 00:47:36 +00:00
aihua2013
936b8ddcf7 vppinfra:fix pcap write large file(> 0x80000000) error.
Type: improvement

Signed-off-by: aihua2013 <51931196@qq.com>
Change-Id: I22670f49abfb5d1fd728686fc7d65fb40ea6bda2
2023-01-18 00:42:25 +00:00
Klement Sekera
738cf73b2c tests: improve packet checksum functions
Fool-proof assert_checksum_valid so that one does not verify checksum on
wrong layer (because of how scapy internally works).

Make assert_packet_checksums_valid start checksum checking at inner
layers and outwards to make it more obvious where the error is. With old
behaviour, if one received an ICMP packet carrying a truncated TCP
packet, an error would be raised for ICMP checksum, as that one would be
the first to be wrong after recalculating all packet checksums, while
the real issue is TCP header being truncated and thus unsuitable for use
with this function.

Type: improvement
Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
Change-Id: I39a2b50ec5610f969cfde9796416ee3a50ae0ba3
2023-01-18 00:39:57 +00:00
Benoît Ganne
cc16e7bad7 pci: fix musl crash
The musl libc does not support closedir(0) resulting in a crash. Only
call closedir() if we successfully opened it.

Type: fix

Change-Id: I3198454f44735501047afc42b94b2fea273212f4
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-01-18 00:38:09 +00:00
Florin Coras
a35f56663f hs-test: add http proxy env to container builds
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I8c116efb41d561e30fd0db1388cdba903e2edffe
2023-01-17 17:44:30 +00:00
Maros Ondrejicka
f643b6f671 hs-test: autodetect ubuntu version during build
Since VPP binaries are being compiled on host system,
it makes sense to autodetect Ubuntu version when building test images
so that containers would be running version equal to host system.

Type: test
Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech>
Change-Id: I0e13d9ba1ddcd3ad5835bce1b8cccfc048e5e528
2023-01-17 17:38:47 +00:00
Pim van Pelt
4da8be4dba acl: CLI allow replace, allow deletion
Allow the CLI caller to specify an optional [index <idx>] index,
which will remove the ACL at that index. This mimicks the API behavior,

Add a 'delete acl-plugin acl index <idx>' to mimick the API acl_del
call, which will refuse to delete a non-existent index, as well as
an index that is referenced by an interface.

Type: improvement
Signed-off-by: pim@ipng.nl
Change-Id: I5f240f7a4e3bca14e8122917e8a5186d80094de2
2023-01-17 16:36:28 +00:00
Mohammed Hawari
463d5f95a0 vlib: install dma.h to fix out-of-tree plugins
Change-Id: I7888ab58abced93859ce15d0dbd1c3d7c94a02f5
Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
Type: fix
Fixes: 0654242d1ef51566f0d58445a16053cf376e5a6e
2023-01-17 12:21:14 +01:00
Filip Tehlar
f34f32f319 hs-test: better directory structure
Move config files to resources and docker files to separate directory

Type: test

Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: I24dd0705c4a463c06de525f28cb54d882527320a
2023-01-16 20:51:09 +00:00
Filip Tehlar
3f951433b8 hs-test: restrict concurrency on envoy
Type: test

Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: I8b06f4554a6ee5b13de829e47eaa82431a76c332
2023-01-16 20:47:33 +00:00
Gabriel Oginski
f4b82f52e8 wireguard: add local variable
The current implementation of wireguard use dereference value from
pointer, but between get and dereference the value from pointer can be
occur change in pool memory, which means that this pointer can be
invalid. Since current implementation doesn't handle with invalid
pointers, segfault can occur.

The fix add a local variable to keep index of peer from pool and also
handle with null pointers from get pointer from pool.

Type: fix
Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: Ic161ab08266e584493338c682d827ea1fd754b98
2023-01-16 16:09:35 +00:00
Piotr Bronowski
1d9780a43f ipsec: fix transpose local ip range position with remote ip range in fast path implementation
In fast path implementation of spd policy lookup  opposite convention to
the original implementation has been applied and local ip range has been
interchanged with the remote ip range. This fix addresses this issue.

Type: fix
Signed-off-by: Piotr Bronowski <piotrx.bronowski@intel.com>
Change-Id: I0b6cccc80bf52b34524e98cfd1f1d542008bb7d0
2023-01-16 14:54:06 +00:00
Sergey Nikiforov
e917bf75d9 vlib: add const to char* params of several funcs
These functions do not need modifiable strings.
It helps with linker sections as well as C++ compatibility.
It is a good style to use const where approriate.

Type: refactor
Signed-off-by: void234@gmail.com
Change-Id: Ib437a01663aa61860c6a938d869ed1111da71ec7
2023-01-14 12:12:25 +00:00
Sergey Nikiforov
e5465324dd vppinfra: add const to char* params of several funcs
These functions do not need modifiable strings.
It helps with linker sections as well as C++ compatibility.
It is a good style to use const where approriate.

Type: refactor
Signed-off-by: void234@gmail.com
Change-Id: I8d1e922197b3594122296e8c1af57e0a8ec0bf3d
2023-01-14 12:12:25 +00:00
Florin Coras
1d84abc93e vcl: set deq notify flag on epoll connected sessions
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I021f8e8bba247b0050d390a37dbc75900dc6a598
2023-01-13 20:23:00 +00:00
Maros Ondrejicka
8851ccfe4a hs-test: use equal ubuntu versions in test images
Official nginx image is based on Debian with older libc version,
that causes a runtime fail when VPP libraries are compiled in Ubuntu
which has newer libc.
Using equal version of Ubuntu in VPP image and in nginx image
ensures that running nginx won't fail due to different libc versions.

Type: test
Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech>
Change-Id: I48f3b23be30a9d9d9144351437ce163d64a4bb6b
2023-01-13 19:54:01 +00:00
Liangxing Wang
609d8e9186 vppinfra: fix else if check in _vec_set_len()
Type: fix

Signed-off-by: Liangxing Wang <liangxing.wang@arm.com>
Change-Id: I1f757abccd228b9e73f25c96754738c8e6bff259
2023-01-13 17:17:06 +00:00
Nick Brown
48ceadcf39 build: cmake NAMELINK_COMPONENT in vpp libraries
Installs the unversioned .so symlink in the -dev component.
This prevent debian lintian error:
link-to-shared-library-in-wrong-package

NAMELINK_COMPONENT was added in cmake 3.12

Type: make
Change-Id: I9d743218fa1f6b677659d745525e399ff66e73f4
Signed-off-by: Nick Brown <nickbroon@gmail.com>
2023-01-13 14:24:44 +00:00
Yulong Pei
f9a1748798 af_xdp: update af_xdp driver plugin to depend on libxdp
AF_XDP support is deprecated in libbpf since v0.7.0 [1], the libxdp library
now provides the functionality which once was in libbpf, this commit updates
af_xdp plugin to depend on libxdp, libbpf still remains a dependency even if
libxdp is present, as it need use libbpf APIs for program loading.

libxdp is distributed within xdp-tool [2], xdp-tools package also
include libbpf in it as dependency, so here installed libxdp v1.2.9 and
libbpf v0.8.0, both from xdp-tool-1.2.9 package.

More information about libxdp compatibility can be found in the libxdp
README [3].

In libbpf v0.8.0, The bpf_prog_load function was deprecated and changed to
bpf_object__open_file and bpf_object__next_program and bpf_object__load,
The bpf_get_link_xdp_id and bpf_set_link_xdp_fd functions were deprecated
and changed to bpf_xdp_attach and bpf_xdp_detach, The bpf_object__unload
function was deprecated and changed to bpf_object__close.

[1] https://github.com/libbpf/libbpf/commit/277846bc6c15
[2] https://github.com/xdp-project/xdp-tools/releases/tag/v1.2.9
[3] https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/README.org

Type: improvement

Change-Id: Ifbf6e3aa38bc6e0b77561f26311fd11c15ddb47e
Signed-off-by: Yulong Pei <yulong.pei@intel.com>
2023-01-13 09:57:00 +00:00
Dave Barach
809eb669c7 vppinfra: fix longstanding corner case bug in serialize_get()
serialize_get() -> serialize_write_not_inline(...) was losing track of
the current buffer index when it managed to empty the overflow vector
but had to turn around and use it again.

Test-case added to test_serialize.c.

This issue dates from 2010.

Type: fix

Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I024a03f7a50fd6df543ddbc7c45d85def4f1981d
2023-01-12 23:03:22 +00:00
Filip Tehlar
dcca9e75a1 hs-test: fix tests using wget
This fixes an issue on systems with http proxy set.

Type: test

Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: Ic84fcd0b8a7698ef101b369d46be858cbe85fc73
2023-01-12 16:21:55 +01:00
Guillaume Solignac
af5744c359 misc: use right include for fctnl.h and poll.h
Musl is stricter than glibc and has a warning that including fctnl.h and
poll.h should be prefered rather than their sys/ counterparts, which
breaks -Wall setups.

Type: fix
Signed-off-by: Guillaume Solignac <gsoligna@cisco.com>
Change-Id: Id101e999371951b0927cc8c4109f8f1536de1bc2
2023-01-12 13:18:36 +00:00
Josh Dorsey
6903da2323 abf: exclude networks with deny rules
Type: improvement

Signed-off-by: Josh Dorsey <jdorsey@netgate.com>
Change-Id: Iee43ca9278922fc7396764b88cff1a87bcb28349
2023-01-12 02:17:37 +00:00
Filip Tehlar
058237e581 hs-test: optimize size of docker image
Copy necessary only plugins in docker image

Type: improvement

Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: I5f60a8a1ccbbe099ac60774562dc5901f3b4fbed
2023-01-11 19:23:22 +00:00
Maros Ondrejicka
f719adfa89 hs-test: use anchors in yaml config files
Volumes can be referenced with anchors to reduce text duplication
and to explicitly show which containers share a volume.

Type: test
Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech>
Change-Id: Id408a78262573b3faf2257c32bfa569eca2e2049
2023-01-11 19:21:49 +00:00
Benoît Ganne
c04d8c41d1 virtio: add option to bind interface to uio driver
Type: improvement

Change-Id: I30e66370c927afeb62ba3a2b3334bdc2a31d4561
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-01-11 15:26:41 +00:00
Benoît Ganne
6a07348f4a pci: add option to force uio binding
Type: improvement

Change-Id: Ifea4badd58f7e2b5e792d7506f6747851a08587f
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-01-11 15:23:44 +00:00
Pim van Pelt
eea6edcda8 linux-cp: Fix endianness in lcp response
Creation of LCP will return garbled host_sw_if_index of the newly
created TAP interface.

Example PAPI code:
```
lcp_add = vpp.api.lcp_itf_pair_add_del_v2(is_add=True, sw_if_index=17,
          host_if_type=VppEnum.vl_api_lcp_itf_host_type_t.LCP_API_ITF_HOST_TAP,
          host_if_name="loop0", netns="dataplane")
print(lcp_add)

lcp_ret = vpp.api.lcp_itf_pair_get()
print(lcp_ret)
```

Before, the returned host_sw_if_index has the wrong endianness:
VPP version is 23.02-rc0~212-gf06a518f8
lcp_itf_pair_add_del_v2_reply(_0=103, context=2, retval=0, host_sw_if_index=301989888)
(lcp_itf_pair_get_reply(_0=105, context=3, retval=0, cursor=4294967295),[lcp_itf_pair_details(_0=106, context=3, phy_sw_if_index=17, host_sw_if_index=18, vif_index=594, host_if_name='loop0', host_if_type=<vl_api_lcp_itf_host_type_t.LCP_API_ITF_HOST_TAP: 0>, netns='dataplane')])

After, it is correctly showing idx 18:
VPP version is 23.02-rc0~212-gf06a518f8
lcp_itf_pair_add_del_v2_reply(_0=103, context=2, retval=0, host_sw_if_index=18)
(lcp_itf_pair_get_reply(_0=105, context=3, retval=0, cursor=4294967295), [lcp_itf_pair_details(_0=106, context=3, phy_sw_if_index=17, host_sw_if_index=18, vif_index=595, host_if_name='loop0', host_if_type=<vl_api_lcp_itf_host_type_t.LCP_API_ITF_HOST_TAP: 0>, netns='dataplane')])

Type: fix
Signed-off-by: pim@ipng.nl
Change-Id: I9085bac0c4a9ad64356c67f9b85f4910131e349e
2023-01-11 15:15:57 +00:00
Nathan Skrzypczak
1ce802d654 sr: remove stale runs_after
This patch removes a
.runs_after = VNET_FEATURES ("ip6-lookup"),
On the 'pt' node, as 'ip6-lookup' does not belong to the 'ip6-output' arc.

Type: fix

Change-Id: Ie34aaf7351593f08c61e3b02aaf9f72a4de1a437
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2023-01-11 15:15:46 +00:00
Benoît Ganne
f06a518f8b nat: do not use nat session object after deletion
Type: fix

Change-Id: Ifc709b6e7217a893d13aee6d3019e699637366ef
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-01-11 07:13:27 +00:00
Guillaume Solignac
897fbba434 sr: fix compilation errors
Uses VPP's clib_host_to_net functions, and initializes a potentially
uninitialized variable.

Type: fix
Signed-off-by: Guillaume Solignac <gsoligna@cisco.com>
Change-Id: Ie6b035c698f57ff39aeb955b35db8ec40f383b7a
2023-01-10 23:09:01 +00:00
Naveen Joy
1ee30fd5d2 tests: update install-deps to support interface test runs in the CI
Change-Id: I704c35644b3caf6567be4b43dc4e550d1394e438
Type: improvement
Signed-off-by: Naveen Joy <najoy@cisco.com>
2023-01-10 21:25:23 +00:00
Benoît Ganne
f457f1fa02 build: do not link with libssl if not needed
In most cases we only need OpenSSL libcrypto (crypto primitives) but
not libssl (tls).

Type: improvement

Change-Id: I9dce27d23d65bf46aea2d0f8aaf417240701efcc
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-01-10 20:51:05 +00:00
Florin Coras
9bc72ac8de udp: avoid listener cleanups with active opens
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ibff9f32e4fcaf0344207d8e43f3547180cbd4eef
2023-01-10 18:25:32 +00:00
Marcel Cornu
a9e266ea4a crypto-ipsecmb: fix perf scaling in ipsecmb v1.3
Type: fix

This patch adds a fix for an issue in the ipsecmb library resulting in
lower than expected performance in multi-threaded scenarios. This is
due to multiple threads writing the same global variable simultaneously.

Signed-off-by: marcel.d.cornu@intel.com
Change-Id: Ibcac321aa40da4b1709198dec3e18226e3891138
2023-01-10 16:55:26 +00:00
gaochx
2b1b1154c4 vrrp: fix update virtual addr make mistake
When use update api delete a virtual address, no matter which IP want to delete, always delete the last one.

Type: fix

Signed-off-by: GaoChX <chiso.gao@gmail.com>
Change-Id: Ia67c06dd53a442740794e1884d1a4aaa06965398
2023-01-10 15:20:08 +00:00
Florin Coras
c21775bd5c session: avoid trying to send incomplete dgram
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: Ibebe9e4ab7331c3ae66c9502e910368acaba51ec
2023-01-10 02:49:29 +00:00
Florin Coras
6d39c1e07e udp: initialize gso_size on dgram enqueue
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: I1b5a35b9d53cc56d4d8050de70f40b95e92f1011
2023-01-10 02:47:58 +00:00
Filip Tehlar
993c86f339 hs-test: remove exec flags from source files
Type: style

Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: Ia87b28e81b6fd06c8c3681bf3cb1dd6ce8c84f41
2023-01-09 15:48:40 +01:00
Filip Tehlar
f3ee2b636a hs-test: fix code style
This will add a new target (fixstyle) to Makefile that runs gofmt tool.

Type: style

Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: Icba60633f82aa8bbc75749f080e00f0375b55a18
2023-01-09 12:14:23 +01:00
Filip Tehlar
c204c87c18 hs-test: add nginx test
Type: test

Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: Idd5352f254df0d1f36c1270e73440c9287247b81
2023-01-09 11:39:06 +01:00
Florin Coras
227660b996 session: avoid dgram dequeues with no transport
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I1a3393b579caeb5dc25b60bc1b4a71706fb07051
2023-01-06 20:48:15 +00:00
Benoît Ganne
cfaf440202 bfd: fix ip address cli parsing
unformat_ip46_address() requires the address type as 2nd parameter.

Type: fix

Change-Id: Iaa1aebaebd1a947dab6c936c3b931854c0a3facc
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-01-06 11:20:30 +01:00
Matthew Smith
57f177d0b7 vapi: add vapi_stop_rx_thread()
Type: improvement

Allow vapi to signal to an application's RX thread that it should wake
up and exit.

Before disconnecting from VPP's API, libvlibmemoryclient inserts an
rx_thread_exit message into the client's own input queue to cause its
RX thread to wake up from its blocking dequeue and exit cleanly. Add a
function to vapi's API which will allow libvapi client applications
which have an RX thread waiting for incoming messages using vapi_wait()
to do the same thing.

The existing libvlibmemoryclient code which does this was moved to a
separate function and made available for vapi_stop_rx_thread() to call.

Also fixed some inconsistencies in indentation of function prototypes in
vapi.h to make checkstyle.sh happy.

Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Change-Id: I7bbb73470807123cc63ef313cfb91d1fd31b34e5
2023-01-04 17:00:15 +00:00