]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Use 0:0:0:0:0:0 MAC address when sending on inactive slaves
authorVincent Bernat <bernat@luffy.cx>
Tue, 9 Dec 2008 19:18:54 +0000 (20:18 +0100)
committerVincent Bernat <bernat@luffy.cx>
Tue, 9 Dec 2008 19:18:54 +0000 (20:18 +0100)
src/lldpd.c

index 8a7ba050d8cc4d4c184a259a1f26d8e66f9b7b49..ecf8e06ef719d36bfe7c88851a58d0c540af0581 100644 (file)
@@ -1176,27 +1176,6 @@ lldpd_recv_all(struct lldpd *cfg)
        } while ((rc != 0) || (time(NULL) - cfg->g_lastsent < cfg->g_delay));
 }
 
-static void
-get_random_ether(u_int8_t *lladdr)
-{
-       /* We use a simple law to generate random bytes of the MAC address and
-        * initialize (or re-initialize) the seed using microseconds part of
-        * gettimeofday. */
-       static u_int64_t next = 0;
-       int i = 0;
-       struct timeval tv;
-       if (next == 0) {
-               gettimeofday(&tv, NULL);
-               next = tv.tv_usec;
-       }
-       do {
-               next = next * 1103515245 + 12345;
-               lladdr[i] = (next/65536)%256;
-       } while (++i < ETHER_ADDR_LEN);
-       lladdr[0] &= 0xfe;      /* clear multicast bit */
-       lladdr[0] |= 0x02;      /* set local assignment bit (IEEE802) */
-}
-
 void
 lldpd_send_all(struct lldpd *cfg)
 {
@@ -1210,14 +1189,14 @@ lldpd_send_all(struct lldpd *cfg)
                if ((hardware->h_flags & IFF_UP) == 0)
                        continue;
 
-               /* When sending on inactive slaves, just send using a random address */
+               /* When sending on inactive slaves, just send using a 0:0:0:0:0:0 address */
                altermac = 0;
                if ((hardware->h_raw_real > 0) &&
                    (!iface_is_slave_active(cfg, hardware->h_master,
                        hardware->h_ifname))) {
                        altermac = 1;
                        memcpy(saved_lladdr, hardware->h_lladdr, ETHER_ADDR_LEN);
-                       get_random_ether(hardware->h_lladdr);
+                       memset(hardware->h_lladdr, 0, ETHER_ADDR_LEN);
                }
 
                for (i=0; cfg->g_protocols[i].mode != 0; i++) {