dst = packet->get_destination(packet);
src = packet->get_source(packet);
- if (!hydra->kernel_interface->get_interface(hydra->kernel_interface,
- dst, NULL))
+ if (!hydra->kernel_interface->all_interfaces_usable(hydra->kernel_interface)
+ && !hydra->kernel_interface->get_interface(hydra->kernel_interface,
+ dst, NULL))
{
DBG3(DBG_NET, "received packet from %#H to %#H on ignored interface",
src, dst);
NULL, iface) == expected;
}
+METHOD(kernel_interface_t, all_interfaces_usable, bool,
+ private_kernel_interface_t *this)
+{
+ return this->ifaces_filter == NULL;
+}
+
METHOD(kernel_interface_t, get_address_by_ts, status_t,
private_kernel_interface_t *this, traffic_selector_t *ts, host_t **ip)
{
.enable_udp_decap = _enable_udp_decap,
.is_interface_usable = _is_interface_usable,
+ .all_interfaces_usable = _all_interfaces_usable,
.get_address_by_ts = _get_address_by_ts,
.add_ipsec_interface = _add_ipsec_interface,
.remove_ipsec_interface = _remove_ipsec_interface,
"%s.interfaces_use", NULL, hydra->daemon);
if (!ifaces)
{
+ this->ifaces_exclude = TRUE;
ifaces = lib->settings->get_str(lib->settings,
"%s.interfaces_ignore", NULL, hydra->daemon);
- if (ifaces)
- {
- this->ifaces_exclude = TRUE;
- }
}
if (ifaces)
{
* @param name allocated interface name (optional)
* @return TRUE if interface found and usable
*/
- bool (*get_interface) (kernel_interface_t *this, host_t *host, char **name);
+ bool (*get_interface)(kernel_interface_t *this, host_t *host, char **name);
/**
* Creates an enumerator over all local addresses.
*/
bool (*is_interface_usable)(kernel_interface_t *this, const char *iface);
+ /**
+ * Check if interfaces are excluded by config.
+ *
+ * @return TRUE if no interfaces are exclued by config
+ */
+ bool (*all_interfaces_usable)(kernel_interface_t *this);
+
/**
* Tries to find an IP address of a local interface that is included in the
* supplied traffic selector.