Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for hardware addresses that are zero or not six octets #20

Open
WhiteRC opened this issue Jun 23, 2019 · 1 comment
Open

Fixes for hardware addresses that are zero or not six octets #20

WhiteRC opened this issue Jun 23, 2019 · 1 comment

Comments

@WhiteRC
Copy link

WhiteRC commented Jun 23, 2019

Howdy, I've got two patches stored in my local git repository.

One corrects the directory hierarchy to move the include file into an include directory.

The other one fixes the case where a system has devices with hardware addresses that are zero or consist of other than six octets. Linux sit devices, for example, default to four bytes of zeros.

I can't create a text patch for the directory layout change, but the byte problem is included below.

If you want the direct (teste) push of both I need permissions.


src/uuid.erl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/uuid.erl b/src/uuid.erl
index 38a27c2..ecb7a66 100644
--- a/src/uuid.erl
+++ b/src/uuid.erl
@@ -318,8 +318,12 @@ hwaddr_find([{"lo", _IfConfig}|Rest]) ->
     hwaddr_find(Rest);
  hwaddr_find([{_IfName, IfConfig}|Rest]) ->
     case lists:keyfind(hwaddr, 1, IfConfig) of
-        {hwaddr, HwAddr} ->
+        {hwaddr, [0,0,0,0,0,0] = _HwAddr} ->
+            hwaddr_find(Rest);
+        {hwaddr, HwAddr} when length(HwAddr) == 6 ->
             list_to_binary(HwAddr);
+        {hwaddr, _HwAddr} ->
+            hwaddr_find(Rest);
         false ->
             hwaddr_find(Rest)
     end;
-- 
2.22.0
@avtobiff
Copy link
Owner

Thanks!

Can you push your repository to github and open a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants