10170 Commits

Author SHA1 Message Date
Mohsin Kazmi
6809538e64 vlib: refactor checksum offload support
Type: refactor

This patch refactors the offload flags in vlib_buffer_t.
There are two main reasons behind this refactoring.
First, offload flags are insufficient to represent outer
and inner headers offloads. Second, room for these flags
in first cacheline of vlib_buffer_t is also limited.

This patch introduces a generic offload flag in first
cacheline. And detailed offload flags in 2nd cacheline
of the structure for performance optimization.

Change-Id: Icc363a142fb9208ec7113ab5bbfc8230181f6004
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-02-15 20:32:56 +00:00
Dave Barach
99c6dc6a7a misc: coverity fixes
Type: fix

Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I6a3348c7edd1cce6b407d336443103f77392bc5d
2021-02-15 19:27:09 +00:00
Paul Vinciguerra
6531514569 papi: add method to retrieve field options
Sample usage:
      cls.MEMIF_DEFAULT_BUFFER_SIZE = cls.vapi.vpp.get_field_options(
          'memif_create', 'buffer_size')['default']

Type: improvement

Change-Id: I298f4687623003a78c93a703d32f59a937e37bc2
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-02-15 17:28:25 +00:00
Paul Vinciguerra
ae936086fd tests: fix import in test/test_pcap.py
Type: test

Change-Id: Ib9192a12812b40090a0859cb73288aea27a3ca01
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-02-15 17:28:00 +00:00
Neale Ranns
8f5fef2c78 ip: Path MTU
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
2021-02-15 17:27:48 +00:00
Brian Russell
54be0cc044 policer: improve policer struct
Ensure policer struct is cache aligned and fits in one cache line.
Give it a simpler name to reflect its job as the representation of
a policer.

Type: improvement
Signed-off-by: Brian Russell <brian@graphiant.com>
Change-Id: If1ae4931c818b86eee20306e503f4e5d6b84bd0d
2021-02-15 16:18:32 +00:00
Benoît Ganne
1a3e08a719 vppinfra: fix memcpy undefined behaviour
Calling mem{cpy,move} with NULL pointers results in undefined behaviour.
This in turns is exploited by GCC. For example, the sequence:
    memcpy (dst, src, n);
    if (!src)
      return;
    src[0] = 0xcafe;
will be optimized as
    memcpy (dst, src, n);
    src[0] = 0xcafe;
IOW the test for NULL is gone.

vec_*() functions sometime call memcpy with NULL pointers and 0 length,
triggering this optimization. For example, the sequence:
    vec_append(v1, v2);
    len = vec_len(v2);
will crash if v2 is NULL, because the test for NULL pointer in vec_len()
has been optimized out.

This commit fixes occurrences of such undefined behaviour, and also
introduces a memcpy wrapper to catch those in debug mode.

Type: fix

Change-Id: I175e2dd726a883f97cf7de3b15f66d4b237ddefd
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-02-15 16:17:14 +00:00
Nathan Skrzypczak
ce3f8249b5 quic: Coverity fix
Type: fix

Change-Id: I744cedb9c1b57945af5e83057e4759964fd2e104
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-02-15 15:28:31 +00:00
Filip Tehlar
42bbb3f685 ikev2: fix rekey against strongSwan
When strongSwan rekeys it sends create child sa request first and then
delete request for the old child sa (or vice versa depending on
configuration) as opposed to sending just a single create child sa with
rekey notify message.

Type: fix

Change-Id: I1fa55a607ca623cd3a6d887436207153c6f6bbf6
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2021-02-15 13:57:41 +00:00
Brian Russell
bb9831403b tests: test punt policer bound to worker thread
Add to the IP[46] punt policer handoff tests by binding the policer to
a particular worker and checking all packets are policed on that thread.

Type: test
Signed-off-by: Brian Russell <brian@graphiant.com>
Change-Id: I7fab28659ccb65f13f841cec65a3f808281b3f90
2021-02-15 12:15:41 +00:00
Brian Russell
48e26367cf policer: add api to bind policer to worker
Add a new api to allow a policer to be bound to
a specific worker thread for thread handoff.

Type: improvement
Signed-off-by: Brian Russell <brian@graphiant.com>
Change-Id: I2623a6827843c3d93c0d7b4ad7c2e13611ec1696
2021-02-15 12:15:32 +00:00
Nathan Skrzypczak
fd0b399ff6 interface: Add promisc on/off in api
Type: feature

Change-Id: Ib777a5201f1c728438c7a5f2b1aa2246f1344b9b
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-02-15 12:08:09 +00:00
Neale Ranns
65d789e4ba fib: Always honour flow hash flag
Type: fix

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: Id7b27edf3712aaa3c277e752b9ca78bb91d184a1
2021-02-15 11:16:22 +00:00
Paul Vinciguerra
b00c49ca67 vppapigen: py2 cleanup - remove subclassing of object
Type: refactor

Change-Id: I7136cb8ba101ea3917dacc31ceb3a76a31328301
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-02-15 10:00:38 +00:00
Paul Vinciguerra
d1f05f7f86 tests: explicitly close subprocess files
Resolve the following error:
/vpp/test/framework.py:657: ResourceWarning: unclosed file <_io.BufferedReader name=6>
  del cls.vpp
Object allocated at (most recent call last):
  File "/usr/lib/python3.8/subprocess.py", lineno 844
    self.stdout = io.open(c2pread, 'rb', bufsize)

Type: test

Change-Id: Ia2974da594f0582dcff1f4bdf40d25475769c46c
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-02-15 09:57:11 +00:00
Vratko Polak
1fd1ea2534 rdma: rdma_log__ argument dev is a pointer
Also apply style edits as proprosed by checkstyle.

Ticket: VPP-1971
Type: fix

Change-Id: I4332a4e32220f3076b4a373da01cc0022cde32f5
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2021-02-15 09:33:00 +00:00
Ole Troan
6dab1aea92 nat: pnat only use save_rewrite_length on output path
Don't expect save_rewrite_length to be set correctly on RX path.

Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: Ieee40d119213f617c3d836181e5879f084b74548
Signed-off-by: Ole Troan <ot@cisco.com>
2021-02-13 15:14:04 +00:00
Neale Ranns
aa7d7662f6 ipsec: Store thread-index in buffer meta-data during SA handoff
Type: improvement

negates the need to load the SA in the handoff node.
don't prefetch the packet data, it's not needed.

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: I340472dc437f050cc1c3c11dfeb47ab09c609624
2021-02-12 20:09:28 +00:00
Vladimir Ratnikov
088bf1dcc3 dpdk: use whole vmbus address as hash key for devconf
u32[0] is not enough unique for some platforms like azure
where several devices(not only network) can have almost
the same addresses and this can cause collisions.

Change hash to mhash type for vmbus devices with key
of whole 16 bytes of vmbus address.

Type: improvement

Signed-off-by: Vladimir Ratnikov <vratnikov@netgate.com>
Change-Id: Ic6c6a657ae29f45beddd0c69d8e785e702349460
2021-02-12 19:30:14 +00:00
Brian Russell
bbccdc583c policer: tidy up
Convert old logging style to new and remove unused tracepoints.
Remove code always conditionally not compiled.
Make comment style consistent.

Type: improvement
Change-Id: I13339f28539cf190fb92be2d5c8020b6249319c8
Signed-off-by: Brian Russell <brian@graphiant.com>
2021-02-12 18:58:09 +00:00
Brian Russell
b2aae75c17 policer: use enum types
Make the policer action enum packed and use it in the policer code.
Use other policer enums where applicable.

Type: improvement
Signed-off-by: Brian Russell <brian@graphiant.com>
Change-Id: I32f9735942af8bca3160b9ef8a75f605d9aba5fa
2021-02-12 18:57:55 +00:00
Arthur de Kerhor
950d33ef67 docs: fixing VPP tutorial
Updating ARP table command.

Type: fix

Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com>
Change-Id: I02d6ac86aed4c83430f9d07bdeaa3e0f5c3ae73f
2021-02-12 15:39:27 +00:00
Brian Russell
c5299ff30a policer: remove SSE2 prefix
The policer code uses a naming convention of prefixing a lot of
its definitions with "SSE2" when in fact there is nothing SSE2
specific about them. This is confusing so remove the prefix.

Unfortunately it has to stay in the API definitions for backward
compatibility.

Type: improvement
Signed-off-by: Brian Russell <brian@graphiant.com>
Change-Id: I59a7df9fd5ded2575f2e587b2768a025a213b07c
2021-02-12 14:55:58 +00:00
Ole Troan
cf0102b3ba vppapigen: coverity issues in autogenerated code pass 3.
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I5ee2e8aba3ee7281bbca11825dece79983e52f06
2021-02-12 14:51:41 +00:00
Andrew Yourtchenko
b789f9992b build: add missing virtualenv dependencies for debian-10
Type: make
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: I57a1f90d7fe9e1262f210d0c091bafda5d496c69
2021-02-12 11:06:53 +00:00
Ole Troan
fb0afab7f5 vppapigen: fix fromjson coverity errors in generation
Fix memory leak coverity errors where free was not called
on error conditions. Or called twice.

Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I21cffa8b01e4f72f10501f202f6a762ae300a941
Signed-off-by: Ole Troan <ot@cisco.com>
2021-02-11 15:30:11 +00:00
Florin Coras
c25882c28e vppinfra: fix membulk coverity warnings
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I4830656ad852de62211e31574a0e0afb62d00f37
2021-02-11 10:38:12 +00:00
Andrew Yourtchenko
8dc0d488e6 tests: tag the tests that do not work with multi-worker configuration
If the multi-worker default VPP configuration is triggered by
setting VPP_WORKER_CONFIG="workers 2", some of the tests fail
for various reasons.

It's a substantial number, so this change marks all of the
testsets that have this issue, such that they can be addressed
later independently.

Type: test
Change-Id: I4f77196499edef3300afe7eabef9cbff91f794d3
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2021-02-11 09:54:02 +00:00
Mohammed Hawari
d5d253d618 wireguard: testing alternative timer dispatch
Change-Id: I645bb0a31b333a6160c74987dddb3fb50ff154d8
Type: improvement
Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
2021-02-11 08:38:48 +00:00
Brian Russell
e3845d79bf policer: use ip dscp
Use the common IP definitions of DSCP rather than duplicating in the
policer code.

Type: improvement
Signed-off-by: Brian Russell <brian@graphiant.com>
Change-Id: Iff4bc789356edc290b9c31eca33e93cf5b6211bf
2021-02-11 08:21:56 +00:00
Florin Coras
1bb74944a3 vcl: validate seg handle on migrate only if needed
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I3c15a465f84f2ceb6bd5f1c459899824d4bc1c90
2021-02-10 23:22:22 +00:00
Brian Russell
130680b21e tests: add policer tests
Add some tests which configure policer params, use the policer
test helper CLI to police pretend packets and then check the
policer stats.

Type: test
Signed-off-by: Brian Russell <brian@graphiant.com>
Change-Id: Ib2688b6f77d84a4bfd3c8185e44c59fa2300716a
2021-02-10 16:39:30 +00:00
Brian Russell
f91ff5fc33 tests: add policer test helper
Add a helper CLI to exercise a policer pre-configured by the test
harness. The test harness will check the stats afterwards.

Type: test
Signed-off-by: Brian Russell <brian@graphiant.com>
Change-Id: I913dda4a9f8179c1c6b3061a68164bf1e698a392
2021-02-10 16:39:22 +00:00
Dave Barach
b60620b9b5 vppinfra: fix bihash test-debug aarch64 sporadic failure
Turns out that both the multi-core and single-core add / del tests run
for just under 5 seconds (aarch64, debug image). Increase the vapi =>
debug CLI timeout to avoid spurious failures.

Type: test

Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: Ia64bffa82a908172a21c34f3ae4402ad774af28a
2021-02-10 15:37:07 +00:00
Neale Ranns
9ec846c268 ipsec: Use the new tunnel API types to add flow label and TTL copy
support

Type: feature

attmpet 2. this includes changes in ah_encrypt that don't use
uninitialised memory when doing tunnel mode fixups.

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: Ie3cb776f5c415c93b8a5ee22f22586fd0181110d
2021-02-10 13:39:37 +00:00
Klement Sekera
98d82ca04b nat: fix EI hairpinning thread safety
Avoid doing inter-thread reads without locks by doing a handoff before
destination address rewrite. Destination address is read from a session
which is possibly owned by a different thread. By splitting the work in
two parts with a handoff in the middle, we can do both in a thread safe
way.

Type: improvement
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Change-Id: I1c50d188393a610f5564fa230c75771a8065f273
2021-02-10 13:12:33 +00:00
Ole Troan
4f423bf6b4 misc: updating maintainers file
Adding maintainers for stn, ioam, cdp.

Type: improvement
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I0f75bb0044b340ee17a1720a7eea1c840625276b
2021-02-10 12:03:25 +01:00
Steven Luong
16f0865775 l2: crash on l2_input_is_xconnect
Running vpp without any interface configured and then invoking the
binary-api l2_xconnect_dump causes vpp to crash in l2_input_is_xconnect due
to l2input_main.configs has no memory allocated to it, not even for the local
interface which exists all the times.

The reason that l2input_main.configs has no memory allocated to it was due to
gerrit patch 29232 which took out a line in l2input_init

  /* Create the config vector */
  vec_validate (mp->configs, 100);

The fix is to iterate through l2input_main.configs for each interface in
l2 to call l2_input_is_xconnect when dumping l2_xconnect interfaces.

Type: fix
Fixes: gerrit 29232

Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: I8d9cba4b7eba4c2e0c60887c4fd57d5ec3b06d3b
2021-02-09 22:40:34 +00:00
Florin Coras
4b47ee26cb tls: dtls initial implementation
Type: feature

Basic dtls transport protocol implementation that relies on openssl
wire protocol implementation. Retries/timeouts not yet supported.

To test using vcl test apps, first ensure all arp entries are properly
resolved and subsequently:

server: vcl_server -p dtls 1234
client: vcl_client -p dtls <server-ip> 1234 -U -N 2000000 -T 1460 -X

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I04b4516a8fe9ce85ba230bcdd891f33a900046ed
2021-02-09 21:33:19 +00:00
Florin Coras
da2305fb87 session: coverity fixes
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I2828287c58115aa08c0a4297c01cea60f41f4749
2021-02-09 20:56:09 +00:00
Alexander Chernavin
74b2a9b2c6 crypto: fix bad-hmac in sw scheduler if async mode
When IPsec async mode is enabled, packets don't pass through the tunnel
if ciphers other than AES GCM are used for child SAs. An error that
arises is "bad-hmac" in the "crypto-dispatch" node.

On the encryption stage, the VNET_CRYPTO_OP_FLAG_HMAC_CHECK flag is set
for the integrity crypto operation when it's not supposed to. It seems
that the flag remains from the previous operation.

With this change, zero flags of crypto operations in the SW scheduler
during operation filling.

Type: fix
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Change-Id: Iabac253474e95cb01f9ec0933f3c4860f8a5289c
2021-02-09 19:47:05 +00:00
Paul Vinciguerra
447d55b86c gbp: fix typo in macro
Type: fix

Change-Id: I1f8245e8cccacb5bbb511aef39e31d0a76bba95f
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-02-09 18:34:18 +00:00
Paul Vinciguerra
b552ff2e93 papi: expose vpp_papi version to client
root@ae2a2e85c5d4:/vpp/src/vpp-api/python# python3
Python 3.6.9 (default, Oct  8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vpp_papi
>>> vpp_papi.__version__
'1.6.2'

Type: feature

Change-Id: I73025427a58214a842245fceaa77daa7acd3e6f8
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-02-09 18:32:40 +00:00
Paul Vinciguerra
3ca4b14e2d papi: remove python2 vpp-api-python.deb
Type: fix

Change-Id: I4901f7eb9d739afd4d45a25306434e9d122a4068
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2021-02-09 18:29:33 +00:00
Neale Ranns
c68ca7b6e1 misc: Now that VOM is deprecated remove the build dependency on boost
Type: make

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: Icbbae3ab222e7d97e6c496c13ec9229e94cf5ede
2021-02-09 16:53:37 +00:00
Klement Sekera
4579056c3f nat: bump default max translations to 63K
Type: improvement

Signed-off-by: Klement Sekera <ksekera@cisco.com>
Change-Id: Ibea7ec844d1d910e8a3235e11154b1ecea8302ac
2021-02-09 16:19:14 +00:00
Alexander Chernavin
f039587701 nat: deny adding intf addr if static-mapping-only
If static-mapping-only is enabled, NAT pool cannot be configured, only
static mappings. There're two ways to add addresses to the NAT pool:
by address range, or by first found address from an interface.
NAT44_ADD_DEL_ADDRESS_RANGE already tests if dynamic mappings are
available but NAT44_ADD_DEL_INTERFACE_ADDR doesn't. If
static-mapping-only is enabled, adding addresses by range is rejected
but by interface not.

With this change, if static-mapping-only is enabled, do not allow to
add addresses to the NAT pool both ways.

Type: fix
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Change-Id: Ifc055ea9a71a5e579388833a2990aef21bf7ed29
2021-02-09 15:58:29 +00:00
Ole Troan
c9c9143898 nat: fix coverity errors
Including a general missing free in fromjson autogenerated code.

Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I9ab2b0193135e2fb3d62d51b3c114df56969e341
Signed-off-by: Ole Troan <ot@cisco.com>
2021-02-09 09:56:56 +00:00
Klement Sekera
070387d3f4 nat: improve type safety and remove unused param
Type: improvement
Change-Id: I456f9b14e6a4eb46c9c49f6e09acccae530e4ebc
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2021-02-09 09:55:09 +00:00
Matthew Smith
751bb131ef Revert "ipsec: Use the new tunnel API types to add flow label and TTL copy"
This reverts commit c7eaa711f3e25580687df0618e9ca80d3dc85e5f.

Reason for revert: The jenkins job named 'vpp-merge-master-ubuntu1804-x86_64' had 2 IPv6 AH tests fail after the change was merged. Those 2 tests also failed the next time that job ran after an unrelated change was merged.

Change-Id: I0e2c3ee895114029066c82624e79807af575b6c0
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2021-02-09 04:18:37 +00:00