Browse files

Assume that "lo" is always the loopback prefix for finding a decent i…

…nterface for a MAC address.
  • Loading branch information...
1 parent 32d21e8 commit 232c7f36d0313b7a1a196a14935ed100fce11394 @okeuday committed Apr 9, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/uuid.erl
View
4 src/uuid.erl
@@ -87,7 +87,9 @@
new(Pid) when is_pid(Pid) ->
{ok, Ifs} = inet:getiflist(),
% at least one unique network interface must exist
- If = [_ | _] = lists:last(lists:delete("lo", Ifs)),
+ If = [_ | _] = lists:last(lists:filter(fun(I) ->
+ not lists:prefix("lo", I)
+ end, Ifs)),
% 48 bits for MAC address
{ok,[{hwaddr,[OUI1,OUI2,OUI3,NIC1,NIC2,NIC3]}]} = inet:ifget(If, [hwaddr]),
% reduce the MAC address to 16 bits

0 comments on commit 232c7f3

Please sign in to comment.