OSSP CVS Repository

ossp - Difference in ossp-pkg/uuid/uuid.c versions 1.44 and 1.45
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/uuid/uuid.c 1.44 -> 1.45

--- uuid.c       2004/01/19 14:56:35     1.44
+++ uuid.c       2004/02/13 21:01:41     1.45
@@ -61,69 +61,9 @@
     Unix UTC base time is January  1, 1970) */
 #define UUID_TIMEOFFSET "01B21DD213814000"
 
-/* IEEE 802 MAC address encoding/decoding bit fields
-
-   ATTENTION:
-
-   In case no real/physical IEEE 802 address is available, both
-   "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."
-
-   This passage clearly explains the intention to use IEEE 802 multicast
-   addresses. Unfortunately, it incorrectly explains how to implement
-   this! It 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.
-
-   Unfortunately, even the reference implementation included in the
-   expired IETF "draft-leach-uuids-guids-01" incorrectly set the
-   multicast bit with an OR bit operation and an incorrect mask of
-   0x80. Hence, several other UUID implementations found on the
-   Internet have inherited this bug.
-
-   Luckily, neither DCE 1.1 nor ISO/IEC 11578:1996 are affected by this
-   problem. They disregard the topic of missing IEEE 802 addresses
-   entirely, and thus avoid adopting this bug from the original draft
-   and code ;-)
-
-   It seems that this standards bug arises 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
-   authors were likely not aware 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).
-
-   For more information, see "Understanding Physical Addresses" in
-   "Ethernet -- The Definitive Guide", p.43, and the section "ETHERNET
-   MULTICAST ADDRESSES" in http://www.iana.org/assignments/ethernet-numbers.
-
-   At OSSP, we do it the intended/correct way and generate a real
-   IEEE 802 multicast address. Those wanting to encode broken IEEE
-   802 MAC addresses (as specified) can nevertheless use a brain dead
-   compile-time option to switch off the correct behavior. When decoding
-   we always use the correct behavior of course. */
-
-/* encoding */
-#ifdef WITH_RFC2518
-#define IEEE_MAC_MCBIT_ENC BM_OCTET(1,0,0,0,0,0,0,0)
-#else
-#define IEEE_MAC_MCBIT_ENC BM_OCTET(0,0,0,0,0,0,0,1)
-#endif
-#define IEEE_MAC_LOBIT_ENC BM_OCTET(0,0,0,0,0,0,1,0)
-
-/* decoding */
-#define IEEE_MAC_MCBIT_DEC BM_OCTET(0,0,0,0,0,0,0,1)
-#define IEEE_MAC_LOBIT_DEC BM_OCTET(0,0,0,0,0,0,1,0)
+/* IEEE 802 MAC address encoding/decoding bit fields */
+#define IEEE_MAC_MCBIT BM_OCTET(0,0,0,0,0,0,0,1)
+#define IEEE_MAC_LOBIT BM_OCTET(0,0,0,0,0,0,1,0)
 
 /* IEEE 802 MAC address octet length */
 #define IEEE_MAC_OCTETS 6
@@ -622,8 +562,8 @@
             (unsigned int)uuid->obj.node[3],
             (unsigned int)uuid->obj.node[4],
             (unsigned int)uuid->obj.node[5],
-            (uuid->obj.node[0] & IEEE_MAC_LOBIT_DEC ? "local" : "global"),
-            (uuid->obj.node[0] & IEEE_MAC_MCBIT_DEC ? "multicast" : "unicast"));
+            (uuid->obj.node[0] & IEEE_MAC_LOBIT ? "local" : "global"),
+            (uuid->obj.node[0] & IEEE_MAC_MCBIT ? "multicast" : "unicast"));
     }
     else {
         /* decode anything else as hexadecimal byte-string only */
@@ -843,8 +783,8 @@
     if ((mode & UUID_MAKE_MC) || (uuid->mac[0] & BM_OCTET(1,0,0,0,0,0,0,0))) {
         /* generate random IEEE 802 local multicast MAC address */
         prng_data(uuid->prng, (void *)&(uuid->obj.node), sizeof(uuid->obj.node));
-        uuid->obj.node[0] |= IEEE_MAC_MCBIT_ENC;
-        uuid->obj.node[0] |= IEEE_MAC_LOBIT_ENC;
+        uuid->obj.node[0] |= IEEE_MAC_MCBIT;
+        uuid->obj.node[0] |= IEEE_MAC_LOBIT;
     }
     else {
         /* use real regular MAC address */

CVSTrac 2.0.1