]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
vici: Include the Netfilter marks in listed CHILD_SAs
authorMartin Willi <martin@strongswan.org>
Fri, 6 Jan 2017 11:42:04 +0000 (12:42 +0100)
committerMartin Willi <martin@strongswan.org>
Mon, 13 Feb 2017 14:11:20 +0000 (15:11 +0100)
src/libcharon/plugins/vici/README.md
src/libcharon/plugins/vici/vici_query.c

index 18a3ef7b5d0ce369f781746025c889410058aebb..4e53d7cc9e6337ffe00935a1a7e9da4ff5b10aaf 100644 (file)
@@ -689,6 +689,10 @@ command.
                                        spi-out = <hex encoded outbound SPI>
                                        cpi-in = <hex encoded inbound CPI, if using compression>
                                        cpi-out = <hex encoded outbound CPI, if using compression>
+                                       mark-in = <hex encoded inbound Netfilter mark value>
+                                       mark-mask-in = <hex encoded inbound Netfilter mark mask>
+                                       mark-out = <hex encoded outbound Netfilter mark value>
+                                       mark-mask-out = <hex encoded outbound Netfilter mark mask>
                                        encr-alg = <ESP encryption algorithm name, if any>
                                        encr-keysize = <ESP encryption key size, if applicable>
                                        integ-alg = <ESP or AH integrity algorithm name, if any>
index 828b6192756a190fff5e056187a1306bc41425bd..e3a16f5eafecb28b39523d3fc7e793faedeef8a5 100644 (file)
@@ -79,6 +79,19 @@ struct private_vici_query_t {
        time_t uptime;
 };
 
+static void add_mark(vici_builder_t *b, mark_t mark,
+                                        char *label, char *mask_label)
+{
+       if (mark.value | mark.mask)
+       {
+               b->add_kv(b, label, "%.8x", mark.value);
+               if (~mark.mask)
+               {
+                       b->add_kv(b, mask_label, "%.8x", mark.mask);
+               }
+       }
+}
+
 /**
  * List details of a CHILD_SA
  */
@@ -114,6 +127,8 @@ static void list_child(private_vici_query_t *this, vici_builder_t *b,
                        b->add_kv(b, "cpi-in", "%.4x", ntohs(child->get_cpi(child, TRUE)));
                        b->add_kv(b, "cpi-out", "%.4x", ntohs(child->get_cpi(child, FALSE)));
                }
+               add_mark(b, child->get_mark(child, TRUE), "mark-in", "mark-mask-in");
+               add_mark(b, child->get_mark(child, FALSE), "mark-out", "mark-mask-out");
                proposal = child->get_proposal(child);
                if (proposal)
                {