etherdevice.h (296344) | etherdevice.h (301544) |
---|---|
1/*- | 1/*- |
2 * Copyright (c) 2015 Mellanox Technologies, Ltd. All rights reserved. | 2 * Copyright (c) 2015-2016 Mellanox Technologies, Ltd. All rights reserved. |
3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice unmodified, this list of conditions, and the following 9 * disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 6 unchanged lines hidden (view full) --- 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * | 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice unmodified, this list of conditions, and the following 9 * disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 6 unchanged lines hidden (view full) --- 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * |
25 * $FreeBSD: head/sys/compat/linuxkpi/common/include/linux/etherdevice.h 296344 2016-03-03 09:56:04Z hselasky $ | 25 * $FreeBSD: head/sys/compat/linuxkpi/common/include/linux/etherdevice.h 301544 2016-06-07 13:10:13Z hselasky $ |
26 */ 27#ifndef _LINUX_ETHERDEVICE 28#define _LINUX_ETHERDEVICE 29 30#include <linux/types.h> 31 32#include <sys/random.h> 33#include <sys/libkern.h> --- 63 unchanged lines hidden (view full) --- 97eth_broadcast_addr(u8 *pa) 98{ 99 memset(pa, 0xff, 6); 100} 101 102static inline void 103random_ether_addr(u8 * dst) 104{ | 26 */ 27#ifndef _LINUX_ETHERDEVICE 28#define _LINUX_ETHERDEVICE 29 30#include <linux/types.h> 31 32#include <sys/random.h> 33#include <sys/libkern.h> --- 63 unchanged lines hidden (view full) --- 97eth_broadcast_addr(u8 *pa) 98{ 99 memset(pa, 0xff, 6); 100} 101 102static inline void 103random_ether_addr(u8 * dst) 104{ |
105 read_random(dst, 6); | 105 if (read_random(dst, 6) == 0) 106 arc4rand(dst, 6, 0); |
106 107 dst[0] &= 0xfe; 108 dst[0] |= 0x02; 109} 110 111#endif /* _LINUX_ETHERDEVICE */ | 107 108 dst[0] &= 0xfe; 109 dst[0] |= 0x02; 110} 111 112#endif /* _LINUX_ETHERDEVICE */ |