mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-18 20:57:56 +00:00
Remove overlay_interface_find_name
This commit is contained in:
parent
39520f5bd8
commit
884a6211eb
@ -295,26 +295,15 @@ overlay_interface * overlay_interface_find(struct in_addr addr, int return_defau
|
||||
return ret;
|
||||
}
|
||||
|
||||
// find an interface by name
|
||||
overlay_interface * overlay_interface_find_name(const char *name){
|
||||
int i;
|
||||
for (i=0;i<OVERLAY_MAX_INTERFACES;i++){
|
||||
if (overlay_interfaces[i].state!=INTERFACE_STATE_UP)
|
||||
continue;
|
||||
if (strcasecmp(name, overlay_interfaces[i].name) == 0)
|
||||
return &overlay_interfaces[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// find an interface by name and address
|
||||
// find an interface by name and/or exact address
|
||||
overlay_interface * overlay_interface_find_name_addr(const char *name, struct socket_address *addr){
|
||||
int i;
|
||||
assert(name || addr);
|
||||
for(i = 0; i < OVERLAY_MAX_INTERFACES; i++){
|
||||
if (overlay_interfaces[i].state==INTERFACE_STATE_DOWN)
|
||||
continue;
|
||||
|
||||
if (cmp_sockaddr(addr, &overlay_interfaces[i].address)==0
|
||||
if ((!addr || cmp_sockaddr(addr, &overlay_interfaces[i].address)==0)
|
||||
&& (!name || strcasecmp(overlay_interfaces[i].name, name)==0)){
|
||||
return &overlay_interfaces[i];
|
||||
}
|
||||
|
@ -129,7 +129,6 @@ int overlay_interface_register(const char *name,
|
||||
void overlay_interface_close_all();
|
||||
overlay_interface * overlay_interface_get_default();
|
||||
overlay_interface * overlay_interface_find(struct in_addr addr, int return_default);
|
||||
overlay_interface * overlay_interface_find_name(const char *name);
|
||||
overlay_interface * overlay_interface_find_name_addr(const char *name, struct socket_address *addr);
|
||||
int overlay_interface_compare(overlay_interface *one, overlay_interface *two);
|
||||
int overlay_broadcast_ensemble(struct network_destination *destination, struct overlay_buffer *buffer);
|
||||
|
@ -121,7 +121,7 @@ struct network_destination *load_subscriber_address(struct subscriber *subscribe
|
||||
const struct config_host *hostc = &config.hosts.av[i].value;
|
||||
overlay_interface *interface = NULL;
|
||||
if (*hostc->interface){
|
||||
interface = overlay_interface_find_name(hostc->interface);
|
||||
interface = overlay_interface_find_name_addr(hostc->interface, NULL);
|
||||
if (!interface){
|
||||
WARNF("Can't find configured interface %s", hostc->interface);
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user