aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2016-10-12 12:28:18 +0200
committerTobias Brunner <tobias@strongswan.org>2017-02-08 10:38:28 +0100
commit62b58a40da47031f0a46fa7d28b03cb327ebd6b5 (patch)
treee820cd769366ebb9abcd62e809385668d98f3081 /src
parent2406474158413810348665876ddb3a56818e92d8 (diff)
downloadstrongswan-62b58a40da47031f0a46fa7d28b03cb327ebd6b5.tar.bz2
strongswan-62b58a40da47031f0a46fa7d28b03cb327ebd6b5.tar.xz
bypass-lan: Configure interface on bypass policy
Currently, only the kernel-netlink plugin supports this, the others will just ignore it.
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/plugins/bypass_lan/bypass_lan_listener.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libcharon/plugins/bypass_lan/bypass_lan_listener.c b/src/libcharon/plugins/bypass_lan/bypass_lan_listener.c
index 3e744b96d..a5e4df761 100644
--- a/src/libcharon/plugins/bypass_lan/bypass_lan_listener.c
+++ b/src/libcharon/plugins/bypass_lan/bypass_lan_listener.c
@@ -51,6 +51,7 @@ typedef struct {
private_bypass_lan_listener_t *listener;
host_t *net;
uint8_t mask;
+ char *iface;
child_cfg_t *cfg;
} bypass_policy_t;
@@ -72,6 +73,7 @@ static void bypass_policy_destroy(bypass_policy_t *this)
ts->destroy(ts);
}
this->net->destroy(this->net);
+ free(this->iface);
free(this);
}
@@ -115,6 +117,7 @@ static job_requeue_t update_bypass(private_bypass_lan_listener_t *this)
INIT(lookup,
.net = net->clone(net),
.mask = mask,
+ .iface = strdupnull(iface),
);
seen->put(seen, lookup, lookup);
@@ -123,6 +126,7 @@ static job_requeue_t update_bypass(private_bypass_lan_listener_t *this)
{
child_cfg_create_t child = {
.mode = MODE_PASS,
+ .interface = iface,
};
child_cfg_t *cfg;
traffic_selector_t *ts;
@@ -130,7 +134,7 @@ static job_requeue_t update_bypass(private_bypass_lan_listener_t *this)
ts = traffic_selector_create_from_subnet(net->clone(net), mask,
0, 0, 65535);
- snprintf(name, sizeof(name), "Bypass LAN %R", ts);
+ snprintf(name, sizeof(name), "Bypass LAN %R [%s]", ts, iface ?: "");
cfg = child_cfg_create(name, &child);
cfg->add_traffic_selector(cfg, FALSE, ts->clone(ts));
@@ -141,6 +145,7 @@ static job_requeue_t update_bypass(private_bypass_lan_listener_t *this)
INIT(found,
.net = net->clone(net),
.mask = mask,
+ .iface = strdupnull(iface),
.cfg = cfg,
);
this->policies->put(this->policies, found, found);