Compare commits

...

21 Commits

Author SHA1 Message Date
Daniel Béreš
1b93285ce0 nat: fix nat44 vrf handlers
Change of enums used in REPLY_MACRO() to appropriate one
for handlers:
-vl_api_nat44_ed_add_del_vrf_table_t_handler
-vl_api_nat44_ed_add_del_vrf_route_t_handler

Type: fix

Change-Id: I58e97817b1678da7c025c0d03a8b938a4e0f7b6c
Signed-off-by: Daniel Béreš <daniel.beres@pantheon.tech>
(cherry picked from commit 2c03879ce45c6568da015c01d85300eef147ece7)
2023-03-31 15:22:28 +00:00
Dave Wallace
57302fe52f misc: VPP 22.10.1 Release Notes
Type: docs
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Change-Id: I70374ea376c895d92d5789debf4b437113e3d884
2023-02-10 19:20:28 -05:00
Dave Wallace
6d93d060a8 misc: VPP 22.06.1 Release Notes
Type: docs
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Change-Id: I8770a35c801126ffd2de8f58d79e6616642709a9
(cherry picked from commit 1513b381d8879d9d437bbbc9a270b4ff5f4b19ba)
2023-02-10 14:23:56 -05:00
Benoît Ganne
474f0ba2ab ipsec: fix AES CBC IV generation (CVE-2022-46397)
For AES-CBC, the IV must be unpredictable (see NIST SP800-38a Appendix
C). Chaining IVs like is done by ipsecmb and native backends for the
VNET_CRYPTO_OP_FLAG_INIT_IV is fully predictable.
Encrypt a counter as part of the message, making the (predictable)
counter-generated IV unpredictable.

Fixes: VPP-2037
Type: fix

Change-Id: If4f192d62bf97dda553e7573331c75efa11822ae
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-02-03 21:04:11 -05:00
Vladimir Ratnikov
b89dcf8241 dpdk: link DPDK with MLX4/MLX5 libraries again
Previously it was linked and worker properly. While rdma build
was simplified, link was lost so all encrypted data won't pass
via Mellanox interfaces(ipsec, ipip, ssh etc) and NetVSC taps
won't created the right way.

 Errors:
mlx5_common: Verbs device not found: 21a5:00:02.0
mlx5_common: Failed to initialize device context.
EAL: Requested device 21a5:00:02.0 cannot be used
 Tested on Azure. Same errors appears on physical machine with
Mellanox connect adapter

Type: fix

Signed-off-by: Vladimir Ratnikov <vratnikov@netgate.com>
Change-Id: Ib68976282e0ed91c016a7318db6b5eddf5510c47
(cherry picked from commit 413447451e3f842815f45bae5d3cd3f87a0876e5)
2022-12-21 19:55:00 +00:00
Mauro Sardara
4b6fb593fb vapi: use the correct my_context_id when disconnecting API clients
While before the my_client_index variable was stored as global variable
in api_main_t, after commit 2ca88ff97884ec9ed20a853b13cee6d86f9c9d0f
the my_client_index becomes part of vapi_ctx_t.

Each API client (internal/external) connected to VPP stores its
client index in vapi_ctx_t.

The issue is in the client disconnection. The vapi_disconnect is
untouched in patch 2ca88ff97884ec9ed20a853b13cee6d86f9c9d0f,
so it keeps the behavior of using the my_client_index stored
in api_main_t.

Ticket: VPP-2069
Type: fix
Fixes: 2ca88ff97884ec9ed20a853b13cee6d86f9c9d0f

Signed-off-by: Mauro Sardara <msardara@cisco.com>
Change-Id: Idf8c1d1056cbd631cc3057cf7acc486216fa8303
(cherry picked from commit 8c626b41eaab5c74e7e023205f1c6cd655d40f44)
2022-12-20 12:09:26 +00:00
Neale Ranns
267175fd04 ipsec: Failure at the start of the batch should not invalidate the rest of the batch
Type: fix

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: Icd1e43a5764496784c355c93066273435f16dd35
(cherry picked from commit fe2d23f916d1991f4a1a8384eae41b5cceb80189)
2022-11-21 01:02:29 +00:00
Andrew Yourtchenko
07e0c05e69 misc: VPP 22.10 Release Notes
Type: docs

Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: If0f2ca0344640b064fde52b8f2c09a340ed9c71b
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2022-10-26 12:53:34 +00:00
Ting Xu
ad569da163 packetforge: fix GTP-Extension header field data
Fix the incorrect fields data of GTP-Extension header.

Type: fix
Signed-off-by: Ting Xu <ting.xu@intel.com>
Change-Id: Iafc5e852910649afcf0e583a5513b1ab33f5b5e8
(cherry picked from commit c9d916c7cc312d2396985f5cb83bcfdb98c98a1f)
2022-10-25 02:07:51 +00:00
Miguel Borges de Freitas
92ab02e8c0 docs: update cnat docs to current vpp version
The documentation for the cnat plugin is highly outdated specially on
the snat section.

Type: docs

Signed-off-by: Miguel Borges de Freitas <miguel-r-freitas@alticelabs.com>
Change-Id: I30b0c6295d3c812b636374753af3c37f29b0cc53
(cherry picked from commit 938bff8084d6f79b368fabd4a60b49117cad11be)
2022-10-24 16:19:59 +00:00
Andrew Yourtchenko
f06253edb0 vppinfra: fix incorrect sizeof() argument due to typo
fixes coverity 282527

Type: fix
Fixes: fecb2524ab
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: I9ac72c3802e66369a8f24c92451e33f22c058f24
(cherry picked from commit 0d36720f8d28964be2df32d354583047b6194e14)
2022-10-24 13:21:54 +00:00
Vladimir Ratnikov
e3618c1960 crypto-sw-scheduler: fix queue iterator
When there are several workers, iterator can and will skip
head iterator and it will last until BARRIER_SYNC_TIMEOUT won't
expire and will cause SIGABRT with `worker thread deadlock`

Type: fix

Signed-off-by: Vladimir Ratnikov <vratnikov@netgate.com>
Change-Id: Id4def4d5894e077ae27592367b141ecd822e86af
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
(cherry picked from commit 65bff88c3671ec6ee561e70f17c60ea9784a39dd)
2022-10-20 22:13:34 +00:00
Damjan Marion
b807f08d87 vppinfra: send minimal needed mask to the set_mempolicy syscall
Type: fix
fixes: 561ae5d

Change-Id: I0d98f5b43bc9ab5d31463b285177a11a10b864d2
Signed-off-by: Damjan Marion <dmarion@me.com>
(cherry picked from commit fecb2524ab71b105422a9a4377429c1871220234)
2022-10-18 15:41:42 +00:00
Gabriel Oginski
225d15cae9 vpp-swan: Add plugin for vpp-swan
Added plugin vpp-swan is a plugin that helps offloading
Strongswan IPsec ESP process from Linux Kernel to VPP.

Type: feature
Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: Iec77945892453fac1890d3c49d7d86fc6b09c893
(cherry picked from commit 4e88e041ad47bf422bbb2a0940f77aba11ea2178)
2022-10-18 06:26:30 +00:00
Neale Ranns
994d86f70e vlib: Counter free needs to NULL the allocated counter vector
otherwise the next time the counter is validated this is dangling.

Type: fix
Fixes: 58fd481d73

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: Ifa8d5ff27175cf6dfb30cbf023fa3251fe5c780e
(cherry picked from commit 80c0ae24378f249b3be9a02774d844c13143cd99)
2022-10-17 05:44:34 +00:00
Benoît Ganne
13c7e8f7a1 docs: fix memory traces command
Type: fix

Change-Id: I8fc949da209a5067c702952fbd0e6ce77b921d02
Signed-off-by: Benoît Ganne <bganne@cisco.com>
(cherry picked from commit 70892fcada81a4bef53dcd26c32cba5e26e1eb52)
2022-10-13 18:19:15 +00:00
Dave Wallace
61bae8a54d build: retain dpdk_mlx_default setting for ci script
- tell git to ignore all build/external generated files

Type: make

Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Change-Id: I4af26a76a0248939366cd09b577d422af801c0c3
(cherry picked from commit 14b118b4c7f5bd3927af48010092c5313884fbb2)
2022-10-07 18:54:15 +00:00
Mohammed Hawari
582c81e686 rdma: unhackish build of rdma-core
Change-Id: I2040b560b2a00f8bd176ae6ad46035678a2b249e
Type: improvement
Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
(cherry picked from commit 45e4e9444d961351178ee108b20525a9c929902d)
2022-10-05 02:19:30 +00:00
Mohammed Hawari
9aae8a4a9e build: mlx dpdk-rdma compatibility matrix
- Verify mlx_rdma_dpdk_matrix.txt versions,
  build MLX drivers in dpdk if the versions match.
  Also output version comparison results to a file
  for CI job to send notification email when the
  versions do not match.

Change-Id: Id1384ba4ea4b1f855f4d77d1d8e2c38683abfe1f
Type: improvement
Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
(cherry picked from commit 4e939ced65143fcfe9342dcccf3418a1018c8b0f)
2022-10-05 00:58:06 +00:00
Yacan Liu
569763f948 vcl: repatch "align the RST behaviour with kernel"
The previous patch[37164] was a bit flawed.

Type: fix
Signed-off-by: Yacan Liu <liuyacan@corp.netease.com>
Change-Id: Ia9d8b9c7853e8f4b960ce7de26d0384243deb667
(cherry picked from commit ab15770ec63367498dd277c83a577a52594953e8)
2022-09-27 06:09:28 +00:00
Andrew Yourtchenko
f845abb5dd misc: Initial changes for stable/2210 branch
Type: docs
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: I5b0e4a503867d339b901ef1a5a9ebc938bcd068b
2022-09-21 13:00:17 +00:00
45 changed files with 4531 additions and 107 deletions

4
.gitignore vendored
View File

@ -27,8 +27,8 @@
/build-config.mk
/build/external/*.tar.gz
/build/external/*.tar.xz
/build/external/vpp-*.deb
/build/external/vpp-*.changes
/build/external/vpp-*
/build/external/dpdk_mlx_default.sh
/build/external/downloads/
/path_setup
/tools/

View File

@ -2,3 +2,4 @@
host=gerrit.fd.io
port=29418
project=vpp
defaultbranch=stable/2210

View File

@ -817,6 +817,12 @@ I: rpm-packaging
M: Laszlo Kiraly <laszlo.kiraly@est.tech>
F: src/extras/rpm/opensuse
VPP StrongSwan Daemon
I: vpp-swan
M: Fan Zhang <roy.fan.zhang@intel.com>
M: Gabriel Oginski <gabrielx.oginski@intel.com>
F: extras/strongswan/vpp_sswan
THE REST
I: misc
M: vpp-dev Mailing List <vpp-dev@fd.io>

View File

@ -760,3 +760,7 @@ ifeq ($(OS_ID)-$(OS_VERSION_ID),$(MAKE_VERIFY_GATE_OS))
else
$(call banner,"Skipping tests. Tests under 'make verify' supported on $(MAKE_VERIFY_GATE_OS)")
endif
.PHONY: check-dpdk-mlx
check-dpdk-mlx:
@[ $$(make -sC build/external dpdk-show-DPDK_MLX_DEFAULT) = y ]

View File

@ -38,8 +38,8 @@ ARCH_X86_64=$(filter x86_64,$(shell uname -m))
include packages.mk
include packages/ipsec-mb.mk
include packages/quicly.mk
include packages/dpdk.mk
include packages/rdma-core.mk
include packages/dpdk.mk
include packages/libbpf.mk
.PHONY: clean

View File

@ -28,3 +28,5 @@ override_dh_install:
make $(MAKE_ARGS) install
dh_install -p$(PKG) --autodest /opt
override_dh_shlibdeps:
dh_shlibdeps -l$(INSTALL_DIR)lib/

View File

@ -0,0 +1 @@
rdma=41.0 dpdk=22.07

View File

@ -146,5 +146,9 @@ $(B)/.$1.install.ok: $(B)/.$1.build.ok
.PHONY: $1-install
$1-install: $(B)/.$1.install.ok
.PHONY: $1-show-%
$1-show-%:
@echo $$($$*)
ALL_TARGETS += $1-install
endef

View File

@ -14,9 +14,6 @@
DPDK_PKTMBUF_HEADROOM ?= 128
DPDK_USE_LIBBSD ?= n
DPDK_DEBUG ?= n
DPDK_MLX4_PMD ?= n
DPDK_MLX5_PMD ?= n
DPDK_MLX5_COMMON_PMD ?= n
DPDK_TAP_PMD ?= n
DPDK_FAILSAFE_PMD ?= n
DPDK_MACHINE ?= default
@ -34,6 +31,11 @@ dpdk_tarball_md5sum := $(dpdk_tarball_md5sum_$(dpdk_version))
dpdk_url := $(dpdk_base_url)/$(dpdk_tarball)
dpdk_tarball_strip_dirs := 1
dpdk_depends := rdma-core $(if $(ARCH_X86_64), ipsec-mb)
DPDK_MLX_DEFAULT := $(shell if grep -q "rdma=$(rdma-core_version) dpdk=$(dpdk_version)" mlx_rdma_dpdk_matrix.txt; then echo 'y'; else echo 'n'; fi)
DPDK_MLX4_PMD ?= $(DPDK_MLX_DEFAULT)
DPDK_MLX5_PMD ?= $(DPDK_MLX_DEFAULT)
DPDK_MLX5_COMMON_PMD ?= $(DPDK_MLX_DEFAULT)
# Debug or release
DPDK_BUILD_TYPE:=release
@ -173,6 +175,7 @@ PIP_DOWNLOAD_DIR = $(CURDIR)/downloads/
define dpdk_config_cmds
cd $(dpdk_build_dir) && \
echo "DPDK_MLX_DEFAULT=$(DPDK_MLX_DEFAULT)" > ../../../dpdk_mlx_default.sh && \
rm -rf ../dpdk-meson-venv && \
mkdir -p ../dpdk-meson-venv && \
python3 -m venv ../dpdk-meson-venv && \

View File

@ -32,27 +32,16 @@ define rdma-core_config_cmds
-DENABLE_STATIC=1 -DENABLE_RESOLVE_NEIGH=0 -DNO_PYVERBS=1 -DENABLE_VALGRIND=0\
-DCMAKE_BUILD_TYPE=$(RDMA_BUILD_TYPE) -DCMAKE_INSTALL_PREFIX=$(rdma-core_install_dir) \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_C_FLAGS='-fPIC -fvisibility=hidden' > $(rdma-core_config_log)
-DCMAKE_INSTALL_RUNDIR:PATH=/run \
-DCMAKE_C_FLAGS='-fPIC' -DNO_MAN_PAGES=ON | tee $(rdma-core_config_log)
endef
define rdma-core_build_cmds
$(CMAKE) --build $(rdma-core_build_dir) -- libccan.a libibverbs.a librdma_util.a libmlx5.a libmlx4.a > $(rdma-core_build_log)
sed 's/^Libs.private:.*/Libs.private: -lmlx4 -lmlx5 -libverbs -lrdma_util -lccan -lpthread/' -i $(rdma-core_build_dir)/lib/pkgconfig/libibverbs.pc >> $(rdma-core_build_log)
$(CMAKE) --build $(rdma-core_build_dir) | tee $(rdma-core_build_log)
endef
define rdma-core_install_cmds
mkdir -p $(rdma-core_install_dir)/lib/pkgconfig
cp -avL $(rdma-core_build_dir)/include $(rdma-core_install_dir) > $(rdma-core_install_log)
cp -avL $(rdma-core_build_dir)/lib/pkgconfig/libibverbs.pc \
$(rdma-core_build_dir)/lib/pkgconfig/libmlx5.pc \
$(rdma-core_build_dir)/lib/pkgconfig/libmlx4.pc \
$(rdma-core_install_dir)/lib/pkgconfig >> $(rdma-core_install_log)
cp -avL $(rdma-core_build_dir)/lib/statics/libibverbs.a \
$(rdma-core_build_dir)/lib/statics/libmlx5.a \
$(rdma-core_build_dir)/lib/statics/libmlx4.a \
$(rdma-core_build_dir)/util/librdma_util.a \
$(rdma-core_build_dir)/ccan/libccan.a \
$(rdma-core_install_dir)/lib >> $(rdma-core_install_log)
$(CMAKE) --install $(rdma-core_build_dir) | tee $(rdma-core_install_log)
endef
$(eval $(call package,rdma-core))

View File

@ -6,7 +6,9 @@ Release notes
.. toctree::
:maxdepth: 2
v22.10.1
v22.10
v22.06.1
v22.06
v22.02
v21.10.1
past

View File

@ -6,6 +6,7 @@ Past releases
.. toctree::
:maxdepth: 1
v21.10.1
v21.10
v21.06
v21.01
@ -38,4 +39,3 @@ Past releases
v17.01
v16.09
v16.06

View File

@ -0,0 +1,12 @@
Release notes for VPP 22.06.1
=============================
This is bug fix release.
Of particular importance, this release contains the fix for
`JIRA VPP-2307: CVE-2022-46397 FD.io VPP (Vector Packet Processor) IPSec generates a predictable IV in AES-CBC mode <https://jira.fd.io/browse/VPP-2037>`__
For the full list of fixed issues please refer to:
- fd.io `JIRA <https://jira.fd.io>`__
- git `commit log <https://git.fd.io/vpp/log/?h=stable/2206>`__

View File

@ -0,0 +1,12 @@
Release notes for VPP 22.10.1
=============================
This is bug fix release.
Of particular importance, this release contains the fix for
`JIRA VPP-2307: CVE-2022-46397 FD.io VPP (Vector Packet Processor) IPSec generates a predictable IV in AES-CBC mode <https://jira.fd.io/browse/VPP-2037>`__
For the full list of fixed issues please refer to:
- fd.io `JIRA <https://jira.fd.io>`__
- git `commit log <https://git.fd.io/vpp/log/?h=stable/2210>`__

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ To dump memory traces for analysis:
.. code-block:: console
$ vppctl show memory-trace on main-heap
$ vppctl show memory main-heap verbose
Thread 0 vpp_main
base 0x7fffb6422000, size 1g, locked, unmap-on-destroy, name 'main heap'
page stats: page-size 4K, total 262144, mapped 30343, not-mapped 231801

View File

@ -145,7 +145,7 @@ def GetMask(item):
if "format" in item:
format = item["format"]
if format == "mac":
mask = "ff.ff.ff.ff.ff.ff"
mask = "ff:ff:ff:ff:ff:ff"
elif format == "ipv4":
mask = "255.255.255.255"
elif format == "ipv6":

View File

@ -4,7 +4,7 @@
"layout" : [
{
"name" : "length",
"size" : "1",
"size" : "8",
"default" : "1",
"readonly" : "true"
},
@ -23,6 +23,10 @@
{
"name" : "qfi",
"size" : "6"
},
{
"name" : "nextext",
"size" : "8"
}
]
}

View File

@ -0,0 +1,108 @@
# the directory to the strongSwan sources
SWANDIR=${CURDIR}/../../../build-root/build-vpp-native/external/sswan
# location of config.h
CONFIGH=$(SWANDIR)/config.h
# default install prefix: /usr/local or /usr
PREFIX=/usr
# location of the installed strongSwan libraries
SWANLIBS=$(PREFIX)/lib/ipsec/
# location of the strongSwan plugins
SWANPLUGINS=$(PREFIX)/lib/ipsec/plugins
# location of the strongSwan archive
SWANARCHIVE=${CURDIR}/../../../build/external/downloads
# default install configuration files:
PREFIX_SYS_CONF=/etc
# target location of the plugin config snippet: $(PREFIX)/etc/strongswan.d/charon/ or /etc/strongswan.d/charon/
PLUGINCONF=$(PREFIX_SYS_CONF)/strongswan.d/charon/
# location of the VPP libraries
VPPLIBS=$(CURDIR)/../../../build-root/install-vpp-native/vpp/lib/x86_64-linux-gnu
# the directory to the VPP sources
VPPDIR=../../../build-root/install-vpp-native/vpp/include
TARGET=libstrongswan-kernel-vpp.so
# tested only with 5.9.5 and 5.9.6 version of strongSwan
VERSION_SSWAN=5.9.6
CFLAGS=-O2 -g -Wall -Wextra -fpic
CFLAGS_I=-include $(CONFIGH) \
-I$(SWANDIR)/src/libstrongswan \
-I$(SWANDIR)/src/libcharon
LDFLAGS= -lvppinfra \
-lvlibmemoryclient \
-lvppapiclient \
-lsvm \
-lvlib
VERSION_VPP=$(shell (dpkg -s vpp | grep Version) | grep -Po '(?<=Version: )\d\d.\d\d')
# check if VPP is installed
ifneq ($(shell test "$(shell ldconfig -p | grep vppinfra.so | awk 'NR==1{print $$1;}')" && echo "yes"), yes)
# check if VPPDIR exists
ifeq ($(shell test -d $(VPPDIR) && echo "yes"), yes)
CFLAGS_I += -I$(VPPDIR)
endif
# check if VPPLIBS exists
ifeq ($(shell test -d $(VPPLIBS) && echo "yes"), yes)
LDFLAGS += -L$(VPPLIBS)
LDFLAGS += -Wl,-rpath=$(VPPLIBS)
endif
endif
SOURCES=$(wildcard *.c)
OBJECTS=$(SOURCES:.c=.o)
all: pull-swan $(TARGET)
pull-swan:
@if [ -d "${SWANDIR}" ]; then \
rm -rf ${SWANDIR} ; \
fi
@if ! [ -f "${SWANARCHIVE}/strongswan-${VERSION_SSWAN}.tar.gz" ]; then \
curl -o ${SWANARCHIVE}/strongswan-${VERSION_SSWAN}.tar.gz -LO https://github.com/strongswan/strongswan/archive/${VERSION_SSWAN}.tar.gz; \
fi
@if ! [ -d "${CURDIR}/../../../build-root/build-vpp-native/external/" ]; then \
mkdir ${CURDIR}/../../../build-root/build-vpp-native/external; \
fi
tar -zxof ${SWANARCHIVE}/strongswan-${VERSION_SSWAN}.tar.gz -C ${CURDIR}/../../../build-root/build-vpp-native/external/
mv ${CURDIR}/../../../build-root/build-vpp-native/external/strongswan-${VERSION_SSWAN} ${SWANDIR}
cd ${SWANDIR} && ./autogen.sh
cd ${SWANDIR} && ./configure --prefix=${PREFIX} --sysconfdir=${PREFIX_SYS_CONF} --enable-libipsec --enable-systemd --enable-swanctl --disable-gmp --enable-openssl
cd ${SWANDIR} && make -j$(nproc)
# cd ${SWANDIR} && sudo make install
# check if VPP is installed
ifneq ($(shell test "$(shell ldconfig -p | grep vppinfra.so | awk 'NR==1{print $$1;}')" && echo "yes"), yes)
$(info INFO: Not found installed VPP - checking if locally VPP exists)
# check if VPPDIR exists
ifneq ($(shell test -d $(VPPDIR) && echo "yes"), yes)
$(error ERROR: Not found installed VPP and locally VPP - please install or build)
else
# check if VPPLIBS exists
ifneq ($(shell test -d $(VPPLIBS) && echo "yes"), yes)
$(error ERROR: directory $(VPPLIBS) - doesn't exists, please compile VPP before build this)
else
$(info INFO: Found locally VPP)
endif
endif
else
$(info INFO: Found installed VPP in version: $(VERSION_VPP))
endif
$(TARGET): $(OBJECTS)
gcc $(CFLAGS) -shared -DPIC $(OBJECTS) $(LDFLAGS) -Wl,-soname -Wl,$(TARGET) -o $@
cp $(TARGET) ${SWANDIR}
%.o: %.c
gcc $(CFLAGS) $(CFLAGS_I) -c $< -o $@ $(LDFLAGS)
install:
cp $(TARGET) $(SWANPLUGINS)/$(TARGET)
cp kernel-vpp.conf $(PLUGINCONF)
clean:
rm -f *.so *.o
.PHONY: clean install all

View File

@ -0,0 +1,128 @@
.. _vpp_sswan_doc:
VPP-SSWAN
=======================
``VPP-SSWAN`` is a StrongSwan plugin that helps offloading Strongswan IPsec ESP
process from Linux Kernel to ``VPP``.
The kernel-vpp plugin is an interface to the IPsec and networking backend for
`VPP <https://wiki.fd.io/view/VPP>`__ platform using the
`VPP C API <https://wiki.fd.io/view/VPP/How_To_Use_The_C_API>`__.
It provides address and routing lookup functionality and installs routes for
IPsec traffic.
It installs and maintains Security Associations and Policies to the
`VPP IPsec <https://wiki.fd.io/view/VPP/IPSec_and_IKEv2#IPSec>`__.
Prerequisites
-------------
``VPP`` in release mode should be built before compiling ``vpp-swan plugin``.
The dependencies of ``StrongSwan`` should be installed before building
``VPP-SSWAN``. In addition ``libsystemd-dev`` should be installed.
Build VPP Strongswan Plugin
-------------
The following list of things will be done to build ``vpp-swan plugin``:
- download strongswan source code to:
``path/to/vpp/build/external/downloads``
- unzip source code strongswan to:
``path/to/vpp/build-root/build-vpp-native/external/sswan``
- check if you have installed packages: ``libsystemd-dev`` on your OS
- configure strongswan by:
``./configure --prefix=/usr --sysconfdir=/etc --enable-libipsec
--enable-systemd --enable-swanctl --disable-gmp --enable-openssl``
- compile strongswan in:
``path/to/vpp/build-root/build-vpp-native/external/sswan``
- compile ``vpp-swan plugin`` by:
::
./make all
- if everything it ok, copy the compiled ``vpp-swan plugin`` to:
``/usr/lib/ipsec/plugins``
Build/install Strongswan
-------------
It is recommended to use ``Strongswan`` in version ``5.9.6`` or ``5.9.5``
installed from this script, due to configuration Strongswan that is required.
Only version ``5.9.5`` and ``5.9.6`` was tested with this plugin.
To install the built Strongswan, please execute the following command:
::
path/to/vpp/build-root/build-vpp-native/external/sswan/sudo make install
Insert plugin in runtime mode
-------------
After builded this plugin and also installed Strongswan you can loaded plugin
into Strongswan directory by:
::
./make install
Or you can do manually copy ``libstrongswan-kernel-vpp.so`` into:
``/usr/lib/ipsec/plugins`` and also ``kernel-vpp.conf`` into: ``/etc/strongswan.d/charon/``
And also you should restart Strongswan by:
::
systemctl restart strongswan.service
Configuration Strongswan
-------------
In ``swanctl.conf`` file you can find example configuration to initialize
connections between two endpoints.
Copy this file into: ``/etc/swanctl/conf.d/swanctl.conf``
Configuration VPP
-------------
In your ``startup.conf`` add these following commands:
::
plugins {
plugin linux_cp_plugin.so { enable }
plugin ikev2_plugin.so { disable }
}
linux-cp {
lcp-sync
}
To enable ``CP Plugin`` and disable ``IKEv2`` plugin.
These following commands executed in ``VPP``:
::
lcp create eth2 host-if eth2
set interface state eth2 up
set interface ip address eth2 192.168.0.2/24
set int state eth1 up
set int ip addr eth1 192.168.200.1/24
To create interface by ``CP Plugin`` and also setup two ethernet interfaces.
Misc
-------------
This plugin is based on:
`https://github.com/matfabia/strongswan
<https://github.com/matfabia/strongswan>`__
Author: Matus Fabian <matfabia@cisco.com>

View File

@ -0,0 +1,7 @@
kernel-vpp {
# Whether to load the plugin. Can also be an integer to increase the
# priority of this plugin.
load = yes
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
#ifndef KERNEL_VPP_IPSEC_H_
#define KERNEL_VPP_IPSEC_H_
/*
* Copyright (c) 2022 Intel and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <kernel/kernel_ipsec.h>
typedef struct kernel_vpp_ipsec_t kernel_vpp_ipsec_t;
/**
* Implementation of the kernel ipsec interface using Netlink.
*/
struct kernel_vpp_ipsec_t
{
/**
* Implements kernel_ipsec_t interface
*/
kernel_ipsec_t interface;
};
/**
* Create a vpp kernel ipsec interface instance.
*
* @return kernel_vpp_ipsec_t instance
*/
kernel_vpp_ipsec_t *kernel_vpp_ipsec_create ();
#endif /** KERNEL_VPP_IPSEC_H_ @}*/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
#ifndef KERNEL_VPP_NET_H_
#define KERNEL_VPP_NET_H_
/*
* Copyright (c) 2022 Intel and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <kernel/kernel_net.h>
typedef struct kernel_vpp_net_t kernel_vpp_net_t;
/**
* Implementation of the kernel network interface using Netlink.
*/
struct kernel_vpp_net_t
{
/**
* Implements kernel_net_t interface
*/
kernel_net_t interface;
};
/**
* Create a vpp kernel network interface instance.
*
* @return kernel_vpp_net_t instance
*/
kernel_vpp_net_t *kernel_vpp_net_create ();
#endif /** KERNEL_VPP_NET_H_ @}*/

View File

@ -0,0 +1,103 @@
/*
* Copyright (c) 2022 Intel and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <utils/debug.h>
#include <vlibapi/api.h>
#include <vlibmemory/api.h>
#define vl_typedefs
#define vl_endianfun
/* Include the (first) vlib-api API definition layer */
#include <vlibmemory/vl_memory_api_h.h>
/* Include the current layer (third) vpp API definition layer */
#include <vpp/api/vpe_types.api.h>
#include <vpp/api/vpe.api.h>
#undef vl_typedefs
#undef vl_endianfun
#include "kernel_vpp_plugin.h"
#include "kernel_vpp_shared.h"
#include "kernel_vpp_ipsec.h"
#include "kernel_vpp_net.h"
typedef struct private_kernel_vpp_plugin_t private_kernel_vpp_plugin_t;
/**
* private data of kernel vpp plugin
*/
struct private_kernel_vpp_plugin_t
{
/**
* implements plugin interface
*/
kernel_vpp_plugin_t public;
vac_t *vac;
};
METHOD (plugin_t, get_name, char *, private_kernel_vpp_plugin_t *this)
{
return "kernel-vpp";
}
METHOD (plugin_t, get_features, int, private_kernel_vpp_plugin_t *this,
plugin_feature_t *features[])
{
static plugin_feature_t f[] = {
PLUGIN_CALLBACK (kernel_ipsec_register, kernel_vpp_ipsec_create),
PLUGIN_PROVIDE (CUSTOM, "kernel-ipsec"),
PLUGIN_CALLBACK (kernel_net_register, kernel_vpp_net_create),
PLUGIN_PROVIDE (CUSTOM, "kernel-net"),
};
*features = f;
return countof (f);
}
METHOD (plugin_t, destroy, void, private_kernel_vpp_plugin_t *this)
{
if (this->vac)
{
lib->set (lib, "kernel-vpp-vac", NULL);
this->vac->destroy (this->vac);
}
free (this);
}
plugin_t *
kernel_vpp_plugin_create ()
{
private_kernel_vpp_plugin_t *this;
INIT(this,
.public = {
.plugin = {
.get_name = _get_name,
.get_features = _get_features,
.destroy = _destroy,
},
},
);
this->vac = vac_create ("strongswan");
if (!this->vac)
{
DBG1 (DBG_KNL, "vac_create failed");
destroy (this);
return NULL;
}
lib->set (lib, "kernel-vpp-vac", this->vac);
return &this->public.plugin;
}

View File

@ -0,0 +1,34 @@
#ifndef KERNEL_VPP_PLUGIN_H_
#define KERNEL_VPP_PLUGIN_H_
/*
* Copyright (c) 2022 Intel and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <plugins/plugin.h>
typedef struct kernel_vpp_plugin_t kernel_vpp_plugin_t;
/**
* vpp kernel interface plugin
*/
struct kernel_vpp_plugin_t
{
/**
* implements plugin interface
*/
plugin_t plugin;
};
#endif /** KERNEL_VPP_PLUGIN_H_ @}*/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,85 @@
#ifndef KERNEL_VPP_SHARED_H_
#define KERNEL_VPP_SHARED_H_
/*
* Copyright (c) 2022 Intel and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
typedef struct vac_t vac_t;
/**
* Callback function invoked for received event messages.
*
* @param data associated event message, destroyed by VPP API wrapper
* @param data_len length of the event message
* @param ctx user data, as passed to register_event
*/
typedef void (*event_cb_t) (char *data, int data_len, void *ctx);
/**
* Wrapper around VPP binary API client.
*/
struct vac_t
{
/**
* Destroy the VPP API client.
*/
void (*destroy) (vac_t *this);
/**
* Send VPP API message and wait for a reply
*
* @param in VPP API message to send
* @param in_len length of the message to send
* @param out received VPP API message
* @param out_len length of the received message
*/
status_t (*send) (vac_t *this, char *in, int in_len, char **out,
int *out_len);
/**
* Send VPP API dump message and wait for a reply.
*
* @param in VPP API message to send
* @param in_len length of the message to send
* @param out received VPP API message
* @param out_len length of the received message
*/
status_t (*send_dump) (vac_t *this, char *in, int in_len, char **out,
int *out_len);
/**
* Register for VPP API event of a given kind.
*
* @param in VPP API event message to register
* @param in_len length of the event message to register
* @param cb callback function to register
* @param event_id event ID
* @param ctx user data passed to callback invocations
*/
status_t (*register_event) (vac_t *this, char *in, int in_len, event_cb_t cb,
uint16_t event_id, void *ctx);
};
extern vac_t *vac;
/**
* Establishing a binary API connection to VPP.
*
* @param name client name
* @return vac_t instance
*/
vac_t *vac_create (char *name);
#endif /* KERNEL_VPP_SHARED_H_ */

View File

@ -0,0 +1,35 @@
connections {
net-net {
local_addrs = 192.168.0.2
remote_addrs = 192.168.0.1
local {
auth = psk
id = sun.strongswan.org
}
remote {
auth = psk
id = moon.strongswan.org
}
children {
net-net {
local_ts = 192.168.200.0/24
remote_ts = 192.168.100.0/24
esp_proposals = aes128-sha1-modp2048
rekey_time = 240m
}
}
version = 2
mobike = yes
encap = no # NAT-T if needed
proposals = aes128-sha256-x25519
}
}
secrets {
ike-net-net {
id = moon.strongswan.org
secret = simplepsk
}
}
# Include config snippets
include conf.d/*.conf

Some files were not shown because too many files have changed in this diff Show More