]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
stroke: support %dynamic in left/rightsubnet for dynamic selectors
authorMartin Willi <martin@revosec.ch>
Wed, 5 Jun 2013 09:43:19 +0000 (11:43 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 19 Jun 2013 14:36:01 +0000 (16:36 +0200)
This has the same meaning as omitting left/rightsubnet, i.e. replace it
by the IKE address. Supporting %dynamic allows configurations with multiple
dynamic selectors in a left/rightsubnet, each with potentially different
proto/port selectors.

src/libcharon/plugins/stroke/stroke_config.c

index 9db9e01fdab8bc08e4c67566b6e774b1ad2cb504..64af5bb9cb3744489599486874e90bf7b207973e 100644 (file)
@@ -1020,8 +1020,16 @@ static void add_ts(private_stroke_config_t *this,
                                                continue;
                                        }
                                }
-                               ts = traffic_selector_create_from_cidr(subnet, proto,
-                                                                                                          from_port, to_port);
+                               if (streq(subnet, "%dynamic"))
+                               {
+                                       ts = traffic_selector_create_dynamic(proto,
+                                                                                                                from_port, to_port);
+                               }
+                               else
+                               {
+                                       ts = traffic_selector_create_from_cidr(subnet, proto,
+                                                                                                                  from_port, to_port);
+                               }
                                if (ts)
                                {
                                        child_cfg->add_traffic_selector(child_cfg, local, ts);