Commit 1f3c1fdb authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

nsiproxy.sys: Update interface table only if LUID is not found in convert_luid_to_unix_name().

parent 8e756fe5
...@@ -286,17 +286,19 @@ static struct if_entry *add_entry( UINT index, char *name ) ...@@ -286,17 +286,19 @@ static struct if_entry *add_entry( UINT index, char *name )
return entry; return entry;
} }
static void update_if_table( void ) static unsigned int update_if_table( void )
{ {
struct if_nameindex *indices = if_nameindex(), *entry; struct if_nameindex *indices = if_nameindex(), *entry;
unsigned int append_count = 0;
for (entry = indices; entry->if_index; entry++) for (entry = indices; entry->if_index; entry++)
{ {
if (!find_entry_from_index( entry->if_index )) if (!find_entry_from_index( entry->if_index ) && add_entry( entry->if_index, entry->if_name ))
add_entry( entry->if_index, entry->if_name ); ++append_count;
} }
if_freenameindex( indices ); if_freenameindex( indices );
return append_count;
} }
static void if_counted_string_init( IF_COUNTED_STRING *str, const WCHAR *value ) static void if_counted_string_init( IF_COUNTED_STRING *str, const WCHAR *value )
...@@ -634,18 +636,24 @@ BOOL convert_luid_to_unix_name( const NET_LUID *luid, const char **unix_name ) ...@@ -634,18 +636,24 @@ BOOL convert_luid_to_unix_name( const NET_LUID *luid, const char **unix_name )
{ {
struct if_entry *entry; struct if_entry *entry;
BOOL ret = FALSE; BOOL ret = FALSE;
int updated = 0;
pthread_mutex_lock( &if_list_lock ); pthread_mutex_lock( &if_list_lock );
update_if_table(); do
{
LIST_FOR_EACH_ENTRY( entry, &if_list, struct if_entry, entry ) LIST_FOR_EACH_ENTRY( entry, &if_list, struct if_entry, entry )
if (entry->if_luid.Value == luid->Value)
{ {
*unix_name = entry->if_unix_name; if (entry->if_luid.Value == luid->Value)
ret = TRUE; {
break; *unix_name = entry->if_unix_name;
ret = TRUE;
goto done;
}
} }
} while (!updated++ && update_if_table());
done:
pthread_mutex_unlock( &if_list_lock ); pthread_mutex_unlock( &if_list_lock );
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment