]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
swanctl: Report interface IDs in --list-sas
authorTobias Brunner <tobias@strongswan.org>
Tue, 12 Feb 2019 15:20:12 +0000 (16:20 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 4 Apr 2019 07:31:38 +0000 (09:31 +0200)
src/swanctl/commands/list_sas.c

index 232f03cc2a6951aa2a38296dfce15a927282fc25..ca2436dd2f7c6ce1c83b746cb9d1b05193792074 100644 (file)
@@ -166,12 +166,24 @@ CALLBACK(child_sas, int,
                printf("    in  %s%s%s", child->get(child, "spi-in"),
                        child->get(child, "cpi-in") ? "/" : "",
                        child->get(child, "cpi-in") ?: "");
-               if (child->get(child, "mark-in"))
+               if (child->get(child, "mark-in") || child->get(child, "if-id-in"))
                {
-                       printf(" (0x%s", child->get(child, "mark-in"));
-                       if (child->get(child, "mark-mask-in"))
+                       printf(" (");
+                       if (child->get(child, "mark-in"))
                        {
-                               printf("/0x%s", child->get(child, "mark-mask-in"));
+                               printf("0x%s", child->get(child, "mark-in"));
+                               if (child->get(child, "mark-mask-in"))
+                               {
+                                       printf("/0x%s", child->get(child, "mark-mask-in"));
+                               }
+                       }
+                       else
+                       {
+                               printf("-");
+                       }
+                       if (child->get(child, "if-id-in"))
+                       {
+                               printf("|0x%s", child->get(child, "if-id-in"));
                        }
                        printf(")");
                }
@@ -186,12 +198,24 @@ CALLBACK(child_sas, int,
                printf("    out %s%s%s", child->get(child, "spi-out"),
                        child->get(child, "cpi-out") ? "/" : "",
                        child->get(child, "cpi-out") ?: "");
-               if (child->get(child, "mark-out"))
+               if (child->get(child, "mark-out") || child->get(child, "if-id-out"))
                {
-                       printf(" (0x%s", child->get(child, "mark-out"));
-                       if (child->get(child, "mark-mask-out"))
+                       printf(" (");
+                       if (child->get(child, "mark-out"))
+                       {
+                               printf("0x%s", child->get(child, "mark-out"));
+                               if (child->get(child, "mark-mask-out"))
+                               {
+                                       printf("/0x%s", child->get(child, "mark-mask-out"));
+                               }
+                       }
+                       else
+                       {
+                               printf("-");
+                       }
+                       if (child->get(child, "if-id-out"))
                        {
-                               printf("/0x%s", child->get(child, "mark-mask-out"));
+                               printf("|0x%s", child->get(child, "if-id-out"));
                        }
                        printf(")");
                }