1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

lib-interface: Add new API to validate interface info for given interface index

Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Vinit Agnihotri 2024-02-20 02:40:13 -08:00 committed by Martin Schwenke
parent 6f18422aad
commit 961104262c
2 changed files with 18 additions and 0 deletions

View File

@ -719,3 +719,20 @@ bool interfaces_changed(void)
TALLOC_FREE(ifaces);
return ret;
}
/****************************************************************************
Return True if interface exists for given interface index
**************************************************************************/
bool interface_ifindex_exists(int if_index)
{
struct interface *i;
for (i = local_interfaces; i != NULL; i = i->next) {
if (i->if_index == if_index) {
return true;
}
}
return false;
}

View File

@ -42,5 +42,6 @@ bool iface_local(const struct sockaddr *ip);
void load_interfaces(void);
void gfree_interfaces(void);
bool interfaces_changed(void);
bool interface_ifindex_exists(int if_index);
#endif /* _INTERFACE_H */