[Bug 1956] New: [PATCH] Incorrect random multicast MAC address creation in UUID generator

Wine Bugs wine-bugs at winehq.org
Fri Jan 23 02:58:37 CST 2004


http://bugs.winehq.org/show_bug.cgi?id=1956

           Summary: [PATCH] Incorrect random multicast MAC address creation
                    in UUID generator
           Product: Wine
           Version: 20031212
          Platform: All
        OS/Version: other
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: wine-kernel
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: rse at engelschall.com


In case no real/physical IEEE 802 address is available, both the expired
"draft-leach-uuids-guids-01" (section "4. Node IDs when no IEEE 802
network card is available") and RFC 2518 (section "6.4.1 Node Field
Generation Without the IEEE 802 Address") recommend (quoted from RFC
2518):

  "The ideal solution is to obtain a 47 bit cryptographic quality random
  number, and use it as the low 47 bits of the node ID, with the _most_
  significant bit of the first octet of the node ID set to 1. This bit
  is the unicast/multicast bit, which will never be set in IEEE 802
  addresses obtained from network cards; hence, there can never be a
  conflict between UUIDs generated by machines with and without network
  cards."

Unfortunately, this incorrectly explains how to implement this and
this UUID generator code inherited this generation bug from the broken
reference code in the standards draft. They should instead specify the
"_least_ significant bit of the first octet of the node ID" as the
multicast bit in a memory and hexadecimal string representation of a
48-bit IEEE 802 MAC address.

This standards bug arised from a false interpretation, as the multicast
bit is actually the _most_ significant bit in IEEE 802.3 (Ethernet)
_transmission order_ of an IEEE 802 MAC address. The standards authors
forgot that the bitwise order of an _octet_ from a MAC address _memory_
and hexadecimal string representation is still always from left (MSB,
bit 7) to right (LSB, bit 0).

The following patch fixes this:

--- wine/dlls/rpcrt4/rpcrt4_main.c.orig Thu Sep 11 03:05:19 2003
+++ wine/dlls/rpcrt4/rpcrt4_main.c  Thu Jan 15 18:18:08 2004
@@ -351,7 +351,7 @@
       if (sd < 0) {
     /* if we can't open a socket, just use random numbers */
     /* set the multicast bit to prevent conflicts with real cards */
-    a[0] = (rand() & 0xff) | 0x80;
+    a[0] = (rand() & 0xff) | 0x01;
     a[1] = rand() & 0xff;
     a[2] = rand() & 0xff;
     a[3] = rand() & 0xff;
@@ -366,7 +366,7 @@
        close(sd);
        /* no ifconf, so just use random numbers */
        /* set the multicast bit to prevent conflicts with real cards */
-       a[0] = (rand() & 0xff) | 0x80;
+       a[0] = (rand() & 0xff) | 0x01;
        a[1] = rand() & 0xff;
        a[2] = rand() & 0xff;
        a[3] = rand() & 0xff;
@@ -403,7 +403,7 @@
        }
        /* if we didn't find a valid address, make a random one */
        /* once again, set multicast bit to avoid conflicts */
-       a[0] = (rand() & 0xff) | 0x80;
+       a[0] = (rand() & 0xff) | 0x01;
        a[1] = rand() & 0xff;
        a[2] = rand() & 0xff;
        a[3] = rand() & 0xff;
@@ -416,7 +416,7 @@
       }
 #else
       /* no networking info, so generate a random address */
-      a[0] = (rand() & 0xff) | 0x80;
+      a[0] = (rand() & 0xff) | 0x01;
       a[1] = rand() & 0xff;
       a[2] = rand() & 0xff;
       a[3] = rand() & 0xff;

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the wine-bugs mailing list