diff mbox series

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

Message ID 20210915162603.16652-1-talshn@nvidia.com (mailing list archive)
State Superseded
Delegated to: akhil goyal
Headers show
Series [1/2] security: use the net library for IP structs | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tal Shnaiderman Sept. 15, 2021, 4:26 p.m. UTC
Remove the netinet includes and replaces them
with rte_ip.h to support the in_addr/in6_addr structs
on all operating systems.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
---
 lib/net/rte_ip.h            | 1 +
 lib/security/meson.build    | 2 +-
 lib/security/rte_security.h | 5 +----
 3 files changed, 3 insertions(+), 5 deletions(-)

Comments

Akhil Goyal Sept. 15, 2021, 6:28 p.m. UTC | #1
> Remove the netinet includes and replaces them
> with rte_ip.h to support the in_addr/in6_addr structs
> on all operating systems.
> 
> Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
> ---
>  lib/net/rte_ip.h            | 1 +
>  lib/security/meson.build    | 2 +-
>  lib/security/rte_security.h | 5 +----
>  3 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
> index 05948b69b7..bbd8650962 100644
> --- a/lib/net/rte_ip.h
> +++ b/lib/net/rte_ip.h
> @@ -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>
> diff --git a/lib/security/meson.build b/lib/security/meson.build
> index 5679c8b5c2..1034a7a299 100644
> --- a/lib/security/meson.build
> +++ b/lib/security/meson.build
> @@ -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'?

> diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h
> index 2e136d7929..0c1adcee21 100644
> --- a/lib/security/rte_security.h
> +++ b/lib/security/rte_security.h
> @@ -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
Tal Shnaiderman Sept. 16, 2021, 6:40 p.m. UTC | #2
> Subject: RE: [EXT] [PATCH 1/2] security: use the net library for IP structs
> 
> External email: Use caution opening links or attachments
> 
> 
> > Remove the netinet includes and replaces them with rte_ip.h to support
> > the in_addr/in6_addr structs on all operating systems.
> >
> > Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
> > ---
> >  lib/net/rte_ip.h            | 1 +
> >  lib/security/meson.build    | 2 +-
> >  lib/security/rte_security.h | 5 +----
> >  3 files changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h index
> > 05948b69b7..bbd8650962 100644
> > --- a/lib/net/rte_ip.h
> > +++ b/lib/net/rte_ip.h
> > @@ -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>
> > diff --git a/lib/security/meson.build b/lib/security/meson.build index
> > 5679c8b5c2..1034a7a299 100644
> > --- a/lib/security/meson.build
> > +++ b/lib/security/meson.build
> > @@ -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'?
> 

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.

> > diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h
> > index 2e136d7929..0c1adcee21 100644
> > --- a/lib/security/rte_security.h
> > +++ b/lib/security/rte_security.h
> > @@ -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
William Tu Sept. 19, 2021, 2:06 p.m. UTC | #3
On Wed, Sep 15, 2021 at 9:27 AM Tal Shnaiderman <talshn@nvidia.com> wrote:
>
> Remove the netinet includes and replaces them
> with rte_ip.h to support the in_addr/in6_addr structs
> on all operating systems.
>
> Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
> ---

Acked-by: William Tu <u9012063@gmail.com>

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
diff mbox series

Patch

diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
index 05948b69b7..bbd8650962 100644
--- a/lib/net/rte_ip.h
+++ b/lib/net/rte_ip.h
@@ -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>
diff --git a/lib/security/meson.build b/lib/security/meson.build
index 5679c8b5c2..1034a7a299 100644
--- a/lib/security/meson.build
+++ b/lib/security/meson.build
@@ -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']
diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h
index 2e136d7929..0c1adcee21 100644
--- a/lib/security/rte_security.h
+++ b/lib/security/rte_security.h
@@ -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>