[Openvpn-devel,04/25] dco: create DCO interface using SITNL

Message ID 20220624083809.23487-5-a@unstable.cc
State Accepted
Headers show
Series ovpn-dco: introduce data-channel offload support | expand

Commit Message

Antonio Quartulli June 23, 2022, 10:37 p.m. UTC
Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 src/openvpn/networking_sitnl.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Arne Schwabe June 27, 2022, 1:06 a.m. UTC | #1
Am 24.06.22 um 10:37 schrieb Antonio Quartulli:
> Signed-off-by: Antonio Quartulli <a@unstable.cc>
> ---
>   src/openvpn/networking_sitnl.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c
> index bffcb067..0944ad0a 100644
> --- a/src/openvpn/networking_sitnl.c
> +++ b/src/openvpn/networking_sitnl.c
> @@ -28,6 +28,7 @@
>   
>   #include "syshead.h"
>   
> +#include "dco.h"
>   #include "errlevel.h"
>   #include "buffer.h"
>   #include "misc.h"
> @@ -1344,6 +1345,16 @@ net_iface_new(openvpn_net_ctx_t *ctx, const char *iface, const char *type,
>   
>       struct rtattr *linkinfo = SITNL_NEST(&req.n, sizeof(req), IFLA_LINKINFO);
>       SITNL_ADDATTR(&req.n, sizeof(req), IFLA_INFO_KIND, type, strlen(type) + 1);
> +#if defined(ENABLE_DCO)
> +    if (arg && (strcmp(type, "ovpn-dco") == 0))
> +    {
> +        dco_context_t *dco = arg;
> +        struct rtattr *data = SITNL_NEST(&req.n, sizeof(req), IFLA_INFO_DATA);
> +        SITNL_ADDATTR(&req.n, sizeof(req), IFLA_OVPN_MODE, &dco->ifmode,
> +                      sizeof(uint8_t));
> +        SITNL_NEST_END(&req.n, data);
> +    }
> +#endif
>       SITNL_NEST_END(&req.n, linkinfo);
>   
>       req.i.ifi_family = AF_PACKET;

Acked-By: Arne Schwabe <arne@rfc2549.org>
Gert Doering June 28, 2022, 5:21 a.m. UTC | #2
This does not really do anything yet, and it won't affect "non dco"
builds.  For DCO builds, it looks reasonable and compiles without
warning (and all it really does is "if dco, then add IFLA_OVPN_MODE"
to the netlink message, passing in p2p / p2mp mode)

Your patch has been applied to the master branch.

commit 2a02c90a4501b04a43a25824fe9f7b980e10fc40
Author: Antonio Quartulli
Date:   Fri Jun 24 10:37:48 2022 +0200

     dco: create DCO interface using SITNL

     Signed-off-by: Antonio Quartulli <a@unstable.cc>
     Acked-by: Arne Schwabe <arne@rfc2549.org>
     Message-Id: <20220624083809.23487-5-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24514.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c
index bffcb067..0944ad0a 100644
--- a/src/openvpn/networking_sitnl.c
+++ b/src/openvpn/networking_sitnl.c
@@ -28,6 +28,7 @@ 
 
 #include "syshead.h"
 
+#include "dco.h"
 #include "errlevel.h"
 #include "buffer.h"
 #include "misc.h"
@@ -1344,6 +1345,16 @@  net_iface_new(openvpn_net_ctx_t *ctx, const char *iface, const char *type,
 
     struct rtattr *linkinfo = SITNL_NEST(&req.n, sizeof(req), IFLA_LINKINFO);
     SITNL_ADDATTR(&req.n, sizeof(req), IFLA_INFO_KIND, type, strlen(type) + 1);
+#if defined(ENABLE_DCO)
+    if (arg && (strcmp(type, "ovpn-dco") == 0))
+    {
+        dco_context_t *dco = arg;
+        struct rtattr *data = SITNL_NEST(&req.n, sizeof(req), IFLA_INFO_DATA);
+        SITNL_ADDATTR(&req.n, sizeof(req), IFLA_OVPN_MODE, &dco->ifmode,
+                      sizeof(uint8_t));
+        SITNL_NEST_END(&req.n, data);
+    }
+#endif
     SITNL_NEST_END(&req.n, linkinfo);
 
     req.i.ifi_family = AF_PACKET;