examples/ipsec-secgw: support inline UDP encapsulation
authorSrujana Challa <schalla@marvell.com>
Tue, 13 Jul 2021 07:42:18 +0000 (13:12 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Tue, 20 Jul 2021 08:32:05 +0000 (10:32 +0200)
Adds support to allow udp-encap option for
RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL mode also.

Signed-off-by: Srujana Challa <schalla@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
examples/ipsec-secgw/sa.c

index 7bb9ef3..17a2855 100644 (file)
@@ -759,20 +759,25 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens,
                        continue;
                }
                if (strcmp(tokens[ti], "udp-encap") == 0) {
-                       APP_CHECK(ips->type ==
-                               RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL,
-                               status, "UDP encapsulation is allowed if the "
-                               "session is of type lookaside-protocol-offload "
-                               "only.");
-                       if (status->status < 0)
-                               return;
-                       APP_CHECK_PRESENCE(udp_encap_p, tokens[ti], status);
-                       if (status->status < 0)
-                               return;
+                       switch (ips->type) {
+                       case RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL:
+                       case RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL:
+                               APP_CHECK_PRESENCE(udp_encap_p, tokens[ti],
+                                                  status);
+                               if (status->status < 0)
+                                       return;
 
-                       rule->udp_encap = 1;
-                       app_sa_prm.udp_encap = 1;
-                       udp_encap_p = 1;
+                               rule->udp_encap = 1;
+                               app_sa_prm.udp_encap = 1;
+                               udp_encap_p = 1;
+                               break;
+                       default:
+                               APP_CHECK(0, status,
+                                       "UDP encapsulation not supported for "
+                                       "security session type %d",
+                                       ips->type);
+                               return;
+                       }
                        continue;
                }