]> granicus.if.org Git - python/commitdiff
Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 26 Nov 2013 20:49:36 +0000 (22:49 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 26 Nov 2013 20:49:36 +0000 (22:49 +0200)
virtual interface.  Original patch by Kent Frazier.

1  2 
Lib/uuid.py
Misc/ACKS
Misc/NEWS

diff --cc Lib/uuid.py
index 93254ec7cf968b2d301f64112893427b56a77b26,d5c3160fdfdf375763bd39278daef7ba973cd033..385fb9b0876fae93519e0e8377a7974f54267919
@@@ -327,9 -327,17 +327,17 @@@ def _find_mac(command, args, hw_identif
                      words = line.lower().split()
                      for i in range(len(words)):
                          if words[i] in hw_identifiers:
-                             return int(
-                                 words[get_index(i)].replace(':', ''), 16)
+                             try:
+                                 return int(
+                                     words[get_index(i)].replace(':', ''), 16)
+                             except (ValueError, IndexError):
+                                 # Virtual interfaces, such as those provided by
+                                 # VPNs, do not have a colon-delimited MAC address
+                                 # as expected, but a 16-byte HWAddr separated by
+                                 # dashes. These should be ignored in favor of a
+                                 # real MAC address
+                                 pass
 -        except IOError:
 +        except OSError:
              continue
      return None
  
diff --cc Misc/ACKS
Simple merge
diff --cc Misc/NEWS
Simple merge