From: Vincent Bernat Date: Tue, 9 Dec 2008 18:37:24 +0000 (+0100) Subject: Simplify MAC address generation for enslaved inactive devices X-Git-Tag: 0.3~12^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3cb138e01b8ebb6f5232a2d48baaa1823813f689;p=thirdparty%2Flldpd.git Simplify MAC address generation for enslaved inactive devices --- diff --git a/src/lldpd.c b/src/lldpd.c index 0f515a7e..8a7ba050 100644 --- a/src/lldpd.c +++ b/src/lldpd.c @@ -1183,7 +1183,6 @@ get_random_ether(u_int8_t *lladdr) * initialize (or re-initialize) the seed using microseconds part of * gettimeofday. */ static u_int64_t next = 0; - u_int8_t random; int i = 0; struct timeval tv; if (next == 0) { @@ -1192,8 +1191,7 @@ get_random_ether(u_int8_t *lladdr) } do { next = next * 1103515245 + 12345; - random = (next/65536)%256; - memcpy(lladdr + i, &random, 1); + lladdr[i] = (next/65536)%256; } while (++i < ETHER_ADDR_LEN); lladdr[0] &= 0xfe; /* clear multicast bit */ lladdr[0] |= 0x02; /* set local assignment bit (IEEE802) */