SDOCM00112119,SDOCM00108231: Added option for stop_offload command to not expire SA
authorTinku Mannan <tmannan@ti.com>
Wed, 23 Jul 2014 14:57:13 +0000 (10:57 -0400)
committerTinku Mannan <tmannan@ti.com>
Wed, 23 Jul 2014 14:57:13 +0000 (10:57 -0400)
ti/runtime/netapi/applications/ipsec_offload/config-app/src/cmd_shell.c
ti/runtime/netapi/applications/ipsec_offload/ipsecmgr/src/netapi_ipsecmgr.c

index e2c31e555ff43a3f2ffa23c49636899587967215..152a2cfda3532b264824e1dd99790da727a647ea 100755 (executable)
@@ -59,7 +59,8 @@
 #define OPTION_ID_GTPU_TEID     5
 #define OPTION_ID_NUM_TEIDS     6
 #define OPTION_ID_SHARED_SA     7
-#define OPTION_ID_MAX           8
+#define OPTION_ID_NO_EXPIRE_SA  8
+#define OPTION_ID_MAX           9
 
 enum cmd_id {
     CMD_ID_OFFLOAD_SP   = 1,
@@ -134,10 +135,12 @@ static struct option offload_sp_options[] =
 #define CMD_NAME_STOP_OFFLOAD   "stop_offload"
 #define CMD_DESC_STOP_OFFLOAD   "Stop Offload of an IPSec Policy"
 #define CMD_MIN_ARGS_STOP_OFFLOAD   3
-#define CMD_SHORT_OPTS_STOP_OFFLOAD snprintf(short_opts,CMD_SHORT_OPTS_LEN, "%d:", OPTION_ID_SP_ID);
+#define CMD_SHORT_OPTS_STOP_OFFLOAD snprintf(short_opts,CMD_SHORT_OPTS_LEN, "%d:%d",\
+                                OPTION_ID_SP_ID, OPTION_ID_NO_EXPIRE_SA);
 static struct option stop_offload_options[] =
 {
     {"sp_id",  required_argument, 0, OPTION_ID_SP_ID},
+    {"no_expire_sa", no_argument, 0, OPTION_ID_NO_EXPIRE_SA},
     {0, 0, 0, 0}
 };
 
@@ -409,6 +412,12 @@ void* cmd_shell (void* args)
                 opt_input_gen[c].is_valid = 1;
                 break;
 
+                case OPTION_ID_NO_EXPIRE_SA:
+#ifdef DEBUG
+                printf ("option no_expire_sa enabled\n");
+#endif
+                opt_input_gen[c].is_valid = 1;
+                break;
                 default:
                 printf ("unknown option c=%d\n", c);
                 break;
@@ -520,6 +529,9 @@ void* cmd_shell (void* args)
             req.policy_id =
                     (uint32_t)opt_input_gen[OPTION_ID_SP_ID].value.intval;
 
+            if (opt_input_gen[OPTION_ID_NO_EXPIRE_SA].is_valid) {
+                req.no_expire_sa = 1;
+            }
             if (shell_ctx.ipc_send_if->stop_offload_req(&req)) {
                 printf("%s failed\n", CMD_NAME_STOP_OFFLOAD);
             } else {
index ff1b2eae5d928a1f26cf18b49ee2f2bd4fb9f8de..461ee211bcc7017a426036f71258697ae3b5059e 100755 (executable)
@@ -450,6 +450,7 @@ static void stop_offload_req_recv
 
     stop_offload_req.trans_id = req->trans_id;
     stop_offload_req.policy_id = req->policy_id;
+    stop_offload_req.no_expire_sa = req->no_expire_sa;
 
     memset(&rsp, 0, sizeof(rsp));
     rsp.trans_id = req->trans_id;