Make it easy to check if an address is locally usable via changed get_interface() method
This commit is contained in:
@@ -291,14 +291,14 @@ METHOD(kernel_interface_t, get_nexthop, host_t*,
|
||||
return this->net->get_nexthop(this->net, dest, src);
|
||||
}
|
||||
|
||||
METHOD(kernel_interface_t, get_interface, char*,
|
||||
private_kernel_interface_t *this, host_t *host)
|
||||
METHOD(kernel_interface_t, get_interface, bool,
|
||||
private_kernel_interface_t *this, host_t *host, char **name)
|
||||
{
|
||||
if (!this->net)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return this->net->get_interface(this->net, host);
|
||||
return this->net->get_interface(this->net, host, name);
|
||||
}
|
||||
|
||||
METHOD(kernel_interface_t, create_address_enumerator, enumerator_t*,
|
||||
|
||||
@@ -308,9 +308,10 @@ struct kernel_interface_t {
|
||||
* Get the interface name of a local address.
|
||||
*
|
||||
* @param host address to get interface name from
|
||||
* @return allocated interface name, or NULL if not found
|
||||
* @param name allocated interface name (optional)
|
||||
* @return TRUE if interface found and usable
|
||||
*/
|
||||
char* (*get_interface) (kernel_interface_t *this, host_t *host);
|
||||
bool (*get_interface) (kernel_interface_t *this, host_t *host, char **name);
|
||||
|
||||
/**
|
||||
* Creates an enumerator over all local addresses.
|
||||
|
||||
@@ -68,9 +68,10 @@ struct kernel_net_t {
|
||||
* Get the interface name of a local address.
|
||||
*
|
||||
* @param host address to get interface name from
|
||||
* @return allocated interface name, or NULL if not found
|
||||
* @param name allocated interface name (optional)
|
||||
* @return TRUE if interface found and usable
|
||||
*/
|
||||
char* (*get_interface) (kernel_net_t *this, host_t *host);
|
||||
bool (*get_interface) (kernel_net_t *this, host_t *host, char **name);
|
||||
|
||||
/**
|
||||
* Creates an enumerator over all local addresses.
|
||||
|
||||
Reference in New Issue
Block a user