Skip to contentSkip to conversation

security: use the net library for IP structs

PATCH In review Tal Shnaiderman 4 participants 9 messages Sep 15, 2021 – Oct 1, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 security: use the net library for IP structs

Remove the netinet includes and replaces them with rte_ip.h to support the in_addr/in6_addr structs on all operating systems.

---
 lib/net/rte_ip.h            | 1 +
 lib/security/meson.build    | 2 +-
 lib/security/rte_security.h | 5 +----
 3 files changed, 3 insertions(+), 5 deletions(-)
lib/net/rte_ip.h +1 -0
index 05948b69b7..bbd8650962 100644
@@ -25,6 +25,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netinet/ip.h>
+#include <netinet/ip6.h>
 #endif
 
 #include <rte_byteorder.h>
lib/security/meson.build +1 -1
index 5679c8b5c2..1034a7a299 100644
@@ -3,4 +3,4 @@
 
 sources = files('rte_security.c')
 headers = files('rte_security.h', 'rte_security_driver.h')
-deps += ['mempool', 'cryptodev']
+deps += ['mempool', 'cryptodev', 'net']
lib/security/rte_security.h +1 -4
index 2e136d7929..0c1adcee21 100644
@@ -19,13 +19,10 @@ extern "C" {
 
 #include <sys/types.h>
 
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#include <netinet/ip6.h>
-
 #include <rte_compat.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
+#include <rte_ip.h>
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_memory.h>
Signature · 1 line
2.16.1.windows.4
#1 lore raw

PATCH 2/2 security: build on Windows

Build the security library on Windows.

Remove unneeded export from version file.

---
Depends-on: patch-98796 ("cryptodev: build on Windows")

---
 lib/meson.build          | 1 +
 lib/security/version.map | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
lib/meson.build +1 -0
index 5f3b1cf365..e5f0094a82 100644
@@ -86,6 +86,7 @@ if is_windows
             'gso',
             'latencystats',
             'pdump',
+            'security',
     ] # only supported libraries for windows
 endif
 
lib/security/version.map +0 -1
index c44c7f5f60..6067051552 100644
@@ -1,7 +1,6 @@
 DPDK_22 {
 	global:
 
-	rte_security_attach_session;
 	rte_security_capabilities_get;
 	rte_security_capability_get;
 	rte_security_session_create;
Signature · 1 line
2.16.1.windows.4
#3 lore raw

Re: [dpdk-dev] [PATCH 2/2] security: build on Windows

In reply to Tal Shnaiderman
Quoted 29 lines · Tal Shnaiderman

Build the security library on Windows.

Remove unneeded export from version file.

---
Depends-on: patch-98796 ("cryptodev: build on Windows")

---
  lib/meson.build          | 1 +
  lib/security/version.map | 1 -
  2 files changed, 1 insertion(+), 1 deletion(-)
lib/meson.build +1 -0
index 5f3b1cf365..e5f0094a82 100644
@@ -86,6 +86,7 @@ if is_windows
              'gso',
              'latencystats',
              'pdump',
+            'security',
      ] # only supported libraries for windows
  endif
 
lib/security/version.map +0 -0
index c44c7f5f60..6067051552 100644

lib/security/version.map line 6

Quoted 7 lines
lib/security/version.map +0 -1
@@ -1,7 +1,6 @@
  DPDK_22 {
  	global:
 
-	rte_security_attach_session;
  	rte_security_capabilities_get;
  	rte_security_capability_get;
  	rte_security_session_create;

Getting linking errors using clang for 'rte_security_get_userdata' and 'rte_security_set_pkt_metadata' as below:

FAILED: lib/rte_security-22.dll
"clang"  -Wl,/MACHINE:X64 -Wl,/OUT:lib/rte_security-22.dll lib/librte_security.a.p/security_rte_security.c.obj "-Wl,/nologo" "-Wl,/release" "-Wl,/nologo" "-Wl,/OPT:REF" "-Wl,/DLL" "-Wl,/IMPLIB:lib\rte_security.lib" "lib\rte_eal.lib" "lib\rte_kvargs.lib" "lib\rte_mempool.lib" "lib\rte_ring.lib" "lib\rte_cryptodev.lib" "lib\rte_mbuf.lib" "lib\rte_rcu.lib" "lib\rte_net.lib" "-Wl,/def:C:\dpdk\ixgbe\dpdk\build\lib\rte_security_exports.def" "-ldbghelp" "-lsetupapi" "-lws2_32" "-lmincore" "-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32" "-loleaut32" "-luuid" "-lcomdlg32" "-ladvapi32" rte_security_exports.def : error LNK2001: unresolved external symbol rte_security_get_userdata
rte_security_exports.def : error LNK2001: unresolved external symbol rte_security_set_pkt_metadata
lib\rte_security.lib : fatal error LNK1120: 2 unresolved externals
clang: error: linker command failed with exit code 1120 (use -v to see invocation)

Should it be removed from version file?

#4 lore raw

Re: [dpdk-dev] [PATCH 2/2] security: build on Windows

Quoted 65 lines

Subject: Re: [PATCH 2/2] security: build on Windows

External email: Use caution opening links or attachments

Quoted 29 lines · Tal Shnaiderman

Build the security library on Windows.

Remove unneeded export from version file.

---
Depends-on: patch-98796 ("cryptodev: build on Windows")

---
  lib/meson.build          | 1 +
  lib/security/version.map | 1 -
  2 files changed, 1 insertion(+), 1 deletion(-)
lib/meson.build index renamed from lib/meson.build +0 -0

5f3b1cf365..e5f0094a82 100644

lib/meson.build +1 -0
@@ -86,6 +86,7 @@ if is_windows
              'gso',
              'latencystats',
              'pdump',
+            'security',
      ] # only supported libraries for windows
  endif
 
lib/security/version.map index renamed from lib/security/version.map +0 -0

c44c7f5f60..6067051552 100644

lib/security/version.map line 6

Quoted 7 lines
lib/security/version.map +0 -1
@@ -1,7 +1,6 @@
  DPDK_22 {
      global:
 
-     rte_security_attach_session;
      rte_security_capabilities_get;
      rte_security_capability_get;
      rte_security_session_create;

Getting linking errors using clang for 'rte_security_get_userdata' and 'rte_security_set_pkt_metadata' as below:

FAILED: lib/rte_security-22.dll
"clang"  -Wl,/MACHINE:X64 -Wl,/OUT:lib/rte_security-22.dll lib/librte_security.a.p/security_rte_security.c.obj "-Wl,/nologo" "-Wl,/release" "-Wl,/nologo" "-Wl,/OPT:REF" "-Wl,/DLL" "-Wl,/IMPLIB:lib\rte_security.lib" "lib\rte_eal.lib" "lib\rte_kvargs.lib" "lib\rte_mempool.lib" "lib\rte_ring.lib" "lib\rte_cryptodev.lib" "lib\rte_mbuf.lib" "lib\rte_rcu.lib" "lib\rte_net.lib" "-Wl,/def:C:\dpdk\ixgbe\dpdk\build\lib\rte_security_exports.def" "-ldbghelp" "-lsetupapi" "-lws2_32" "-lmincore" "-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32" "-loleaut32" "-luuid" "-lcomdlg32" "-ladvapi32"
rte_security_exports.def : error LNK2001: unresolved external symbol rte_security_get_userdata rte_security_exports.def : error LNK2001:
unresolved external symbol rte_security_set_pkt_metadata lib\rte_security.lib : fatal error LNK1120: 2 unresolved externals
clang: error: linker command failed with exit code 1120 (use -v to see invocation)

Quoted 1 line

Should it be removed from version file?

Yes, those 2 functions were changed in the patch below after my v1 was sent and no longer need export.

https://git.dpdk.org/dpdk/commit/?id=d08dcd28c3b245468a9859b7b9a288247dfc95f1

I'll remove them from the version file in v2 as suggested, thanks.

#5 lore raw

Re: [dpdk-dev] [PATCH 2/2] security: build on Windows

In reply to Kadam, Pallavi
Quoted 63 lines · Pallavi
Quoted 29 lines · Tal Shnaiderman

Build the security library on Windows.

Remove unneeded export from version file.

---
Depends-on: patch-98796 ("cryptodev: build on Windows")

---
  lib/meson.build          | 1 +
  lib/security/version.map | 1 -
  2 files changed, 1 insertion(+), 1 deletion(-)
lib/meson.build +1 -0
index 5f3b1cf365..e5f0094a82 100644
@@ -86,6 +86,7 @@ if is_windows
              'gso',
              'latencystats',
              'pdump',
+            'security',
      ] # only supported libraries for windows
  endif
 
lib/security/version.map +0 -0
index c44c7f5f60..6067051552 100644

lib/security/version.map line 6

Quoted 7 lines
lib/security/version.map +0 -1
@@ -1,7 +1,6 @@
  DPDK_22 {
      global:
 
-     rte_security_attach_session;
      rte_security_capabilities_get;
      rte_security_capability_get;
      rte_security_session_create;

Getting linking errors using clang for 'rte_security_get_userdata' and 'rte_security_set_pkt_metadata' as below:

FAILED: lib/rte_security-22.dll
"clang" -Wl,/MACHINE:X64 -Wl,/OUT:lib/rte_security-22.dll lib/librte_security.a.p/security_rte_security.c.obj "-Wl,/nologo" "-Wl,/release" "-Wl,/nologo" "-Wl,/OPT:REF" "-Wl,/DLL" "-Wl,/IMPLIB:lib\rte_security.lib" "lib\rte_eal.lib" "lib\rte_kvargs.lib" "lib\rte_mempool.lib" "lib\rte_ring.lib" "lib\rte_cryptodev.lib" "lib\rte_mbuf.lib" "lib\rte_rcu.lib" "lib\rte_net.lib" "-Wl,/def:C:\dpdk\ixgbe\dpdk\build\lib\rte_security_exports.def" "-ldbghelp" "-lsetupapi" "-lws2_32" "-lmincore" "-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32" "-loleaut32" "-luuid" "-lcomdlg32" "-ladvapi32"
rte_security_exports.def : error LNK2001: unresolved external symbol rte_security_get_userdata
rte_security_exports.def : error LNK2001: unresolved external symbol rte_security_set_pkt_metadata
lib\rte_security.lib : fatal error LNK1120: 2 unresolved externals
clang: error: linker command failed with exit code 1120 (use -v to see invocation)

Quoted 2 lines

Should it be removed from version file?

Previously it works ok, now on the latest main branch also hit the same issue. And yes, we should remove it from the version file.
I will prepare the patch.
William

#6 lore raw
In reply to Tal Shnaiderman
Quoted 28 lines

Remove the netinet includes and replaces them with rte_ip.h to support the in_addr/in6_addr structs on all operating systems.

---
 lib/net/rte_ip.h            | 1 +
 lib/security/meson.build    | 2 +-
 lib/security/rte_security.h | 5 +----
 3 files changed, 3 insertions(+), 5 deletions(-)
lib/net/rte_ip.h +1 -0
index 05948b69b7..bbd8650962 100644
@@ -25,6 +25,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netinet/ip.h>
+#include <netinet/ip6.h>
 #endif
 
 #include <rte_byteorder.h>
lib/security/meson.build +0 -0
index 5679c8b5c2..1034a7a299 100644

lib/security/meson.build line 6

Quoted 5 lines
lib/security/meson.build +1 -1
@@ -3,4 +3,4 @@
 
 sources = files('rte_security.c')
 headers = files('rte_security.h', 'rte_security_driver.h')
-deps += ['mempool', 'cryptodev']
+deps += ['mempool', 'cryptodev', 'net']

It is just a header file inclusion, will it really need to add dependency on 'net'?

Quoted 21 lines
lib/security/rte_security.h +1 -5
index 2e136d7929..0c1adcee21 100644
@@ -19,13 +19,10 @@ extern "C" {
 
 #include <sys/types.h>
 
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#include <netinet/ip6.h>
-
 #include <rte_compat.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
+#include <rte_ip.h>
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_memory.h>
--

2.16.1.windows.4

#7 lore raw
Quoted 33 lines

Subject: RE: [EXT] [PATCH 1/2] security: use the net library for IP structs

External email: Use caution opening links or attachments

Quoted 28 lines

Remove the netinet includes and replaces them with rte_ip.h to support the in_addr/in6_addr structs on all operating systems.

---
 lib/net/rte_ip.h            | 1 +
 lib/security/meson.build    | 2 +-
 lib/security/rte_security.h | 5 +----
 3 files changed, 3 insertions(+), 5 deletions(-)
lib/net/rte_ip.h index renamed from lib/net/rte_ip.h +0 -0

05948b69b7..bbd8650962 100644

lib/net/rte_ip.h +1 -0
@@ -25,6 +25,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netinet/ip.h>
+#include <netinet/ip6.h>
 #endif
 
 #include <rte_byteorder.h>
lib/security/meson.build index renamed from lib/security/meson.build +0 -0

5679c8b5c2..1034a7a299 100644

lib/security/meson.build +0 -0
@@ -3,4 +3,4 @@
 
Quoted 7 lines
Quoted 4 lines
lib/security/meson.build +0 -0
 sources = files('rte_security.c')
 headers = files('rte_security.h', 'rte_security_driver.h') -deps +=

['mempool', 'cryptodev']
+deps += ['mempool', 'cryptodev', 'net']

It is just a header file inclusion, will it really need to add dependency on 'net'?

Without it I'm getting an error of missing file on the new include, I can replace it with an ifdef similar to what rte_ip.h has and loose the dependency:

#ifdef RTE_EXEC_ENV_WINDOWS
#include <ws2tcpip.h>
#else
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#endif

however I think it's better to remove OS includes, unless there is an issue with adding 'net' as dependency.

Quoted 21 lines
Quoted 21 lines
lib/security/rte_security.h +1 -5
index 2e136d7929..0c1adcee21 100644
@@ -19,13 +19,10 @@ extern "C" {
 
 #include <sys/types.h>
 
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#include <netinet/ip6.h>
-
 #include <rte_compat.h>
 #include <rte_common.h>
 #include <rte_crypto.h>
+#include <rte_ip.h>
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_memory.h>
--

2.16.1.windows.4

Acked-by on v1 1/2
#8 lore raw
In reply to Tal Shnaiderman
Quoted 7 lines · Tal Shnaiderman

Remove the netinet includes and replaces them with rte_ip.h to support the in_addr/in6_addr structs on all operating systems.

---

I sent a similar patch to enable ixgbe support for windows.
http://inbox.dpdk.org/dev/CALDO+SY_YkdV+Dx-dUJx8cyqafL6HdL=09DrOGCUBeonH2bPrA@mail.gmail.com/T/#t