diff options
| author | Yves-Alexis Perez <corsac@debian.org> | 2013-02-07 13:27:27 +0100 |
|---|---|---|
| committer | Yves-Alexis Perez <corsac@debian.org> | 2013-02-07 13:27:27 +0100 |
| commit | b4f62acfae5e58d8bbdb5a2f3a4d22dc7a47f8af (patch) | |
| tree | 6a9ea7adf70239d85185a20f7d5878cfe95f8070 /src/libcharon/plugins/unity/unity_provider.c | |
| parent | 6307450b402e3c4a901fb8c0e54d8ad583ce2118 (diff) | |
| parent | 7585facf05d927eb6df3929ce09ed5e60d905437 (diff) | |
| download | vyos-strongswan-b4f62acfae5e58d8bbdb5a2f3a4d22dc7a47f8af.tar.gz vyos-strongswan-b4f62acfae5e58d8bbdb5a2f3a4d22dc7a47f8af.zip | |
Merge tag 'upstream/5.0.2'
Upstream version 5.0.2
Diffstat (limited to 'src/libcharon/plugins/unity/unity_provider.c')
| -rw-r--r-- | src/libcharon/plugins/unity/unity_provider.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/src/libcharon/plugins/unity/unity_provider.c b/src/libcharon/plugins/unity/unity_provider.c index c7feb090c..655b8724a 100644 --- a/src/libcharon/plugins/unity/unity_provider.c +++ b/src/libcharon/plugins/unity/unity_provider.c @@ -58,10 +58,8 @@ METHOD(enumerator_t, attribute_enumerate, bool, { return FALSE; } - if (ts->get_type(ts) == TS_IPV4_ADDR_RANGE && - ts->to_subnet(ts, &net, &mask)) + if (ts->to_subnet(ts, &net, &mask)) { - ts->destroy(ts); break; } ts->destroy(ts); @@ -94,6 +92,30 @@ METHOD(enumerator_t, attribute_destroy, void, free(this); } +/** + * Check if we should send a configured TS as Split-Include attribute + */ +static bool use_ts(traffic_selector_t *ts) +{ + u_int8_t mask; + host_t *net; + + if (ts->get_type(ts) != TS_IPV4_ADDR_RANGE) + { + return FALSE; + } + if (ts->is_dynamic(ts)) + { + return FALSE; + } + if (!ts->to_subnet(ts, &net, &mask)) + { + return FALSE; + } + net->destroy(net); + return mask > 0; +} + METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*, private_unity_provider_t *this, linked_list_t *pools, identification_t *id, linked_list_t *vips) @@ -122,7 +144,14 @@ METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*, current = child_cfg->get_traffic_selectors(child_cfg, TRUE, NULL, NULL); while (current->remove_first(current, (void**)&ts) == SUCCESS) { - list->insert_last(list, ts); + if (use_ts(ts)) + { + list->insert_last(list, ts); + } + else + { + ts->destroy(ts); + } } current->destroy(current); } |
