Skip to content

Commit

Permalink
macOS: fix pretty interface name extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
jclehner committed Aug 4, 2024
1 parent a040651 commit fba4421
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ethsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,14 @@ void find_pretty_name(const void* key, const void* value, void* context)
}

if (!strcmp(ctx->device, device)) {
ctx->pretty = dict_get_string(dict, "UserDefinedName");
// there are two instances of UserDefinedName. The one in the "Interface" dict
// defines a base name, such as "Wi-Fi", whereas the one in the root dict
// might contain a trailing number (e.g. "Wi-Fi 2") to identify multiple
// interfaces with the same base name.
ctx->pretty = dict_get_string((CFDictionaryRef)value, "UserDefinedName");
if (!ctx->pretty) {
ctx->pretty = dict_get_string(dict, "UserDefinedName");
}
}

free(device);
Expand Down

0 comments on commit fba4421

Please sign in to comment.