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:
parent
6f18422aad
commit
961104262c
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user