.BR charon.plugins.farp.enable " [yes]"
Enable faking of ARP responses for remote IP addresses of established CHILD_SAs
.TP
+.BR charon.plugins.farp.only_for
+A comma-separated list of connection names for which ARP responses should be
+faked. If not configured ARP responses will be generated for remote IP
+addresses of all established CHILD_SAs.
+.TP
.BR charon.plugins.ha.fifo_interface " [yes]"
.TP
/*
+ * Copyright (C) 2013 Tobias Brunner
+ * Hochschule fuer Technik Rapperswil
+ *
* Copyright (C) 2010 Martin Willi
* Copyright (C) 2010 revosec AG
*
#include "farp_listener.h"
+#include <daemon.h>
#include <collections/linked_list.h>
#include <threading/rwlock.h>
*/
linked_list_t *entries;
+ /**
+ * List with connection names for which ARP packets should be faked,
+ * NULL to enable it for all SAs
+ */
+ linked_list_t *only_for;
+
/**
* RWlock for IP list
*/
if (up)
{
+ if (this->only_for &&
+ this->only_for->find_first(this->only_for, (void*)streq, NULL,
+ child_sa->get_name(child_sa)) != SUCCESS)
+ {
+ return TRUE;
+ }
+
INIT(entry,
.local = child_sa->get_traffic_selectors(child_sa, TRUE),
.remote = child_sa->get_traffic_selectors(child_sa, FALSE),
METHOD(farp_listener_t, destroy, void,
private_farp_listener_t *this)
{
+ DESTROY_FUNCTION_IF(this->only_for, (void*)free);
this->entries->destroy(this->entries);
this->lock->destroy(this->lock);
free(this);
farp_listener_t *farp_listener_create()
{
private_farp_listener_t *this;
+ char *names;
INIT(this,
.public = {
.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
);
+ names = lib->settings->get_str(lib->settings, "%s.plugins.farp.only_for",
+ NULL, charon->name);
+ if (names)
+ {
+ enumerator_t *enumerator;
+ char *name;
+
+ enumerator = enumerator_create_token(names, ",", " ");
+ while (enumerator->enumerate(enumerator, &name))
+ {
+ if (!this->only_for)
+ {
+ this->only_for = linked_list_create();
+ }
+ this->only_for->insert_last(this->only_for, strdup(name));
+ }
+ enumerator->destroy(enumerator);
+ }
+
return &this->public;
}