X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fethernet%2Fmac_address.h;h=01fb76e002b707fc5d3a7da999ef5228eba74585;hb=fe750c248be58b76479836639fbd0c4617210aa5;hp=87a66a242be9d1b35de76c8a9f56e1920f20023e;hpb=6bc6fd0aebd7feb523604973bcf593bfe14bbd30;p=vpp.git diff --git a/src/vnet/ethernet/mac_address.h b/src/vnet/ethernet/mac_address.h index 87a66a242be..01fb76e002b 100644 --- a/src/vnet/ethernet/mac_address.h +++ b/src/vnet/ethernet/mac_address.h @@ -70,6 +70,17 @@ ethernet_mac_address_is_zero (const u8 * mac) return ((*((u32 *) mac) == 0) && (*((u16 *) (mac + 4)) == 0)); } +static inline void +ethernet_mac_address_generate (u8 * mac) +{ + u32 rnd = clib_cpu_time_now (); + rnd = random_u32 (&rnd); + + memcpy (mac + 2, &rnd, sizeof (rnd)); + mac[0] = 2; + mac[1] = 0xfe; +} + static inline int ethernet_mac_address_equal (const u8 * a, const u8 * b) {