Don't check interface of inbound message if interfaces are not filtered
We don't have a proper kernel-net interface on Android yet, so the check for a usable interface does not work there.
This commit is contained in:
@@ -447,8 +447,9 @@ static job_requeue_t receive_packets(private_receiver_t *this)
|
||||
|
||||
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);
|
||||
|
||||
@@ -389,6 +389,12 @@ METHOD(kernel_interface_t, is_interface_usable, bool,
|
||||
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)
|
||||
{
|
||||
@@ -698,6 +704,7 @@ kernel_interface_t *kernel_interface_create()
|
||||
.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,
|
||||
@@ -725,12 +732,9 @@ kernel_interface_t *kernel_interface_create()
|
||||
"%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)
|
||||
{
|
||||
|
||||
@@ -312,7 +312,7 @@ struct kernel_interface_t {
|
||||
* @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.
|
||||
@@ -415,6 +415,13 @@ struct kernel_interface_t {
|
||||
*/
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user