www.usr.com/support/gpl/USR9108_release1.5.tar.gz
[bcm963xx.git] / userapps / opensource / ipsec-tools / src / racoon / handler.c
index 8f49cc5..310a59b 100755 (executable)
@@ -679,6 +679,41 @@ unbindph12(iph2)
        }
 }
 
+// USR9108 Retrieve current status.
+void
+savestatus()
+{
+       struct ph1handle *ph1;
+       struct ph2handle *ph2;
+       int i = 0;
+       FILE * fp;
+
+       if ((fp = fopen("/var/racoon.sts", "w+"))) {
+               LIST_FOREACH(ph1, &ph1tree, chain) {
+                       if (ph1->status == PHASE1ST_ESTABLISHED) {
+                               LIST_FOREACH(ph2, &ph2tree, chain) {
+                                       if (ph2->ph1 != ph1)
+                                               continue;
+                                                                       
+                                       fprintf(fp, "%s 2 %d\n", 
+                                               saddrwop2str(ph2->dst), ph2->status);
+                               }
+                       }
+                       else 
+                               fprintf(fp, "%s 1 %d\n",
+                                       saddrwop2str(ph1->remote), ph1->status);
+               }
+               fclose(fp);
+       }
+}
+
+void cleanstatus()
+{
+       FILE *fp = fopen("/var/racoon.sts", "w+");
+       if ( fp )
+               fclose(fp);
+}
+
 /* %%% management contacted list */
 /*
  * search contacted list.